Nodes/bsz-cui-extras/BSZ Principled Conditioning
ComfyUI Node

BSZ Principled Conditioning

CLIP encoding that knows what resolution your latent actually is

By Beinsezii·Created 3 years ago·Updated 2 years ago· 27
BSZ Principled Conditioning
  • latent
  • clip
  • CONDITIONING
text
xl_target
refiner_asc6.00

SDXL's text encoder doesn't just read your prompt - it also wants to know the image's size and crop, because the base model was trained with that conditioning. BSZ Principled Conditioning is the node that figures that out from your latent automatically, so you get proper SDXL-style encoding without filling in width/height/crop boxes yourself.

Why you'd reach for it

The stock CLIPTextEncode ignores resolution entirely, and CLIPTextEncodeSDXL makes you type the numbers - and when you're doing a two-pass workflow the second pass runs at a different resolution, so the numbers change between stages. This node reads the latent you hand it, multiplies by 8 to get pixel dimensions, and encodes against those. Change the latent, the conditioning updates with it.

How it works

Feed it:

  • latent - the latent the conditioning is for. Its dimensions drive everything.
  • clip - from your checkpoint (base, refiner, or a plain SD 1.5 CLIP all work).
  • text - the prompt.
  • xl_target - where to aim resolution conditioning: 1k (targets ~1024², the least-jank sweet spot for SDXL), full (uses your latent's actual size), or 4k (clamps to 4096 for big passes).
  • refiner_asc - aesthetic score, only used when clip is an SDXL refiner CLIP (default 6.0).

Under the hood it detects whether your CLIP is SDXL base, SDXL refiner, or plain SD 1.5 and picks the right encoder path - CLIPTextEncodeSDXL for base XL, the refiner variant with your aesthetic score, or vanilla CLIPTextEncode otherwise. That auto-detection is the whole trick, and it's why this node works in a mixed workflow without you caring which model family is hooked up.

Output: a single CONDITIONING that plugs straight into a sampler's positive or negative input.

Install

Part of Beinsezii's bsz-cui-extras:

cd ComfyUI/custom_nodes
git clone https://github.com/Beinsezii/bsz-cui-extras

then restart or install via ComfyUI Manager. Pure Python, no dependencies.

Notes

This is the conditioning engine inside BSZ Principled Sampler, so if you use that node you're already using this one's logic without seeing it. Used standalone, its xl_target is the thing to actually think about: 1k is the right default for SDXL-native generation, full matters if you're working at a deliberately different size and want the model to know it, and 4k is for hi-res passes where you want the encoder to understand the big target. One real-world trap: the refiner path encodes against your latent's actual size, not the target, so if your refiner pass runs at a much larger latent than the base pass, the aesthetic-score conditioning is computed at the larger size - usually fine, occasionally surprising.

Categorybeinsezii/conditioning

Inputs (5)

NameTypeDefaultDescription
latentLATENT
clipCLIP
textSTRING
xl_targetCOMBO3 options: 1k, full, 4k
refiner_ascFLOAT6.000–1000

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING