Flux Forward ODE Sampler
Turn an image back into noise, semantically
- SAMPLER
FluxForwardODESampler is the first half of the RF-Inversion pipeline: it walks an image latent forward through the ODE until it becomes noise - but not random noise, semantic noise that still remembers what the image was. Once you have that, you can edit the prompt, unsample back down with the reverse sampler, and get an edited image that keeps the structure of the original. That's the whole RF-Inversion trick, and this node is the "encode to latent-land" step.
Why you'd reach for it
RF-Inversion (the paper is "Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations") is the pack author's recommended way to unsample an image for editing or style transfer. The practical payoff: you can take an existing image, run it forward to noise, and then regenerate it under a new prompt without the image collapsing into something unrelated. Compared to edit models it's more "traditional" - you get a noise tensor you can feed any normal Flux sampling setup - which means you keep the control, and the prompt, that a baked edit model doesn't give you.
How it works
This implements the "Controlled Forward ODE" (Algorithm 1 in the paper). At each step the sampler computes three vector fields: the unconditional one from the model, the conditional one pointing toward a target noise sample y1, and then blends them using gamma. The key knob is gamma, default 0.5, which controls how hard the trajectory is steered toward the target noise. Higher gamma = the noise carries more of the image's structure with it. Too high and the "noise" is barely noise anymore and the reverse pass has nothing to work with; too low and the encoding is lossy.
You also get a seed input, default 0. Keep it fixed if you want reproducible encodes.
The output is a SAMPLER - and this is the wiring detail people trip on. It does not go into a normal KSampler's sampler slot with the scheduler inputs it expects. You feed this into SamplerCustomAdvanced, which takes the SAMPLER plus your sigmas directly. The pack's RF-Inversion example workflow shows the exact hookup: forward sampler on one branch, reverse sampler on the other, both into their own SamplerCustomAdvanced nodes.
Installation
Standard for the pack: ComfyUI Manager, search "ComfyUI-Fluxtapoz", install, restart. Or git clone https://github.com/logtd/ComfyUI-Fluxtapoz into ComfyUI/custom_nodes. Only dependency is einshape, no model downloads - it runs on the Flux checkpoint you already have.
Common issues
- Plugging the SAMPLER into KSampler produces odd or broken results. Use SamplerCustomAdvanced.
- Forgot ConfigureModifiedFlux. The forward sampler patches attention to carry structure through the encode; without the modified blocks upstream, the encode loses too much and your "edits" come out as unrelated generations. It's the very first node in the example workflow for a reason.
- Gamma is a spectrum, not a set-and-forget. It interacts with the reverse sampler's eta and end_step - people report spending most of their tuning effort on that pair rather than on gamma.
Use it as the encode half, pair it with FluxReverseODESampler, and you've got a real inversion pipeline on Flux.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| gamma | FLOAT | 0.500–100 | — |
| seedopt | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SAMPLER | SAMPLER | — |