Nodes/Zerna Pack/CLIP Dynamic Prompt Encoder (Zerna Pack)
ComfyUI Node

CLIP Dynamic Prompt Encoder (Zerna Pack)

Batch-encode every line of a text file straight to conditioning, no string round-trip

By RaymondProduction·Created about a year ago·Updated about a year ago· 0
CLIP Dynamic Prompt Encoder (Zerna Pack)
  • clip
  • positive
  • negative
text
prompt_file

The CLIP Dynamic Prompt Encoder is the Injector's smarter sibling. Same party trick - take a template with [X], expand it over every line of a .txt file - but instead of handing you strings that you then have to re-encode, it encodes each expanded prompt into conditioning right there. Fewer nodes, fewer wires, same batch.

Why you'd reach for it. If you're doing the full Injector → Unzip Prompt → CLIP Text Encode chain, this node collapses three steps into one. It's the shortest path between "a list of style prompts in a text file" and "a batch of conditionings at the KSampler." Where it shines: style or subject sweeps where each line of the file is a complete prompt - swap the file, and the whole batch changes without touching the graph.

How it works. The mechanism is identical to the Injector's: pick a file from the dropdown, split it into lines, replace every [X] in your text with each line. Then it does what the Injector doesn't - it tokenizes and encodes each expanded prompt with the CLIP model you fed in, using ComfyUI's encode_from_tokens_scheduled. Every line becomes its own conditioning, and they come out as a list that ComfyUI fans out across the batch, one generation per entry.

The inputs. Three required:

  • text - your template with [X], multiline, with ComfyUI's dynamicPrompts flag on so {a|b|c} syntax works in it too.
  • clip - the CLIP model. Wire it from a checkpoint loader or a dedicated CLIP loader. If it's None, the node raises a specific error telling you the checkpoint doesn't contain a usable text encoder - that check is literally in the source.
  • prompt_file - the .txt dropdown, built from the pack's prompts/ folder.

The outputs. Two conditioning outputs:

  • positive - the batch of encoded, expanded prompts. This one wires into the positive conditioning input on your KSampler.
  • negative - here's the catch. It's not a negative prompt in any useful sense; it's the literal word "man" encoded. The author hardcoded it. So the negative output is a placeholder you should mostly ignore - feed the KSampler's negative slot from your own text encoder and your own actual negative prompt instead.

Gotcha worth knowing before you fill that file with long lines: CLIP's ViT-L/14 encoder truncates at 77 tokens. A line that reads like a full paragraph gets cut off mid-thought, and the sampler never sees the rest. Keep lines to a sentence or two, or remember this is a CLIP-era node - the KB notes that the 2026 generation of LLM-based text encoders (Flux 2, Z-Image) don't work through this kind of classic CLIP path at all. So: SD 1.5 and SDXL-class models, yes; Flux-era models, no.

Installing. ComfyUI Manager, search "Zerna Pack", or the manual route:

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

No dependencies, no model downloads - requirements.txt is literally "# No external dependencies", and the pack leans on ComfyUI core plus the standard library. Your own prompt files go in ComfyUI/custom_nodes/comfyui-zerna-pack/prompts/.

Where people get burned. New files don't show up in the dropdown until ComfyUI restarts, because the file list is built at load time. And the "negative" output will reliably trip you up if you trust it - it's a stub that says "man", not a recommendation. This is a v0.0.1 pack (one commit, fresh off the author's bench), so think of it as a useful prototype: the positive path is solid, the negative path is decoration.

CategoryZernaPack/PromptGnerators

Inputs (3)

NameTypeDefaultDescription
textSTRINGThe text to be encoded.
clipCLIPThe CLIP model used for encoding the text.
prompt_fileCOMBO3 options: flux_styles_prompts.txt, sdxl_art_styles.txt, animals.txt

Outputs (2)

NameTypeDescription
positiveCONDITIONINGA conditioning containing the embedded text used to guide the diffusion model.
negativeCONDITIONING