Conditioning crop or fill
Stop TensorRT from spamming your console
- conditioning
- empty_conditioning
- CONDITIONING
This one's narrow but useful if you've ever built a TensorRT engine in ComfyUI and hit "why is my console flooding with warnings and my output full of noise." When you build a TensorRT engine, you fix a context length at build time - how many multiples of 77 tokens the engine is compiled to accept. Unlike ordinary PyTorch inference, a compiled TensorRT engine can't just tolerate whatever length you throw at it at runtime; the shape is locked in.
So if your actual prompt tokenizes shorter than what the engine expects, ComfyUI ends up spamming the console while generating noise instead of your image. If it's longer, it spams the console again and just silently ignores whatever didn't fit. Neither is a great time. This node exists purely to make sure the conditioning you feed the sampler always matches the length your engine was built for.
How it works
It's simple on purpose: if your conditioning is longer than the target context_length, it crops it down. If it's shorter, it concatenates empty conditioning onto the end until it reaches the target. Either way, what comes out the other end is exactly the length your TensorRT engine is expecting - no more console spam, no more noise.
The inputs and outputs that matter
conditioning(CONDITIONING) - the one you're normalizing.empty_conditioning(CONDITIONING) - the filler used when padding a short conditioning; typically a blank CLIP Text Encode.context_length(default 1, range 1–12) - set this to whatever context length you built your TensorRT engine with. It's literally "how many times 77 tokens" - the same number you chose when creating the engine.enabled(default true) - flip off to bypass the node without pulling it out of your graph, handy for A/B testing with and without it.
Output is a single CONDITIONING, ready to feed straight into your sampler in place of the raw conditioning.
How to install it
Via ComfyUI Manager: search Uncond-Zero-for-ComfyUI, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Extraltodeus/Uncond-Zero-for-ComfyUI
then restart. No models, no extra dependencies - it's a small conditioning-shape utility, nothing more to set up.
Common issues & troubleshooting
Don't know your engine's context_length? Check the settings you used when you built the TensorRT engine in the first place - this node's value needs to match that exactly, not your prompt's actual length.
Symptom checklist for "I need this node": console spam plus visible noise artifacts when your prompt is shorter than the built context, or spam plus silent truncation when it's longer. Either one means your conditioning length and your engine's compiled context length have drifted apart.
Not using TensorRT? Skip this node. Ordinary ComfyUI sampling handles conditioning of any length fine - the mismatch problem this fixes is specific to engines compiled for a fixed shape, so there's no benefit to adding it "just in case" on a normal workflow.
Pairs with Conditioning combine positive and negative. If you're also running that node from this pack and want to be sure your positive/negative token counts line up before they get merged, running conditioning through this one first keeps everything at a predictable length - though its stated purpose in the README is specifically the TensorRT case, so treat that pairing as a bonus, not the primary use.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| empty_conditioning | CONDITIONING | — | |
| context_length | INT | 11–12 | — |
| enabled | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |