CMK KSampler -Pipe-
The sampler that reads a pipe instead of eleven wires
- SAMPLER
- VISUAL
- SAMPLED
- VISUAL
One input, two outputs, and it does all the sampling. CMK KSampler -Pipe- takes a CMK_SAMPLER_PIPE and returns a CMK_SAMPLED_PIPE plus a VISUAL. Everything the sampler needs - model, conditioning, latent, seed, steps, cfg, sampler name, scheduler, denoise, model family - is already inside that pipe, put there by the prepare node upstream.
This is the context-bus pattern, and it's the single most important thing to understand about CMK if you're coming from stock ComfyUI. Instead of dragging model, clip, vae, positive, negative, latent, width, height, steps and seed as nine wires into every node that needs them, the pack bundles them into one object and lets each node pull what it needs and push back what it changed.
What the node actually reads
From the pipe: model_patched (falling back to model), conditioning_pos, conditioning_neg, latent_1st_pass (falling back to latent_image), seed, steps_1st_pass, cfg, sampler, scheduler, denoise, and model_family.
It's not naive about it either. Conditioning arrives wrapped as tuple(conditioning,) from classic nodes, so it unwraps one level - but refuses to flatten CONDITIONING itself, which is a list. If a pipe field turns out to be callable or the wrong type, you get a named error rather than a stack trace deep inside the sampler. Missing pieces report as CMK KSampler -Pipe-: pipe['latent_image'] is missing.
Because the pipe carries a single seed and conditioning pair, the number of things you can get wrong in this node is close to zero - and the number of things you can get wrong upstream is exactly where you should look when output is nonsense. A stale pipe holding pre-LoRA model weights is the classic context-bus bug: the wire is connected, the contents are wrong. The remedy is the same as ever - don't wire the pipe past the node that changed the thing.
Two deliberate no-ops
The node has two short-circuits, and both show up in logs rather than errors:
- If the pipe carries an InstantID reference latent (
instantid_reference_latent_mode), it returns the latent untouched and logs "CMK KSampler -Pipe- | BYPASSED | InstantID reference latent is encoded and sampled in module 15." The InstantID module owns that pass. - If InstantID is enabled with an end step of 0, same story - nothing to sample.
Watch that on the canvas. A "KSampler" that didn't run looks like a bug until you read the pipe.
There's also interrupt hygiene: if sampling is cut short, the node cleans up the sampler state on the way out instead of leaving a half-built context for the next run.
Three ways it can sample
Normally it just calls ComfyUI's own core KSampler with the values pulled off the pipe - so nothing about the maths is proprietary, and quality differences between this and a stock sampler are settings, not implementation.
The other two paths are where the architecture shows. If the pipe says InstantID is enabled, the node samples only as far as instantid_end_at_step and deliberately leaves the rest of the noise in place - module 15 finishes the job with identity attention applied. If the pipe is in HYBRID mode, the node runs the SDXL portion of the pass (a handoff percentage around 90%, clamped between 80 and 95), captures the clean x0 prediction, and hands that latent onward for Z-Image Turbo to finish. If the handoff produces no clean prediction you get a named runtime error rather than a garbage image.
So when a CMK graph takes longer than the step count suggests, or looks half-finished in the preview mid-run, that's usually not a bug - it's a partial pass designed to be continued.
Wiring and install
SAMPLER in, VISUAL optional in, SAMPLED and VISUAL out. PROCESS and LOG deliberately don't route through the compute node - the docstring is explicit that it consumes only the isolated sampler working pipe and returns a distinct completed payload for the refiner.
Install is the usual pack install, nothing special here:
cd ComfyUI
git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py
Or ComfyUI Manager → search CMK Flow (registry cmk-flow, publisher CMKFlow) → restart. The script exists because a git clone never runs pip; it's required again after every git pull --ff-only update. Turn on Vue Nodes / Nodes 2.0, and set Comfy → Execution → Live preview method to auto if you want previews during sampler and refiner runs.
The one thing not to do: wire raw MODEL/CLIP/LATENT into this node. There's no input for them. The pipe comes from CMK's sampler prepare, and if you want to build a sampler from scratch, stock ComfyUI is the better tool.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| SAMPLER | CMK_SAMPLER_PIPE | — | |
| VISUALopt | CMK_VISUAL_PIPE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| SAMPLED | CMK_SAMPLED_PIPE | — |
| VISUAL | CMK_VISUAL_PIPE | — |