Nodes/H3 Temporal Sampler/H3 Latent Cache (Save/Load)
ComfyUI Node

H3 Latent Cache (Save/Load)

The node you need because ComfyUI's Save Latent crashes on H3

By ehsrzv·Created 22 days ago·Updated 14 days ago· 5
H3 Latent Cache (Save/Load)
  • latent
  • latent
◄load_modefalse►
◄filename_prefixh3_stage2_latent►
◄latent_file▾►

Why this node exists at all

ComfyUI's core Save Latent and Load Latent nodes assume a plain tensor. MiniMax H3's latent isn't one. It's a NestedTensor with the video samples and the audio samples welded together in a single object, and the core nodes hit it and die with AttributeError: 'NestedTensor' object has no attribute 'contiguous'. This isn't an H3-only quirk - the same class of error shows up wherever ComfyUI handles audio-video latents as a nested pair. It's just what happens when a "latent" stops being one tensor.

H3 Latent Cache fixes it in the least clever way possible: torch.save the latent dict, torch.load it back, and let the nested structure survive untouched. Four inputs, one output, no settings archaeology.

When you'd actually reach for it

The reason to care is the two-stage workflow. Stage 1 generates a modest H3 AV clip. Stage 2 pushes that latent through the latent upscaler and a second sampler pass to get toward 2K - and that's where all the time and all the VRAM go. Cache stage 1's latent and you can iterate on stage 2 all afternoon: different sigmas, different segment counts, different upscale factor, without re-running stage 1 once. The node pays for itself the first time you'd otherwise have sat through a redundant stage-1 pass.

Same trick when a big render OOMs ninety percent of the way through. Save the latent before the expensive part, then retry only the tail.

Inputs and output

Save vs load is a single boolean on a single node - that's the whole design, and why it replaced the pack's earlier separate save and load pair.

  • latent - the live latent. In save mode it gets written and passed straight through; in load mode the input is ignored entirely.
  • load_mode - off (the default) saves, on loads. The toggle labels read SAVE to new file and LOAD from file.
  • filename_prefix - default h3_stage2_latent, auto-numbered from _00001 upward.
  • latent_file - the dropdown you pick from in load mode. Files land in ComfyUI's output directory with a .h3latent.pt extension.

One output, latent. Because save mode is a pass-through, you can leave the node inline in your graph, leave it in save mode while you experiment, and flip the switch to replay later - no re-wiring. It's flagged as an output node too, so it counts as a terminal node in your graph and reports its save/load action back to the console.

The gotcha everyone hits

The file dropdown is built when the node is created. Save a fresh latent and it will not appear in that list until you re-add or duplicate the node. If your new file is missing from the dropdown, that's why - not a broken install, not a permissions problem.

Second thing: this node is deliberately never cached (it reports a changed value every run), which is correct for "write a new file each time" and means files pile up. Ten test renders, ten .h3latent.pt files in your output folder, each one a full latent for a video of yours. Sweep them out when the project's done; they are not small.

Errors worth recognising:

[H3LatentCache] no .h3latent.pt files saved yet - run once with load_mode OFF to save one first.

You flipped to load before anything existed.

[H3LatentCache] file not found: /.../h3_stage2_latent.h3latent.pt

The dropdown remembers a name and the file got moved or deleted. Re-add the node to rebuild the list.

One honest caution. The loader calls torch.load(..., weights_only=False), because nested latent dicts don't round-trip otherwise. That's pickle semantics - only ever load files this node wrote on your own machine. Don't pull an .h3latent.pt from a stranger. And don't try to open one with core Save/Load Latent; that crash is the entire reason this exists.

Install

It ships in the same pack as the H3 Temporal Sampler, so if you have one you have both:

cd ComfyUI/custom_nodes
git clone https://github.com/ehsrzv/comfyui-h3_temporal_sampler.git

Restart ComfyUI, or search h3-temporal-sampler in ComfyUI Manager and install. Nothing to pip install - no requirements.txt, no model downloads, no extra dependencies beyond ComfyUI itself. The node appears under the h3 temporal sampler category. All you need otherwise is an H3 AV latent to hand it.

Categoryh3 temporal sampler

Inputs (4)

NameTypeDefaultDescription
latentLATENTLive latent. Saved to a new file in SAVE mode; ignored in LOAD mode.
load_modeBOOLEANfalseOFF: save the input to a new auto-numbered file and pass it through. ON: ignore the input and load the file chosen below.
filename_prefixSTRINGh3_stage2_latentPrefix for newly saved files (auto-numbered: _00001, _00002, ...).
latent_fileCOMBOSaved file to load when load_mode is ON.

Outputs (1)

NameTypeDescription
latentLATENT—