Nodes/comfyui-ksampler-tester-loop/Sampler Loop (Sampler Custom Advanced)
ComfyUI Node

Sampler Loop (Sampler Custom Advanced)

One sampler at a time, as an actual sampler object

By KY-2000·Created about a year ago·Updated about a year ago· 8
Sampler Loop (Sampler Custom Advanced)
    • sampler
    • current_index
    • total_combinations
    • current_combination
    mode
    seed0
    resetfalse
    skip_samplers

    If you've already met the plain Sampler Loop from this pack, Sampler Loop (Sampler Custom Advanced) is that node with one difference, and the difference is the whole point: the sampler output is a real SAMPLER object, not a string name.

    Why care? Stock KSampler is happy with "dpmpp_2m" as text. Custom sampler nodes - SamplerCustom, Kijai's SamplerCustomAdvanced, and the rest of the advanced-sampling crowd - want an actual callable object on their sampler input. Feed them a string and you'll get a type mismatch that reads like "argument 'sampler' expected type SAMPLER but got STRING" and zero output. This node exists so you can loop through samplers and feed a custom node at the same time.

    How it works

    Same counter machinery as the rest of the pack: it picks one sampler per workflow execution (advancing only on new runs, so a single queue run returns a stable value), then resolves the chosen name to an object via ComfyUI's comfy.samplers.sampler_object(). If that resolution fails it tries the internal samplers dict, and only as a last resort falls back to the raw string with a warning - which is your cue that the loop node's output won't wire cleanly into your custom sampler anymore.

    Three modes, all driven by the internal per-mode counter:

    • sequential - walks the list in order, wraps at the end.
    • random - seeded choice using seed + step, so it's reproducible yet different every run.
    • ping_pong - forward then backward, for neighbor-to-neighbor transitions.

    reset (a BOOLEAN, default false) zeroes the counter when you want a fresh cycle.

    The few inputs you'll actually set

    • mode - sequential, random, ping_pong.
    • skip_samplers - comma-separated names to exclude, e.g. lcm, deis. Exact, case-sensitive matches only; the console logs a warning for anything unrecognized, and if you skip everything it silently uses the full list.
    • seed - matters only in random mode.

    Outputs: sampler (SAMPLER type → your custom node's sampler input), current_index, total_combinations, and current_combination, the last being a "Sampler: euler" string that's nice for filenames or a text/PreviewAny label.

    Install and the one gotcha

    No dependencies, no model files - just ComfyUI's own sampler list under the hood. Install via ComfyUI Manager (search comfyui-ksampler-tester-loop) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/KY-2000/comfyui-ksampler-tester-loop
    

    then restart. (You only ever install this once even if you use several nodes from the pack - they all ship together.)

    The gotcha, again, is the name: "Loop" here means one selection per queue run. Queue the workflow repeatedly and each run hands you the next sampler object. It will not iterate internally and render a grid in a single execution - that's the pack's one consistent footgun, and the README is admirably clear about it ("each execution will use the next combination").

    If you're testing for a stock KSampler, grab the non-Advanced Sampler Loop instead - no point paying the object-resolution overhead for a string input. Reach for this variant only when your sampler node actually needs the SAMPLER type.

    CategorySamplers/Loop/Advanced

    Inputs (4)

    NameTypeDefaultDescription
    modeCOMBO3 options: sequential, random, ping_pong
    seedINT00–18446744073709550000
    resetBOOLEANfalse
    skip_samplersoptSTRING

    Outputs (4)

    NameTypeDescription
    samplerSAMPLER
    current_indexINT
    total_combinationsINT
    current_combinationSTRING