Nodes/ComfyUI-Nunchaku-Klein/Nunchaku FLUX.2 Klein Sectioned Encoder
ComfyUI Node

Nunchaku FLUX.2 Klein Sectioned Encoder

Give your prompt sections names, and Klein will obey them

By tom-m-2020·Created 2 months ago·Updated 17 days ago· 2
Nunchaku FLUX.2 Klein Sectioned Encoder
  • clip
  • conditioning
  • front_section
  • mid_section
  • end_section
  • full_prompt
front_text
mid_text
end_text
combined_prompt
separatorcomma
show_previewtrue
debugfalse

Klein reads your prompt as a chat message, and chat messages have structure: subject, setting, mood. The NunchakuKleinSectionedEncoder lets you split a prompt into three labeled chunks - FRONT, MID, END - so that downstream nodes know where in the prompt a concept lives instead of guessing. On its own it's a text encoder with extra steps. Wired in front of the pack's Detail Controller, it turns a vague "emphasize the first 25%" into a precise "emphasize exactly these words."

Why it exists

The Detail Controller in this pack has front/mid/end multipliers, but without real section boundaries it has to fall back to an arbitrary split (first 25% of active tokens = "front"). That's a guess. This node makes the boundaries real: it encodes your prompt in three explicitly delimited sections and records those token ranges in the conditioning, so the controller's multipliers land exactly where you aimed them. You're effectively doing regional prompt control at the text-embedding level.

The inputs that matter

  • clip - required, from your Klein text encoder/CLIP loader. This is an encoding node, so it sits where a normal CLIPTextEncode would.
  • front_text / mid_text / end_text - the three sections. The tooltip names them FRONT/MID/END; that order maps to the controller's front_mult/mid_mult/end_mult.
  • combined_prompt - optional shortcut. Drop in a single prompt with [FRONT], [MID], [END] markers and it overrides the three boxes. Handy for keeping the prompt in one place.
  • separator - how sections get joined in the final prompt: comma, period, space, or newline. For an LLM encoder, period tends to read best - it's sentence-aware.
  • show_preview - see what Klein actually receives before you run the graph.

Outputs

conditioning goes to the KSampler. The string outputs (front_section, mid_section, end_section, full_prompt) are for debugging and for feeding other text-handling nodes - e.g., showing yourself exactly how the sections got joined.

Wiring and install

Typical chain: text encoder → Sectioned Encoder → Detail Controller → KSampler. Same pack install as everything here:

cd ComfyUI/custom_nodes
git clone https://github.com/tom-m-2020/ComfyUI-Nunchaku-Klein

Backend: Vitoom Nunchaku wheel from huggingface.co/tonera/vitoom-nunchaku, tonera's Klein checkpoint in diffusion_models/.

Common issues

  • Sections ignored - confirm combined_prompt is empty; if it's non-empty and contains markers it silently overrides your three boxes.
  • Detail Controller still seems arbitrary - make sure the same conditioning stream flows from this node into the controller; if you encode twice, the controller has no section metadata to find.
  • Contradictory wording between sections - Qwen3 will reconcile them in one pass and the result can be mush. Keep sections coherent; the separator is cosmetic, the semantics are yours.
CategoryNunchaku/FLUX.2 Klein/Enhancer/Text

Inputs (8)

NameTypeDefaultDescription
clipCLIP
front_textoptSTRINGFRONT section text.
mid_textoptSTRINGMID section text.
end_textoptSTRINGEND section text.
combined_promptoptSTRINGOptional. Single prompt with [FRONT]/[MID]/[END] markers — overrides the three text boxes when non-empty and contains markers.
separatoroptCOMBOcommaHow to join sections in the final prompt sent to Klein.
show_previewoptBOOLEANtrue
debugoptBOOLEANfalse

Outputs (5)

NameTypeDescription
conditioningCONDITIONING
front_sectionSTRING
mid_sectionSTRING
end_sectionSTRING
full_promptSTRING