Nodes/Zerna Pack/Dynamic Prompt Injector (Zerna Pack)
ComfyUI Node

Dynamic Prompt Injector (Zerna Pack)

Turn one prompt template into a whole batch, with nothing but a text file

By RaymondProduction·Created about a year ago·Updated about a year ago· 0
Dynamic Prompt Injector (Zerna Pack)
    • zipped_prompt
    • count
    • remaining_count
    prompt_text
    prompt_file
    reloadfalse
    load_cap0
    start_index0

    The Dynamic Prompt Injector is the reason the Zerna Pack exists. It does one thing: you give it a template like "A photo of [X] in the forest.", it reads a plain .txt file, and every line in that file becomes its own prompt. Three lines in the file, three prompts out. That's the whole idea, and for batch sweeps it beats hand-editing a prompt 40 times.

    This is the wildcard/dynamic-prompt idea without a wildcard-syntax pack and without an LLM writing anything for you. The community's been doing prompt variety this way since A1111's {this|that|other} bracket trick, and the KB's own prompt-engineering notes that it's how people build character-reference libraries - batch 30 and get the same person across settings with no training involved. The Injector is a dirt-simple version of that: the text file is your list, [X] is your slot.

    How it works. The node picks a .txt from the dropdown, splits it into lines, and replaces every [X] in prompt_text with each stripped line. If your template has no [X] at all, it just emits your template as a single entry. Each expanded prompt becomes a tuple of (prompt, negative, name), bundled into the zipped_prompt output - that's the pack's own ZIPPED_PROMPT type. Fair warning: the negative and name are hardcoded to "man" and "unknown name" in the source. Don't treat the negative half of a zipped prompt as a real negative prompt; it's a placeholder.

    The inputs that matter. Two required, three optional, and here's the honest version of all of them:

    • prompt_text - your template with [X]. The field is flagged dynamicPrompts, so ComfyUI's own {a|b|c} syntax also works right in there.
    • prompt_file - the dropdown of .txt files, built from the pack's prompts/ folder.
    • reload, load_cap, start_index - the optional knobs. load_cap (0 = all) and start_index (−1 = last) sound like they'd slice your file. They don't, in v0.0.1: doit() accepts them and then never reads them. Same for reload - it's declared with cute "if file changed / if value changed" labels but isn't wired to anything yet. This pack is at version 0.0.1 with a single commit, and it shows. Treat those three as planned features, not settings.

    Outputs. zipped_prompt (a list, this is the one you use), plus count and remaining_count - both hardcoded to 1 in the current source, so ignore them until a release fixes them.

    Where it goes. zipped_prompt feeds the pack's own Unzip Prompt node, which splits each entry back into plain strings you can run through a normal CLIP Text Encode. That's the pipeline: Injector → Unzip Prompt → text encoder → KSampler, and ComfyUI fans the list out so each prompt gets its own generation.

    Installing. ComfyUI Manager, search "Zerna Pack". Or, the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/RaymondProduction/comfyui-zerna-pack
    # restart ComfyUI
    

    No dependencies - requirements.txt literally says "# No external dependencies". It's stdlib plus ComfyUI core, so no pip install, no model downloads, no surprises. Drop your own prompt lists into ComfyUI/custom_nodes/comfyui-zerna-pack/prompts/ as .txt files.

    Where people get burned. The dropdown is built when the pack loads, so a file you just added won't show up until you restart ComfyUI. And if a file vanishes, the code logs a warning and then tries to open None - you'll get a hard error, not a graceful skip. Also, the category name is "PromptGnerators" (their typo, not yours), so if you're hunting for these nodes in the menu, that's the misspelled heading to look under.

    CategoryZernaPack/PromptGnerators

    Inputs (5)

    NameTypeDefaultDescription
    prompt_textSTRINGThe text to be xxxx.
    prompt_fileCOMBO3 options: flux_styles_prompts.txt, sdxl_art_styles.txt, animals.txt
    reloadoptBOOLEANfalse
    load_capoptINT0The amount of prompts to load at once: 0: Load all 1 or higher: Load a specified number
    start_indexoptINT0-1–18446744073709550000Starting index for loading prompts: -1: The last prompt 0 or higher: Load from the specified index

    Outputs (3)

    NameTypeDescription
    zipped_promptZIPPED_PROMPT
    countINT
    remaining_countINT