ComfyUI-Flux2Klein-Conditioning-Toolkit
ComfyUI nodes for FLUX.2 Klein conditioning: region-aware text enhancement, sectioned prompt encoding, and corrected reference-latent mixing with multi-reference support.
Perfil do pacote
- Status
- Verificado
- Publicador
- @xmarre
- Fonte
- GitHub
- Estrelas
- 10
README
ComfyUI-Flux2Klein-Conditioning-Toolkit
A clean-room-style rebuild of the useful ideas from capitan01R/ComfyUI-Flux2Klein-Enhancer, with the brittle parts removed or replaced.
This repo is not trying to resemble the source repo. It keeps the parts that are technically defensible, rewrites the parts that are structurally weak, and drops the parts whose claimed behavior is not well-supported.
Why this exists
The source repo contributes two genuinely useful ideas:
- FLUX.2 Klein text conditioning can be manipulated in a targeted way by editing only the active token region.
- Reference latents are separate conditioning metadata, not part of the text-conditioning tensor, so they deserve their own control surface.
Those ideas are worth keeping. The implementation around them is where the cleanup was needed.
Scope
This repo provides six nodes:
- FLUX.2 Klein Conditioning Enhancer
- magnitude / contrast / normalization on the active text-token region
- optional edit-mode text gain
- optional preservation blend/dampen logic
- FLUX.2 Klein Token Region Controller
- front / mid / end token-region gains
- optional custom emphasis window
- optional preservation blend/dampen logic
- FLUX.2 Klein Reference Latent Mixer
- reliable weakening / fading / replacement of reference latents
- supports all reference latents, not just the first one
- channel masking and spatial fade support
- FLUX.2 Klein Prompt/Reference Balance
- single-slider convenience wrapper
- balances text gain against reference weakening
- FLUX.2 Klein Reference Appearance Balancer
- separates coarse appearance from fine detail in the reference latent
- lets you boost low-frequency appearance retention without blindly scaling the full latent
- FLUX.2 Klein Sectioned Text Encoder
- manual or auto-balanced front/mid/end prompt authoring
- preserves
attention_maskinto conditioning metadata when available
Key design decisions
1. The sectioned encoder keeps the attention mask
The source sectioned encoder returned fresh conditioning with only pooled_output, while the source enhancer/detail nodes depend on attention_mask to find the real active token range. When that mask is missing, they fall back to a heuristic region length. This rebuild preserves the mask whenever the tokenizer exposes it, so sectioned encoding and downstream token-region control agree with each other.
2. No per-item parameter mutation inside the conditioning loop
In the source repo, the dampen path mutates node parameters inside the loop over conditioning entries. With multiple conditioning items, later items can get re-dampened using already-modified values. This rebuild computes per-item local values and leaves user inputs unchanged.
3. Reference control is honest about what it can reliably do
The source repo exposes reference-latent “strength” as raw multiplicative scaling and also includes a balance node that scales reference latents directly. There is an open issue explicitly questioning whether latent multiply or the repo’s implementation actually works as intended. This rebuild therefore does not claim reliable “stronger than baseline” reference locking from raw latent multiplication.
Instead, it provides operations that reliably change the latent content rather than only its amplitude:
- mix toward zeros
- mix toward gaussian noise
- mix toward per-channel mean
- optionally only in selected channels / spatial regions
That gives you a dependable weakening/fading control surface without overstating what raw pre-model latent scaling can do.
3.5. Washed-out edit colors need reference-stream control, not just text contrast
FLUX.2 Klein image-edit runs often preserve layout more reliably than coarse appearance. When that happens, pushing harder on text conditioning can make the edit more obedient while still letting source chroma wash out.
The root problem is that a raw
Nós neste pacote
Nós 6
Nós neste pacote
Nós 6- Flux2KleinConditioningEnhancer
- Flux2KleinPromptReferenceBalance
- Flux2KleinReferenceAppearanceBalancer
- Flux2KleinReferenceLatentMixer
- Flux2KleinSectionedTextEncoder
- Flux2KleinTokenRegionController
Fontes
3 fontes
Fontes
3 fontesVerificado 3 de out.
Verificado 3 de out.
Trechos de fonte
1 trecho
Trechos de fonte
1 trechoSource context: Repo xmarre/ComfyUI-Flux2Klein-Conditioning-Toolkit
