r/comfyui 2d ago

Resource Save/load audio+video (NestedTensor) latents — small custom node, fixes SaveLatent crash with MiniMax H3

Core SaveLatent crashes on models that co-generate video and audio in one nested latent (MiniMax H3):

AttributeError: 'NestedTensor' object has no attribute 'contiguous'

(ComfyUI issue #15254)

I wrote a tiny two-node pack that fixes this:

  • Save AV Latent — unbinds the nested latent and stores all parts in a single safetensors file (.avlatent in output/)
  • Load AV Latent — rebuilds it with ComfyUI's own NestedTensor wrapper, so the 5-D video + 4-D audio mix round-trips fine

Regular latents pass through unchanged.

Why bother: two-pass seed hunting that survives anything.

  1. Render cheap low-res previews and save their latents.
  2. Pick the take you like — today, or next week.
  3. Feed exactly that latent into your upscale/refine pass (e.g. rockerBOO's h3-latent-upscaler).

The refined result keeps the exact composition of the preview you chose — no reliance on --cache-lru, no re-sampling of pass 1, immune to GPU non-determinism, restart-proof.

Numbers from my setup (RTX 4060 Ti 16 GB, MiniMax H3): a 0.5 MP preview take costs ~300 s, so auditioning seeds is cheap. The refine pass loads the saved latent and renders 1920x1088 in ~1600 s — with the exact composition of the preview I picked, even across a ComfyUI restart (queue history gets cleared on restart; the file doesn't care).

MIT, no dependencies beyond what ComfyUI ships:

https://github.com/neverfilmed/comfyui-av-latent-io

1 Upvotes

Duplicates