Nodes/ComfyUI_RaykoStudio/๐ŸฆŠ RS Loop Switch
ComfyUI Node

๐ŸฆŠ RS Loop Switch

Cycle a seed (or any INT) across a batch โ€” the poor man's batch scheduler

By RaykosanยทCreated about a year agoยทUpdated 5 days agoยท 79
๐ŸฆŠ RS Loop Switch
    • INT
    โ—„start_at_step1โ–บ
    โ—„end_at_step10โ–บ
    โ—„jump1โ–บ
    โ—„control_before_generateโ–พโ–บ
    โ—„value_10โ–บ
    โ—„value_20โ–บ
    โ—„value_30โ–บ
    โ—„value_40โ–บ
    โ—„value_50โ–บ
    โ—„value_60โ–บ
    โ—„value_70โ–บ
    โ—„value_80โ–บ
    โ—„value_90โ–บ
    โ—„value_100โ–บ

    Running a batch of generations with a different seed each time usually means the fixed-seed workflow, or a janky counter node, or manually editing between runs. ๐ŸฆŠ RS Loop Switch (RaykoLoopSwitchSeed) is a dedicated answer: it cycles through up to ten INT values, one per queue step, and emits the right one for each generation. Its obvious use is seeds, but since it outputs a plain INT it'll drive any integer input - steps, CFG, batch counts, whatever.

    How it works

    You give it ten value_N slots (seeds, typically) and a step window. On each execution it computes a "step number" from your start_at_step, end_at_step, and jump, then picks the value with (step - 1) % 10 - so with ten values and no jump, iteration one gets value_1, iteration two gets value_2, and so on, wrapping at ten. The output is a list of INTs (that's the OUTPUT_IS_LIST flag), which is how it hands a different value to each queued prompt.

    The control_before_generate dropdown adds the automation layer: fixed just uses your values as typed, while increment, decrement, or randomize modify the whole set before each run - increment adds 1 to every seed per run, randomize rolls new random seeds entirely. Because of that, IS_CHANGED returns NaN for the non-fixed modes, which forces ComfyUI to re-execute it every run instead of caching.

    Inputs that matter

    • value_1 โ€ฆ value_10 - your seed pool. Range goes up to ~9.8 quadrillion, so any real seed fits.
    • start_at_step, end_at_step - the window of queue steps this runs across.
    • jump - step interval (default 1). A jump of 2 means it cycles every other generation.
    • control_before_generate - fixed, increment, decrement, or randomize.

    Output: INT (a list) - wire it into KSampler's seed (or steps, or any INT input).

    How to install

    Part of ComfyUI_RaykoStudio:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git
    

    Restart ComfyUI, or install via ComfyUI Manager (search "ComfyUI_RaykoStudio"). No extra dependencies.

    Common issues

    • Same seed every run. If your downstream KSampler has "control_after_generate" set to fixed, or the seed input is wired to something else, this node's cycling won't matter. Make sure the KSampler's seed actually comes from this node's output.
    • Feels out of sync. The step counting starts at start_at_step, not at your batch count. If you queue mid-way through a run, the count carries on from where it was - set start_at_step to 1 for a clean start.
    • Randomize surprises. randomize replaces all ten values with new random seeds each run, so your "favorite seed" isn't in the pool anymore. Use increment if you want the pool to stay yours.

    The honest take: it's a focused little node that does one thing well - auto-cycling seeds across a batch - and it sits in the long tradition of ComfyUI batch-scheduler utilities. If you only ever generate single images, skip it. If you batch, it saves you the counter-node gymnastics.

    Category๐ŸฆŠ RaykoStudio

    Inputs (14)

    NameTypeDefaultDescription
    start_at_stepINT1-10000โ€“10000โ€”
    end_at_stepINT10-10000โ€“10000โ€”
    jumpINT11โ€“1000โ€”
    control_before_generateCOMBO4 options: fixed, increment, decrement, randomize
    value_1INT00โ€“9888888888888888โ€”
    value_2INT00โ€“9888888888888888โ€”
    value_3INT00โ€“9888888888888888โ€”
    value_4INT00โ€“9888888888888888โ€”
    value_5INT00โ€“9888888888888888โ€”
    value_6INT00โ€“9888888888888888โ€”
    value_7INT00โ€“9888888888888888โ€”
    value_8INT00โ€“9888888888888888โ€”
    value_9INT00โ€“9888888888888888โ€”
    value_10INT00โ€“9888888888888888โ€”

    Outputs (1)

    NameTypeDescription
    INTINTโ€”