Nodes/ComfyUI-WanVideo-LatentIO/Save Wan Video Latent
ComfyUI Node

Save Wan Video Latent

Pay the sampling bill once, re-render the rest for free

By heresyCoder·Created 8 months ago·Updated 7 months ago· 4
Save Wan Video Latent
  • latent
    filenamewan_latent
    subdirectory

    The sampler bill, paid once

    The most expensive thing in any Wan workflow is the sampler, and it's also the thing you run over and over for no reason. You tweak the upscaler, swap the VAE, decide you want a different frame count on the second pass - and ComfyUI happily re-samples from scratch every time. Save Wan Video Latent is the fix: it writes the LATENT that comes out of your Wan sampler to disk as a .safetensors file in ComfyUI/output/, so you keep the expensive denoising and only re-run the cheap stuff downstream.

    The use case that made saving latents popular with Wan is the model's own architecture. Wan 2.2 splits denoising into a high-noise expert (motion, composition) and a low-noise expert (detail). Run stage one many times to hunt for good seeds, save the survivors, then run stage two only on the latents you actually like - no re-sampling, and on full FP16 14B models (about 28GB each) no constant model swapping between passes either.

    How it works

    The node splits your latent dict into two buckets: tensors go into a safetensors file via save_file, and anything non-tensor gets stringified into safetensors metadata. The whole dict - including extra tensors like the noise input some Wan workflows carry - is saved, so loading it back with the sibling LoadWanVideoLatent node returns a faithful LATENT. Filenames are deterministic rather than random: the same name on a second run gets a _001, _002... suffix instead of silently overwriting. Subdirectories are created on demand and the path is sanitized against .. traversal.

    The inputs that matter

    • latent - the LATENT output of your Wan sampler (or any upstream latent you want to park).
    • filename - no extension, per the author's tooltip, default wan_latent. Keep this unique per run; see the gotcha below.
    • subdirectory (optional) - a subfolder inside output/, created if needed, so you can keep runs organized.

    Outputs? None - that's the point

    This is an output node, like Save Image. It always runs, and the graph cache works backward from it, which means the sampler feeding it only re-executes when something upstream actually changed. If you wire SaveWanVideoLatent and the VAE decode in the same graph, you get both the cached latent file and the rendered clip in one pass.

    Install

    Same story as its sibling: through ComfyUI Manager, search "ComfyUI-WanVideo-LatentIO", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/heresyCoder/ComfyUI-WanVideo-LatentIO
    

    then restart ComfyUI. No model downloads and no extra dependencies - it uses only torch and safetensors, both already installed with ComfyUI. The pack is small and new, so don't expect much documentation beyond the tooltips, but there's not much to get wrong.

    Gotchas

    The filename quirk is the one thing that will surprise you. The first save of a name writes the file exactly as typed - so wan_latent becomes a file with no extension at all. The Load node finds it anyway (it matches exact paths and auto-appends extensions as a fallback), so the pair round-trips fine, but if you're browsing the folder on disk, type the .safetensors extension yourself and you'll have a boring, predictable time. Related trap: save with the same name twice and the second run lands in wan_latent_001.safetensors while a Load node on the base name keeps pointing at the original - use a fresh name per run, or you'll keep decoding the oldest version and wonder why nothing changes. Also worth knowing: non-tensor metadata gets saved as strings, but the loader doesn't restore it on the way back, so treat the file as tensor-only for practical purposes.

    CategoryWanVideo/latent

    Inputs (3)

    NameTypeDefaultDescription
    latentLATENTWan video latent tensor
    filenameSTRINGwan_latentFilename without extension
    subdirectoryoptSTRINGSubfolder in output/ (created if needed)

    Outputs (0)

    No outputs