Nodes/Sage Utils/Combine CLIP Multiline Text Encode
ComfyUI Node

Combine CLIP Multiline Text Encode

One text box, one line per idea, encoded separately

By arcum42·Created 2 years ago·Updated 24 days ago· 32
Combine CLIP Multiline Text Encode
  • clip
  • conditioning
modecombine
operation
text

CLIP has a hard token budget, and a common trick for getting more out of a complex prompt is to not shove everything into one giant run-on sentence - encode distinct ideas separately, then combine the resulting conditionings. That's exactly what this node automates: paste a block of text, put each idea on its own line, and it encodes every non-empty line through CLIP individually before merging them into one conditioning. No manual splitting, no chain of separate Text Encode nodes for each concept.

This matters more than it sounds like on longer, multi-part prompts - a style descriptor, a subject description, and a background note crammed into one string compete for the same token window and can bleed into each other in ways that are hard to predict. Encoding them as separate lines and combining afterward tends to keep each concept cleaner.

Inputs and outputs

  • clip - required, the CLIP model to encode with.
  • text - multiline, required. Each non-empty line is treated as a separate unit to encode; blank lines are skipped.
  • mode - a dropdown, default combine. Controls how the resulting per-line conditionings get merged.
  • operation - a second dropdown, described by its own tooltip as choosing "whether to scale the per-line conditioning output." Worth experimenting with on a real prompt rather than guessing - the effect is subtle enough that eyeballing a couple of test generations tells you more than reading about it.

Output is a single conditioning - the merged result of all your lines, ready to feed into a sampler's positive or negative input same as any other conditioning.

Installing it

ComfyUI Manager: search Sage Utils, install, restart. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/arcum42/ComfyUI_SageUtils
cd ComfyUI_SageUtils
pip install -r requirements.txt

Restart ComfyUI. Nothing extra to download - this is pure text-encoding logic layered on whatever CLIP you already have loaded.

Common issues

The most common surprise is a blank line silently vanishing rather than encoding as "empty" - that's intentional (only non-empty lines get encoded), but if you're expecting a specific number of merged conditionings and one line had trailing whitespace that got trimmed to nothing, you'll end up one short of what you expected. Check for accidental blank lines if the output feels like it's missing a concept you thought you included.

If your combined conditioning feels weaker or stronger than a single-string equivalent, that's the mode and operation settings doing their job - try the other combination before assuming something's broken. And as with the rest of this pack, it's a single-developer project, so unusual line counts or edge-case text (extremely long individual lines, non-ASCII content) are more likely to be untested territory than a documented limitation.

CategorySage Utils/clip/helpers

Inputs (4)

NameTypeDefaultDescription
clipCLIPThe CLIP model used for encoding the text.
modeCOMBOcombineHow to merge line conditionings.
operationCOMBOChoose whether to scale the per-line conditioning output.
textSTRINGMultiline text where each line is encoded separately.

Outputs (1)

NameTypeDescription
conditioningCONDITIONINGA conditioning containing all encoded lines combined.