UC_ksampler
Your entire sampler row — steps, cfg, sampler, size, decode — collapsed into one node
- context
- model
- positive
- negative
- latent
- latent_image
- latent_mask
- context
- latent
- image
- audio
If you've looked at a modern ComfyUI graph, you know the drill: Empty Latent Image, KSampler, VAEDecode, and about nine widgets you re-type every time. UC_ksampler is that whole row as one node - it pulls model, conditioning, latent and VAE out of a RUN_CONTEXT, samples, decodes, and hands you back a context plus the latent, the image and any audio.
The design bet is that you set steps/cfg/sampler once, upstream, and let samplers inherit. Get used to the two inheritance toggles and this node disappears into the background; fight them and you'll spend an evening wondering why changing steps did nothing.
The inputs that matter
- context - required. Everything else has a fallback: if
model,positiveornegativearen't wired, they come off the context. - sample_parameters - the master inheritance switch. Off means "inherit context" and the four widgets below are ignored; on means "custom" and your local
steps,cfg,sampler,schedulerwin. - latent_size - the same idea for geometry. Off means prefer the upstream latent's dimensions; on means build a fresh latent from
width/height(orratio_selected, which is a dropdown of ~30 named sizes like[768x1024]3:4,[512x384]ADand[720x1280]竖屏标清). - seed, denoise - the obvious two.
denoiseat 1.0 is txt2img; drop it and you're doing an img2img pass. - VAE_Decode - leave it on and you get a decoded IMAGE plus audio through the context's audio VAE. Turn it off and the node skips decoding entirely, which is a real speedup when you're chaining samplers and only want the latent.
Then the optional sockets, which are the interesting part. latent_image takes an IMAGE and VAE-encodes it for you. latent_mask applies a MASK as a noise_mask on the latent, which is ComfyUI's inpainting path. latent lets you inject a latent directly. Order of precedence, straight from the code: an image wins over a wired latent, which wins over the context's latent, which falls back to a black latent at your chosen size - repeated to batch_size - if there's nothing at all.
Default values tell you what era this was built for: steps 8, cfg 1.0, euler, simple. That's a distilled flow-matching model's settings, not SDXL's. Worth knowing when you import an SD 1.5 workflow and everything comes out flat: at CFG 1 ComfyUI doesn't even run the negative pass, and your negative prompt is decoration.
Outputs
context (updated with the new latent and the sampling settings actually used), latent, image, audio. The context output is what you daisy-chain - sampler two takes sampler one's context and inherits its steps. audio only has anything in it when the context carries an audio_vae, so on audio-capable video models you get the sound track on the same wire as the picture.
If a conditioning socket is left empty the node encodes defaults through CLIP rather than erroring - an empty string for positive, the word blur for negative. Convenient, and also the reason a node with no text encoder wired "works" and generates mush. The pack leans on CLIP for these fallbacks, so a context without a clip will fail there and only there.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
cd ComfyUI-Apt_Preset
pip install -r requirements.txt
Restart ComfyUI. The node is under Apt_Preset/unit_context; Manager users can search Apt_Preset. Nothing model-side to download beyond whatever checkpoint you're sampling, and if you use it with UC_load_model, that loader will already have encoded a default positive and negative into the context for you.
Common issues
The one you'll hit first is a context that doesn't have what the node needs. A missing VAE only errors if it's actually needed - decoding, or encoding a latent_image. A missing model or CLIP errors wherever it first gets used, which is often not at this node. Feed it a UC_create_context output if in doubt.
Second: inheritance is silent. sample_parameters off means the steps box on the node is dead, greyed-out-looking or not. Everyone loses ten minutes to this. Same for latent_size and your width/height.
Third: tiling and VRAM belong elsewhere. This node has no tile or memory dials; if you're OOMing during sampling, that's a job for the pack's controller stacks or the tiled variants, not for fiddling with batch_size and hoping.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| context | RUN_CONTEXT | — | |
| seed | INT | 00–18446744073709550000 | — |
| denoise | FLOAT | 1.000–1 | — |
| VAE_Decode | BOOLEAN | true | 关闭后不生成图片和音频,速度提升 |
| sample_parameters | BOOLEAN | false | 继承context时使用上游参数,自定义时使用下方参数 |
| steps | INT | 80–10000 | — |
| cfg | FLOAT | 1.000–100 | — |
| sampler | COMBO | euler | 45 options: None, euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, +39 |
| scheduler | COMBO | simple | 10 options: None, simple, sgm_uniform, karras, exponential, ddim_uniform, +4 |
| latent_size | BOOLEAN | false | 继承context时优先使用上游latent尺寸 |
| ratio_selected | COMBO | None | 32 options: None, customer_WxH, [384x512]AD, [512x384]AD, [512x512]1:1, [512x768]2:3, +26 |
| batch_size | INT | 11–300 | — |
| width | INT | 5128–16384 | — |
| height | INT | 5128–16384 | — |
| modelopt | MODEL | — | |
| positiveopt | CONDITIONING | — | |
| negativeopt | CONDITIONING | — | |
| latentopt | LATENT | — | |
| latent_imageopt | IMAGE | — | |
| latent_maskopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| context | RUN_CONTEXT | — |
| latent | LATENT | — |
| image | IMAGE | — |
| audio | AUDIO | — |