Nodes/ComfyUI-Flux2Klein-Conditioning-Toolkit/FLUX.2 Klein Sectioned Text Encoder
ComfyUI Node

FLUX.2 Klein Sectioned Text Encoder

Prompt sections for FLUX.2 Klein that the region nodes can actually see

By xmarre·Created 6 months ago·Updated 5 months ago· 10
FLUX.2 Klein Sectioned Text Encoder
  • clip
  • conditioning
  • front_section
  • mid_section
  • end_section
  • full_prompt
modemanual
front_text
mid_text
end_text
combined_prompt
separatorcomma
show_previewtrue
debugfalse

FLUX.2 Klein is an LLM-reads-your-prompt model, not a CLIP-tags model. That's the fact that breaks your old habits: ((face:1.4)) does nothing on it, because ComfyUI prompt weighting is disabled for its Qwen3 text encoder. So how do you push one part of a prompt harder? This pack's answer is to stop editing the prompt string and start editing the conditioning tensor - and this node is the front door to that whole workflow.

Think of the FLUX.2 Klein Sectioned Text Encoder as a drop-in replacement for the plain CLIP Text Encode node in a Klein graph, with one crucial extra job. It splits your prompt into three sections (front / mid / end), encodes them, and - here's the part that matters - it carries the tokenizer's attention_mask along inside the conditioning metadata. The other nodes in this pack (Conditioning Enhancer, Token Region Controller) use that mask to find the "active" token range, the tokens that are actually your prompt rather than padding. Without it they fall back to a heuristic guess. Feed them conditioning from this node and they all agree on where your prompt starts and ends.

How it works

Pick a mode on the mode input:

  • manual - use the three text fields (front_text, mid_text, end_text), or if you'd rather write one box, drop [FRONT]..., [MID]..., [END] markers into combined_prompt and it parses those.
  • auto_balanced - give it one full prompt and it splits into rough 25/50/25 sections by sentence (or comma) boundaries, so you don't have to think about it.

The sections get joined back together with your separator (comma, period, space, or newline - comma is the default), then encoded through clip.tokenize() + encode_from_tokens() with pooled output, same as any CLIP encode. The attention mask from that tokenization goes into the conditioning metadata so the downstream region nodes know the real active token count. If the tokenizer doesn't expose a mask, it degrades gracefully - you just lose the precision.

One genuinely useful touch: with show_preview on (the default), the console prints each section, the estimated token counts, and the actual active-token length, so you can see whether your "front" really maps to the tokens you think it does.

Inputs and outputs that matter

You really only set these:

  • clip - your Klein model's CLIP/text encoder, straight from the checkpoint loader.
  • mode - manual or auto_balanced.
  • front_text / mid_text / end_text - the sections, in manual mode.
  • separator - how they get glued back together.

Outputs: conditioning (wire it into the sampler or into a Token Region Controller / Conditioning Enhancer first), plus front_section, mid_section, end_section, and full_prompt as plain STRINGs - handy for seeing exactly what got assembled without squinting at a debug print.

Install

It ships in the ComfyUI-Flux2Klein-Conditioning-Toolkit pack, so install once and you get all six nodes. Easiest: ComfyUI Manager → search "Flux2Klein" → install, then restart. Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-Flux2Klein-Conditioning-Toolkit

Then restart ComfyUI. Good news: there are no model downloads and no requirements beyond torch, which you already have. It's pure conditioning math on small tensors - it won't touch your VRAM budget.

Where people get burned

The classic mistake is using this node and then wiring its conditioning into the enhancer, but putting another text encoder upstream of the enhancer later in the graph - the region nodes only see the mask if the conditioning actually passed through this node. If your tweaks suddenly do nothing, check which encoder is feeding the enhancer. Also remember these are positional sections, not semantic ones: "front" means the first tokens, which is why pairing this with the Token Region Controller works - the encoder makes the positions intentional instead of accidental.

Categoryconditioning/flux2klein

Inputs (9)

NameTypeDefaultDescription
clipCLIP
modeCOMBOmanual2 options: manual, auto_balanced
front_textoptSTRING
mid_textoptSTRING
end_textoptSTRING
combined_promptoptSTRING
separatoroptCOMBOcomma4 options: comma, period, space, newline
show_previewoptBOOLEANtrue
debugoptBOOLEANfalse

Outputs (5)

NameTypeDescription
conditioningCONDITIONING
front_sectionSTRING
mid_sectionSTRING
end_sectionSTRING
full_promptSTRING