多文本CLIP批量编码(BNK)
Batch-encode a list of prompts with BNK-style weighting
- clip
- textList
- CONDITIONING
MultiTextEncodeAdvanced (多文本CLIP批量编码(BNK), "multi-text CLIP batch encode") does exactly what its display name advertises: it takes a list of prompts, CLIP-encodes them all in one node, and returns a single batched CONDITIONING. The "(BNK)" is the giveaway - it's this pack's take on BlenderNeko's famous advanced CLIP text encode, vendored into the lam pack (src/adv_encode.py), with the list-processing machinery wrapped around it.
The use case: you have a list of prompts (say from MultiTextConcatenate's LIST output, or a batch text loader) and you want each frame of a batch to sample with its own prompt. Normally that means one CLIP Text Encode per prompt, a pile of wires, and a headache when you add prompt number six. This node turns it into one wire: prompt list in, one conditioning batch out.
How it works
For every string in textList, it runs the advanced encoder with your settings and appends the result. pre_text and app_text are optional prefix/suffix applied to every entry - so if all prompts share "best quality," type it once in pre_text instead of repeating it in every list item. The individual conditions and pooled outputs are concatenated into one CONDITIONING (and one pooled tensor), which the sampler consumes as a batch: latent frame 0 gets prompt 0, frame 1 gets prompt 1, and so on.
The settings that matter
token_normalization-none,mean,length, orlength+mean. Controls how per-token weights are normalized.meanis the safest general default;length+meancompensates for prompt length and is worth trying on SDXL.weight_interpretation-comfy,A1111,compel,comfy++,down_weight. This changes how(word:1.2)-style weights are parsed.comfyis stock behavior;A1111mimics Automatic1111's parser if you're porting prompts over;compelandcomfy++are the power-user weight schemes.clip- your CLIP model.pre_text/app_text- optional wrapper text.- Output:
CONDITIONING.
If textList is empty the node raises - it wants at least one prompt.
Install
In yanlang0123/ComfyUI_Lam - Manager search "ComfyUI_Lam", or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
restart. No extra models; the advanced-encode code is bundled in the pack. The README's install.bat requirements aren't needed for this node, though you'll be installing the pack anyway if you came for the batch/list machinery.
Gotchas
The batch-coupling is the thing to wrap your head around: the conditioning batch and the image batch must line up. If your latent batch has 4 frames and your prompt list has 3 entries, ComfyUI will error out when the sampler tries to match them. Keep the list length equal to the batch size. Also - this encodes every prompt on every run, so a 50-prompt list is 50 forward passes through CLIP before sampling even starts; that's inherent to the approach, not a bug. And if you were expecting per-item conditioning you could select between (regional conditioning), note this returns one merged batch, not a selector.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| textList | LIST | — | |
| token_normalization | COMBO | 4 options: none, mean, length, length+mean | |
| weight_interpretation | COMBO | 5 options: comfy, A1111, compel, comfy++, down_weight | |
| pre_textopt | STRING | — | |
| app_textopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |