Personalize Anything Invert (RF-Inversion)
The node that runs Flux backwards
- model
- conditioning
- latent_image
- inverted_latent
- source_latent
Every diffusion workflow you've built walks one direction: noise in, image out. This node walks the other way. You hand it a photo, it hands you back a latent that represents that photo as if it were noise - and that is the thing the sampler needs in order to keep a subject's identity intact while painting a new picture around it.
It's half of a two-node pair. On its own it produces nothing you'd look at; in a graph with PersonalizeAnythingSample it's the piece that makes the trick possible.
What it's actually doing
RF-Inversion's forward ODE. The idea is old enough to be respectable: if a rectified-flow model predicts a velocity - a straight-line direction from noise to image - you can integrate that velocity against time and land on a latent that decodes back to something very close to your input. Lift the technique from the paper (Taming Rectified Flow for Inversion and Editing, arXiv 2410.10792), which is also what the Fluxtapoz pack brought to ComfyUI back in November 2024.
Where it gets specific: gamma blends the model's own predicted velocity with the straight-line interpolation toward a random noise tensor. At the default 1.0 you follow that straight path; at 0 you're trusting the model's velocity alone. Upstream calls for 1.0, so leave it there unless you're deliberately experimenting.
The pack also rebuilds the sigma schedule from the original pipeline's scheduler config, because comfy's Flux sampling hardcodes one shift value at every resolution while the official grid scales it with token count - and the RF algebra was written against that grid. Which is why both nodes own their own steps instead of sharing a KSampler.
The inputs
There are only six, and four of them are already decided for you.
- model - the Flux diffusion model, straight from Load Diffusion Model. Use flux-dev; the paper, the README's model list and the shipped examples are all dev.
- latent_image - the raw latent of your source image, i.e. Load Image → VAEEncode. Raw, unscaled, the same space VAEEncode and VAEDecode use. No manual latent scaling.
- conditioning - the source branch's prompt. Upstream runs this empty, and so should you: an empty CLIPTextEncode is the standard wiring. If you do put text here, whatever you feed the Sample node's
source_conditioninghas to match it. - steps - the one setting you must keep in sync. Set it identical to the Sample node's
steps. The algorithm assumes the same discretisation in both directions; mismatching them is the easiest way to get a smeared, half-transferred result and blame the wrong node. - guidance - inversion guidance, default 0.0. The original pipeline hardcodes the source guidance scale to zero, so 0 isn't a shy default, it's the recipe. Raising it changes the inversion away from the paper.
- gamma - covered above. 1.0.
Two outputs, both going to the Sample node: inverted_latent (the source branch's starting noise) and source_latent (the encoded original, which the reverse pass steers back toward). Wiring one and forgetting the other is a common first mistake - the node produces two latents for a reason.
Note what isn't here: no CLIP loader, no VAE. Deliberate. Keeping them in separate nodes lets comfy unload them when the DiT takes the card, which is the difference between this pack working on a 12 GB GPU and the old all-in-one wrapper falling over.
Install
Same pack, same install - Manager search for ComfyUI_Personalize_Anything, or:
cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_Personalize_Anything
Then the Flux stack the README asks for: flux1-dev-fp8-e4m3fn.safetensors (~11 GB) in models/diffusion_models, clip_l.safetensors and t5xxl_fp8_e4m3fn.safetensors in models/clip, ae.safetensors in models/vae. The pack's only pip dependency is torch.
Things that will bite you
Don't rerun and expect the same picture. There's no seed widget here, and the inversion integrates toward a freshly drawn random noise tensor each run. The Sample node's seed controls the target branch, not this.
Every Invert call evicts your CLIP and VAE. The node unloads all models before loading the transformer, by design - the alternative was an OOM on the fp8 stack. So a graph with two Invert nodes pauses and reloads text encoders more than you'd expect. That's not a bug, and it's why the run feels stop-start on smaller cards.
The nodes vanished from the menu after an update. Older versions of this pack shipped a diffusers wrapper that breaks on transformers>=5, and a Python import error there removes the entire category. git pull and restart fixes it; the current code needs no diffusers, transformers, peft or accelerate at all.
Guidance on the wrong node. guidance here is the inversion guidance, not the image's. The prompt-side guidance for your generated picture goes on the target conditioning via a FluxGuidance node in front of the Sample node. Two different knobs with confusingly similar names, one screen apart.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| conditioning | CONDITIONING | Prompt of the source branch. The original paper uses an empty prompt. | |
| latent_image | LATENT | Raw latent of the source image (e.g. from VAEEncode). | |
| steps | INT | 281–100 | — |
| gamma | FLOAT | 1.000–1 | — |
| guidance | FLOAT | 0.00–30 | Inversion guidance; the original pipeline hardcodes source_guidance_scale = 0.0. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| inverted_latent | LATENT | — |
| source_latent | LATENT | — |