Flux Latent Sampler
The empty latent and the Flux shift patch in one node
- model
- model
- latent
Setting up a Flux generation from scratch means creating an empty latent at your target resolution and patching the model with Flux's timestep shift, because Flux is a flow-matching model and the shift is how it adapts its noise schedule to the image size you're generating at. Normally that's two separate nodes. FluxLatentSampler does both at once: give it a model, a width and height, and it hands back a shift-patched model plus a matching empty latent, ready for your sampler.
Why this matters more than it sounds like
Older SD1.5/SDXL-style models correct for image size mostly through scheduler tricks (Karras and friends reshaping the noise curve). Flow-matching architectures like Flux don't work that way - they train on a near-straight denoising trajectory, and reshaping the schedule tends to break rather than help. What Flux exposes instead is a shift parameter, and it's genuinely resolution-dependent: the community's shorthand for it is that shift is roughly where scheduler tuning went once flow matching took over. Get it wrong for your resolution and the model isn't broken, exactly - it's just not sampling the way it was designed to at that size.
max_shift and base_shift are the same two numbers as ComfyUI's own Flux model-sampling patch, just bundled here with the latent creation step so you don't need a separate node for it.
What matters
model(MODEL, required) - the Flux model to patch. Nothing else in this node works without it.width/height(default 1024×1024, step 8, up to 16384) - your target resolution. Flux's native training resolution is 1024×1024; it holds up comfortably out to roughly 1536×1536 or so before quality starts trailing off.batch_size(default 1) - how many latents to generate at once.max_shift(default1.15) andbase_shift(default0.5) - the shift values. These defaults match Flux's own out-of-the-box settings, so leave them alone unless you have a specific reason to chase a different look at unusual resolutions.
Two outputs: model - the shift-patched model, wire this into your sampler instead of the raw checkpoint output - and latent, the empty latent at your chosen size and batch. Both need to go downstream; using the unpatched model with this node's latent (or vice versa) defeats the point.
Installing it
Search ComfyUI-TkNodes in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/TensorKaze/ComfyUI-TkNodes
cd ComfyUI-TkNodes
pip install -r requirements.txt
Restart ComfyUI. No node-specific dependencies beyond the pack's general requirements.txt. You do need an actual Flux.1 checkpoint (Dev or Schnell) loaded upstream - this node patches whatever model you hand it, and patching a non-Flux model with Flux-specific shift values won't do anything useful.
Common issues
Output looks soft or oddly composed at non-standard resolutions. This is usually a shift issue, not a sampler issue. If you're generating well outside 1024×1024 and results look off, that's the exact problem max_shift/base_shift exist to correct - try nudging them before you start swapping samplers.
Forgot to use the patched model output. Easy mistake: if your KSampler is wired to the original model output instead of this node's model output, you lose the shift patch entirely and you're back to unmodified sampling. Double-check the wire.
Batch size eating VRAM. batch_size goes up to 4096 in the schema, but Flux's 12B stack is heavy - realistic batch sizes on consumer cards are much smaller. Push it up gradually rather than assuming the max is usable.
Like the rest of this pack, there's no real community reputation behind this node - it's a small, personal utility collection rather than something with workflow-share threads built around it. What it does, it does plainly: it's the stock Flux resolution + shift setup, just saving you a node.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| width | INT | 102416–16384 | — |
| height | INT | 102416–16384 | — |
| batch_size | INT | 11–4096 | — |
| max_shift | FLOAT | 1.150–100 | — |
| base_shift | FLOAT | 0.500–100 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| latent | LATENT | — |