π§ Flux LayerDiffuse Conditioning Fix
The band-aid that makes Flux LayerDiffuse accept your conditioning
- conditioning
- fixed_conditioning
If you've hit a wall getting Flux LayerDiffuse to run in ComfyUI, it's probably this: the conditioning tensors are the wrong shape. Flux expects a sequence length and a hidden dimension (4096) that the CLIP encoding you're feeding in doesn't match, and the whole graph dies with a tensor-size error. FluxLayerDiffuseConditioningFix is the shim that pads and truncates your conditioning into what Flux wants so the transparent pipeline can run at all.
What it does, mechanically
The node takes one CONDITIONING input and one number - target_length (default 256, range 77β512). For each conditioning entry it looks at the tensor's sequence length and hidden dimension:
- Sequence too short β zero-pads the sequence to
target_length. Too long β truncates. - Hidden dim below 4096 β zero-pads it up to 4096. Above β truncates.
Zero-padding conditioning is a blunt instrument, but it's the standard fix for "this CLIP encoder produced the wrong-size embedding" - the same kind of compatibility shim the layerdiffusion ecosystem has needed since the technique stopped being maintained upstream. Note the tooltip-free honesty in the code: if the fix fails for any reason it just returns your original conditioning rather than crashing, so the node degrades gracefully instead of making things worse.
When you actually need it
The README's troubleshooting section is the real-world map here: tensor errors β use DualCLIPLoader type="flux" plus the Conditioning Inspector. The "fix" node is the fallback for when you can't just switch CLIP types - say your graph was built for an SD-style CLIP and you're bolting LayerDiffuse onto it without rebuilding. The pack's intended happy path is Flux-native conditioning all the way through, which is what FluxLayerDiffuseEmptyConditioning produces for the negative side; this node is for the mismatched case.
One honest caveat from how the pack is structured: this whole Flux LayerDiffuse mini-ecosystem is the author's own port of RedAIGC's work, and "Conditioning Fix" is best treated as a compatibility shim, not a quality feature. If you're getting wrong-looking output rather than a crash, reshaping tensors won't save you - that's a prompt or LoRA-strength problem (see the README's "glass generation" note about dropping layerlora.safetensors strength to 0.5β0.8).
Inputs and outputs
conditioning(CONDITIONING, required) - your CLIP-encoded conditioning.target_length(INT, default 256) - the sequence length to force. 256 matches what the pack's other LayerDiffuse nodes default to; if your empty conditioning is built at 256, keep these in lockstep.
Output: fixed_conditioning (CONDITIONING) - wire it into the KSampler's positive/negative inputs.
Installation
It ships in DenRakEiw_Nodes: ComfyUI Manager β search "DenRakEiw Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/DenRakEiw/DenRakEiw_Nodes
cd DenRakEiw_Nodes && pip install -r requirements.txt
then restart. The heavy Flux LayerDiffuse deps (diffusers 0.32.2, transformers, peft) come along with the pack, and you'll also need the actual LayerDiffuse models - TransparentVAE.pth and layerlora.safetensors - plus a Flux checkpoint before any of this means anything.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | β | |
| target_length | INT | 25677β512 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| fixed_conditioning | CONDITIONING | β |