Nunchaku FLUX.2 Klein Sectioned Encoder
Give your prompt sections names, and Klein will obey them
- clip
- conditioning
- front_section
- mid_section
- end_section
- full_prompt
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'sfront_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_promptis 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| front_textopt | STRING | FRONT section text. | |
| mid_textopt | STRING | MID section text. | |
| end_textopt | STRING | END section text. | |
| combined_promptopt | STRING | Optional. Single prompt with [FRONT]/[MID]/[END] markers — overrides the three text boxes when non-empty and contains markers. | |
| separatoropt | COMBO | comma | How to join sections in the final prompt sent to Klein. |
| show_previewopt | BOOLEAN | true | — |
| debugopt | BOOLEAN | false | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| conditioning | CONDITIONING | — |
| front_section | STRING | — |
| mid_section | STRING | — |
| end_section | STRING | — |
| full_prompt | STRING | — |