Nodes/ComfyUI-FlowMatching-Upscaler/Flow Matching Stage Prep
ComfyUI Node

Flow Matching Stage Prep

The 'rewind' half of a flow-matching upscale stage, for people who like their own sampler

By ttulttul·Created 10 months ago·Updated 7 months ago· 62
Flow Matching Stage Prep
  • latent
  • skip_latent
  • presampler_latent
  • seed
  • next_seed
seed0
scale_factor1.00
noise_ratio0.00
upscale_methodbicubic
reduce_memory_useenable

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. Same lanczos warning as everywhere in this pack: it falls back to bicubic because 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 into SamplerCustom/SamplerCustomAdvanced (use the seed output as the noise seed).
  • seed - for wiring into your Custom Sampler.
  • next_seed - a derived seed to chain into the next stage's seed for 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.

Categorylatent/upscaling

Inputs (6)

NameTypeDefaultDescription
latentLATENTLatent to upscale and re-noise before sampling.
seedINT00–18446744073709550000Seed controlling flow re-noise (use as Custom Sampler noise seed for determinism).
scale_factorFLOAT1.000.1–8Spatial scale factor applied to the latent grid for this stage.
noise_ratioFLOAT0.000–1Flow-style re-noise amount (0 = keep latent, 1 = replace with pure noise).
upscale_methodCOMBObicubicResampling 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_useoptCOMBOenableEnable to reduce VRAM use by avoiding extra tensor clones where possible.

Outputs (4)

NameTypeDescription
skip_latentLATENT
presampler_latentLATENT
seedINT
next_seedINT