ComfyUI Node

IO_loadLatent

Load a saved H3 video latent back in — the checkpoint for latent continuity

By cardenluo·Created 2 years ago·Updated a day ago· 320
IO_loadLatent
    • Latent
    latent_pathh3_context
    clip_index0

    ComfyUI will happily save an image or a video, but a latent? That's the rare trick. IO_loadLatent is the reader for this pack's latent checkpoint system: it loads an H3 video/audio latent back off disk as a proper LATENT tensor, so you can pick up a generation exactly where you left off - same motion context, same audio latent - without re-running the model. It's the "load game" half of a save/load pair with IO_SaveLatent.

    Why would you want that? The pack's whole multi-shot approach leans on latent continuity - chaining a previous clip's latent into the next generation so the character and motion persist. IO_loadLatent is how you make that persistence survive a ComfyUI restart or move between workflows: save the latent once with IO_SaveLatent, then load it anywhere later instead of regenerating or trying to reproduce it from an image.

    Inputs

    • latent_path (STRING, default "h3_context") - the file or folder to load. Relative paths are resolved from the ComfyUI output folder (that's where IO_SaveLatent writes). Point it at a file to load that file, or at a folder and use clip_index to pick within it.
    • clip_index (INT, default 0) - which clip slot to load. 0 loads the newest .safetensors file in the folder, which is the convenient default; set it to a specific slot number to pin a particular clip.

    Output: Latent (LATENT) - the loaded H3 AV latent, ready to feed a sampler or an AD_Inject_Latent-style pipeline.

    How it works

    It resolves the path, reads the .safetensors file, and reconstructs the joint AV latent as a NestedTensor with the video and audio members in the order the H3 stack expects. It validates that the file actually contains both - if it's not an H3 video/audio latent, you get an explicit "not an H3 video/audio latent" error rather than a confusing shape mismatch downstream.

    It also watches the file: IS_CHANGED keys off the file's modification time, so if the file on disk changes, the node re-executes and picks up the new content instead of serving you a cached old latent. That's the behavior you want from a loader but rarely get.

    When you'd use it

    • Resume: save a mid-piece latent, come back tomorrow, load it and continue without continuity drift.
    • Pass-off between workflows: workflow A generates and saves the context latent; workflow B loads it. This is how you keep a long project from becoming one giant graph.
    • Debugging: when a multi-stage run gives you a weird jump, load the saved latent and inspect what the previous stage actually produced.

    One honest caveat: it only reads the format IO_SaveLatent writes (metadata tag h3_motion_context_av_v1), so it won't load arbitrary latents from other packs. Use the pair together and it's seamless.

    Installing it

    From cardenluo/ComfyUI-Apt_Preset:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
    pip install -r requirements.txt   # or install.bat on Windows
    

    Restart ComfyUI; it's under Apt_Preset/IO_Port. No model downloads needed.

    CategoryApt_Preset/IO_Port

    Inputs (2)

    NameTypeDefaultDescription
    latent_pathSTRINGh3_contextLatent file or folder. Relative paths are resolved from the ComfyUI output folder.
    clip_indexINT00–9999Clip slot to load. 0 loads the newest safetensors file in the folder.

    Outputs (1)

    NameTypeDescription
    LatentLATENT