Nodes/ComfyUI-MochiEdit/Mochi Unsampler
ComfyUI Node

Mochi Unsampler

Walk a video backward into noise (on purpose) — Mochi Unsampler

By logtd·Created 2 years ago·Updated 2 years ago· 295
Mochi Unsampler
    • SAMPLER
    seed0
    gamma0.00

    If you've seen a demo where someone adds a hat to a person in a real video, changes their outfit, or restyles an entire clip, the trick almost always starts with a lie: you convince a diffusion model that your video is noise. That's exactly what this node does. Mochi Unsampler runs the Mochi model backwards through its own noise schedule and spits out a SAMPLER that converts a video latent into structured noise - noise that still "remembers" the video's layout, motion, and subjects.

    It's one half of the RF-Inversion recipe that this whole pack (logtd/ComfyUI-MochiEdit) is built on. Unsample a video into noise, then resample that noise with a new prompt. The name comes from a research idea - RF-Inversion, "Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations" (Rout et al., arXiv:2410.10792) - that works especially cleanly on Mochi because Mochi is a flow-matching model: its sampling path is a nearly straight line between noise and data, so walking it backward is actually meaningful, not just a party trick.

    What you feed it

    The node is almost insultingly small. Two knobs, one SAMPLER out:

    • seed - used only if you turn on noise correction via gamma. Leave it at 0; you won't touch it.
    • gamma - the amount of noise correction toward a random target during inversion. The author is blunt about it in the README: leave this at 0, because it does not work well with Mochi. For practical editing you want the plain, deterministic inversion, not the corrected variant.

    That's it. The SAMPLER output plugs into the sampler input of SamplerCustom (Mochi Wrapper), which actually runs the unsampling pass. On the wrapper side the rules are strict:

    • positive and negative should be blank prompts
    • cfg must be 1.0 (you want pure model output, no guidance tug-of-war)
    • add_noise must be False - you're converting an existing video to noise, not adding more
    • sigmas must be prepared and then flipped (reverse them so the schedule walks from clean video toward noise)

    The blank prompts matter more than people expect. This isn't a caption-inversion where the model guesses what the scene is; the whole point is to get the unconditional vector field, the model's raw prior, so the inversion isn't contaminated by a description.

    How it actually works

    Digging into the source, MochiUnsampler builds a custom KSAMPLER from get_rf_forward_sample_fn. Each step it evaluates the model as an unconditional vector field, and (when gamma > 0) blends in a conditional field that points toward a freshly sampled noise tensor. At gamma = 0 it's a straight controlled forward ODE - essentially reversing the denoising ODE deterministically. The result is a latent that denoises back into your video, but with enough slack that a different prompt can pull it somewhere new.

    Install

    The pack doesn't ship its own Mochi support. First install kijai's ComfyUI-MochiWrapper (ComfyUI Manager, or git clone https://github.com/kijai/ComfyUI-MochiWrapper into custom_nodes/), grab the Mochi checkpoint the wrapper expects, then:

    cd ComfyUI/custom_nodes
    git clone https://github.com/logtd/ComfyUI-MochiEdit
    

    Restart ComfyUI. The README says there are no additional Python requirements, and it's telling the truth - the pack has no requirements.txt.

    The honest caveats

    Mochi is an early open video model and it shows: it's VRAM-hungry (people asking "is 12GB enough?" never got a confident yes), and community momentum largely moved on to LTX and Wan after this pack landed in November 2024. It's also effectively unmaintained - the README still says native ComfyUI Mochi support is coming "soon" and the repo's last real activity was that same month. If the node is missing or throws a type error, update the wrapper first: it and this pack were merged together (the repo literally contains a merge PR from kijai), so a stale wrapper is the most common way this breaks. Treat this as a specialty tool for people who specifically want to edit Mochi video, not a workflow you'll run every day.

    CategoryMochiEdit

    Inputs (2)

    NameTypeDefaultDescription
    seedINT00–18446744073709550000
    gammaFLOAT0.000–30

    Outputs (1)

    NameTypeDescription
    SAMPLERSAMPLER