Nodes/ComfyUI_Emojiiii_Custom_Nodes/KolorsMultiTextEncode(Kolors批量文本编码)
ComfyUI Node

KolorsMultiTextEncode(Kolors批量文本编码)

N prompts in, a stacked conditioning out — Kolors batch text encoding

By emojiiii·Created 2 years ago·Updated 2 years ago· 0
KolorsMultiTextEncode(Kolors批量文本编码)
  • chatglm3_model
  • hid_proj
  • CONDITIONING
text

The display name spells out the whole pitch: Kolors批量文本编码 - "Kolors batch text encoding." Standard Kolors workflows encode exactly one prompt into one conditioning. This node lets you drop N prompts, one per line, into a single text box and get back one conditioning tensor with all of them stacked - so a batch of latents can each generate from its own prompt in a single pass instead of running N times. If you've ever wished the text encoder would just take a list, this is that node.

It only makes sense if you're already running Kolors, so a quick refresher: Kolors is Kuaishou's mid-2024 model - a UNet backbone that swapped CLIP/T5 for ChatGLM3 as its text encoder, an unusual choice that gave it genuinely strong Chinese-language prompt handling and solid realistic output. It reviewed well, then got swallowed by the Flux wave and mostly faded. But it still has fans, and if you're one of them this pack - a fork of MinusZoneAI/ComfyUI-Kolors-MZ, the standard ComfyUI implementation - is the batch-friendly twist on it.

How it works

The mechanism is simple and it's all in the source. Your text box is split on newlines, empty lines are skipped, and each remaining line is encoded on its own through the ChatGLM3 text encoder (padded or truncated to 256 tokens). Each prompt's embeddings get pushed through hid_proj, the linear projection head that maps them into the UNet's conditioning space. Then everything is concatenated: the sequence dimension becomes 77 × N and the pooled output becomes N × 4096, wrapped up as one CONDITIONING. It even handles {a|b} dynamic-prompt style option syntax per line, picking randomly from the braces.

Inputs and output

  • chatglm3_model - a CHATGLM3MODEL, straight from the ChatGLM3 loader you already use for Kolors (the MZ pack this is forked from is the usual source).
  • text - the multiline field. One full prompt per line; no separators needed. This is the whole point of the node.
  • hid_proj - a TorchLinear: the projection head that ships with your text-encoder loader. The code even flips autocast dtype to match its weights, so mismatched precision between the encoder and the head is handled for you.

The single CONDITIONING output wires into the KSampler just like any other, but now it carries N stacked prompts. To actually use the batch, pair it with a node that gives you N latents - RepeatLatentBatch or a batch image loader - so the latent count matches the prompt count and each image gets its own line.

Install and gotchas

Same drill as the rest of the pack: ComfyUI Manager → search ComfyUI_Emojiiii_Custom_Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/emojiiii/ComfyUI_Emojiiii_Custom_Nodes

then restart. Dependencies are transformers and huggingface_hub; the actual Kolors weights (the ChatGLM3 text encoder and the UNet checkpoint) come from your existing loader setup, not from this node - this node only encodes text, so don't go hunting for model downloads inside it.

Where it bites: prompts are silently truncated at 256 tokens, so long descriptive walls of text lose their tail without warning. Empty lines are quietly dropped, which is usually fine but means a stray blank line won't error out and tell you. And this is ChatGLM3-only - no CLIP, no SDXL, no Flux. Point it at anything but a Kolors workflow and you're wiring it into the wrong model. (The pack also ships a plain MultiTextEncode sibling that does the same batch trick for standard CLIP models, in case it's a Kolors-adjacent idea you want for a different base.)

The pack is a small, one-snapshot project with a stub README, so don't expect much hand-holding. For batch-generation workflows on Kolors, though, it's exactly the missing piece: one text box, N prompts, one conditioning, N images.

Categoryemojiiii

Inputs (3)

NameTypeDefaultDescription
chatglm3_modelCHATGLM3MODEL
textSTRING
hid_projTorchLinear

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING