Flow Matching Stage Prep
The 'rewind' half of a flow-matching upscale stage, for people who like their own sampler
- latent
- skip_latent
- presampler_latent
- seed
- next_seed
FlowMatchingStagePrep is the preparation half of a flow-matching upscale stage, split out into its own node so you can drive the sampling yourself. The pack's FlowMatchingStage node is the all-in-one: it upscales, re-noises, samples, and merges internally. Prep stops at "upscale + re-noise" and hands you two latents - plus a couple of seeds - and then you take over with ComfyUI's own SamplerCustom or SamplerCustomAdvanced. That's the whole design: why reimplement sampler logic when ComfyUI already has the good samplers, sigmas, and guiders?
The re-noising is the same flow-consistent trick as the rest of the pack. Instead of dumping random noise over an upscaled latent, noise_ratio (0 = keep latent, 1 = pure noise) mixes in just enough fresh noise to put the latent back onto the model's flow trajectory at the right timestep. That's what makes the subsequent sampler pass refine the image rather than hallucinate a new one. The mechanism is deliberately minimal here - this node takes no model or conditioning at all, just a latent and the numbers that control the rewind.
Inputs that matter:
latent- the latent to upscale and re-noise.seed- controls the flow re-noise, and the docs are explicit: use this same seed as your Custom Sampler's noise seed for deterministic runs.scale_factor(1.0) - how much this stage resizes the latent grid.noise_ratio(0.0) - the rewind amount.upscale_method(bicubic) - resize kernel. Samelanczoswarning as everywhere in this pack: it falls back tobicubicbecause ComfyUI's lanczos path is PIL-based and clamps latents.
Optional: reduce_memory_use (default enable) - avoids extra tensor clones where possible. That's the entire optional surface, because the sampling - and its memory profile - now belongs to your Custom Sampler.
Outputs. This is where it gets interesting, four outputs:
skip_latent- the upscaled latent before sampling. This is your "keep the composition" reference.presampler_latent- the upscaled and re-noised latent. This goes intoSamplerCustom/SamplerCustomAdvanced(use theseedoutput as the noise seed).seed- for wiring into your Custom Sampler.next_seed- a derived seed to chain into the next stage'sseedfor deterministic multi-stage runs.
The full modular flow: Prep → Custom Sampler → FlowMatchingStageMerge (blend the sampled result with skip_latent via skip_blend).
Install. Part of ttulttul/ComfyUI-FlowMatching-Upscaler. ComfyUI Manager, search "ComfyUI-FlowMatching-Upscaler", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/ttulttul/ComfyUI-FlowMatching-Upscaler
No model downloads; deps are numpy, torch, einops, aiohttp - nothing beyond a stock ComfyUI. Registers under latent/upscaling.
Gotchas. The pack is upfront that this modular path drops two things the integrated FlowMatchingStage keeps: the LOW_VRAM streaming fallback and the dilated refinement pass. If you're on tight VRAM or fighting high-frequency artifacts, you may want the integrated node instead - the modular route is for people who want their own sampler and guider and don't mind owning the memory management. And don't forget the seed wiring: use seed in your Custom Sampler, not a fresh random one, or your "deterministic" chain will drift.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | Latent to upscale and re-noise before sampling. | |
| seed | INT | 00–18446744073709550000 | Seed controlling flow re-noise (use as Custom Sampler noise seed for determinism). |
| scale_factor | FLOAT | 1.000.1–8 | Spatial scale factor applied to the latent grid for this stage. |
| noise_ratio | FLOAT | 0.000–1 | Flow-style re-noise amount (0 = keep latent, 1 = replace with pure noise). |
| upscale_method | COMBO | bicubic | Resampling kernel for spatial upscaling. NOTE: ComfyUI's `lanczos` path uses PIL and is unsafe for LATENT tensors; this node will fall back to `bicubic` if selected. |
| reduce_memory_useopt | COMBO | enable | Enable to reduce VRAM use by avoiding extra tensor clones where possible. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| skip_latent | LATENT | — |
| presampler_latent | LATENT | — |
| seed | INT | — |
| next_seed | INT | — |