Nodes/ComfyUI Prompt Iterator Extension/Prompt Iterator (Advanced)
ComfyUI Node

Prompt Iterator (Advanced)

The Prompt Iterator with the seed output your batch job actually needs

By BizaNator·Created 11 months ago·Updated 11 months ago· 5
Prompt Iterator (Advanced)
    • prompt
    • filename
    • current_index
    • total_count
    • status
    • seed
    • debug_info
    promptsface only headshot, facing camera directly Left profile View - rotate face 90 degrees left Right profile View - rotate face 90 degrees right Back View - direct back of the head
    modesequential
    filename_modesuffix_list
    base_filenamecharacter
    filenames
    suffixes_front _left _right _back
    filename_template{base}_{index:03d}_{suffix}
    prepend_text
    append_text
    manual_index0
    loop_modeloop
    resetfalse
    generation_seed-1
    seed_modeincrement_batch
    workflow_iddefault

    The basic Prompt Iterator cycles a list of prompts, and that's genuinely all it does. This one is what you get when "cycle a list" isn't enough: templated filenames, prepend/append text, ping-pong looping, shuffled order - and the headline feature, an INT seed output with four modes so every prompt in your batch gets a consistent, trackable seed instead of fresh dice each run. If you've ever generated a batch of "the same character, four angles" and then wondered whether the differences came from the prompt or the noise, this is the fix.

    What it adds over the basic node

    Same state machine under the hood (state lives in a module-level dict keyed by workflow_id, and sequential/random modes return NaN from IS_CHANGED() so the node re-runs and advances on every queue press). The additions are what make it "Advanced":

    • mode gains random for shuffled order.
    • filename_mode: list (exact filenames), suffix_list, template, or index.
    • loop_mode: once, loop, or ping_pong.
    • prepend_text / append_text wrapped around each prompt.
    • generation_seed + seed_mode feeding a seed output.

    Seed modes - the part people actually care about

    • fixed - the same seed for every prompt. This is the "compare prompts against identical noise" mode, which is exactly right for face-angle tests.
    • increment_batch - the seed bumps by one each time the iterator wraps back to the first prompt. One list, three complete variation sets: that's the use case.
    • increment_prompt - seed +1 per prompt, so every render gets its own sequential seed.
    • random - a fresh seed every execution, maximum chaos.

    generation_seed defaults to -1, which means "pick a random seed now and hold it" - so fixed still works even if you never type a number. Wire seed → KSampler's seed input and you're done.

    Filename modes

    The default filename_mode is suffix_list, and the default suffixes (_front, _left, _right, _back) pair one-to-one with your prompts - that's the whole "character_front.png → character_back.png" workflow from the README. Or use template mode with {base}, {index:03d}, and {suffix} placeholders; the default "{base}_{index:03d}_{suffix}" turns base character and suffix _front into character_000_front. index mode is the basic node's base_{index:03d}, and list mode is the exact-filenames box.

    The inputs that matter

    • prompts - one per line, as before.
    • mode, filename_mode, loop_mode - the behavior toggles above.
    • suffixes, filename_template - the naming system.
    • prepend_text / append_text - handy for slapping a style tag or quality block on every line at once.
    • generation_seed, seed_mode - the seed bookkeeping.

    Outputs, and the debug_info caveat

    prompt → CLIPTextEncode, filename → SaveImage, seed → KSampler, plus current_index, total_count, and status. And debug_info, which deserves a warning: it's declared in the node's output list, but the shipped v2.1.0 code never actually returns it - the function returns six values against seven declared outputs. Leave it unwired and nothing happens; wire something to it and ComfyUI will complain that the source output doesn't exist. Don't build anything on it; that's what status is for. (Credit where due: this is exactly the kind of thing to verify in the source rather than the README.)

    Install

    ComfyUI Manager, search "ComfyUI Prompt Iterator Extension" - or git clone https://github.com/BizaNator/ComfyUI_PromptIterator into ComfyUI/custom_nodes/, then restart. No dependencies, no model files; it lands under utils/prompt with its two siblings.

    Gotchas

    • ping_pong bounces 0 → last → 0, and the iteration counter only ticks when it comes back to prompt 0.
    • once mode stops advancing at the last prompt - it does not wrap.
    • Empty prompts box hits the same output-count bug as the empty path elsewhere in this pack: keep at least one non-blank line.
    • State is in-memory, so a ComfyUI restart puts the cursor back at prompt 1.

    Between the three iterator nodes, this is the one I'd actually reach for. Basic is fine for a throwaway list, Dynamic is great when prompts come from other nodes - but if you care about reproducible seeds and filenames you can sort, Advanced is the whole package.

    Categoryutils/prompt

    Inputs (15)

    NameTypeDefaultDescription
    promptsSTRINGface only headshot, facing camera directly Left profile View - rotate face 90 degrees left Right profile View - rotate face 90 degrees right Back View - direct back of the head
    modeCOMBOsequential4 options: sequential, manual, random, single
    filename_modeCOMBOsuffix_list4 options: list, suffix_list, template, index
    base_filenameSTRINGcharacter
    filenamesoptSTRING
    suffixesoptSTRING_front _left _right _back
    filename_templateoptSTRING{base}_{index:03d}_{suffix}
    prepend_textoptSTRING
    append_textoptSTRING
    manual_indexoptINT00–9999
    loop_modeoptCOMBOloop3 options: once, loop, ping_pong
    resetoptBOOLEANfalse
    generation_seedoptINT-1-1–2147483647
    seed_modeoptCOMBOincrement_batch4 options: fixed, increment_batch, increment_prompt, random
    workflow_idoptSTRINGdefault

    Outputs (7)

    NameTypeDescription
    promptSTRING
    filenameSTRING
    current_indexINT
    total_countINT
    statusSTRING
    seedINT
    debug_infoSTRING