Nodes/MiniMax H3 Inpaint Tools/MiniMax H3 Save Latent
ComfyUI Node

MiniMax H3 Save Latent

Save the latent, or a partial rewrite of the clip is impossible

By panghea·Created 4 days ago·Updated 3 days ago· 6
MiniMax H3 Save Latent
  • samples
    filename_prefixh3_latents/clip
    dtypebf16

    Here's the workflow shape that makes this whole pack useful: you generate a clip, spot one flaw in it, and want to re-roll just that part. Partial Denoise Mask needs the original latent as its latent_image - the thing it pins and resamples against. And here's the problem: a plain single-shot R2V/I2V/T2V graph in ComfyUI throws the latent away the moment it decodes to video. Only the Contex Loop chain keeps per-clip latents, inside its checkpoints. MiniMaxH3SaveLatent is the fix for everyone else: stick it next to SaveVideo and the latent survives on disk, ready for the day you need to reopen and edit the clip.

    How it works

    Core SaveLatent writes samples["samples"] as a single tensor - which is fine for image latents and useless for H3's NestedTensor holding two. This node flattens the pair on the way out and records in a small JSON sidecar how many tensors there were and what shapes they had, so Load Latent can rebuild the nesting on the way in. Plain .safetensors files, nothing proprietary.

    The inputs

    • samples - the H3 latent to save.
    • filename_prefix - defaults to h3_latents/clip. Files land in ComfyUI's output directory with the usual numbered suffix, so you get h3_latents/clip_00001_.safetensors and so on.
    • dtype - bf16 (default), fp16, or fp32. bf16 halves the file and is what the model runs in anyway; the tooltip's advice is direct: pick fp32 only if you want the sampler output back bit-for-bit. For reference, a 4.5-second 1.5 MP clip is roughly 430 MB in bf16 - fp32 doubles that for a precision you'll never see.

    The original dtype is recorded in the metadata and restored on load, so downstream nodes see what they expect regardless of what you saved as.

    Where to put it

    Next to your SaveVideo node, at the end of a run you care about. It's an output node, so it prints the path and file size to the console when it runs - a nice confirmation that something ~430 MB actually landed. The use case is archival, not casual: this is the file that makes "fix the glyph in the logo, keep the camera drift" possible tomorrow instead of regenerating the whole commercial.

    Honest note on the alternative: if you didn't save the latent, the pack's Pack Latent can rebuild one from the mp4 via a VAE round trip - but that costs one generation of VAE loss across the whole clip, so untouched regions degrade slightly too. Save Latent is the lossless route and Pack Latent is the salvage route. Prefer this one.

    Install

    Part of the ten-node pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/panghea/ComfyUI-MiniMax-H3-Inpaint-Tools
    cd ComfyUI-MiniMax-H3-Inpaint-Tools && pip install -r requirements.txt
    

    Or ComfyUI Manager, search MiniMax H3 Inpaint Tools, restart, and it's under MiniMax H3/latent. The matching reader on the other side is MiniMax H3 Load Latent, which also understands the Contex Loop chain's checkpoint format if that's where your latent already lives.

    CategoryMiniMax H3/latent

    Inputs (3)

    NameTypeDefaultDescription
    samplesLATENT
    filename_prefixSTRINGh3_latents/clip
    dtypeCOMBObf16bf16 halves the file and is what the model runs in anyway. fp32 only if you want the sampler output back bit-for-bit.

    Outputs (0)

    No outputs