Mpi Save Latent
Save a latent without losing your sampler (or your sanity)
- samples
- samples
- continue
Two-stage sampling is the workhorse of serious workflows: run a cheap stage 1, save the latent, then continue from it later with a higher-res or higher-quality stage 2. Core ComfyUI has a Save Latent node for exactly this, so why does MpiSaveLatent exist? Two reasons, and both are concrete.
The first: core's Save Latent chokes on the packed audio+video latents that modern video models like MiniMax H3 produce. Those come as a NestedTensor pair with no .contiguous(), and core's loader tries to flatten it - crash. This node handles the packed pair and stays byte-compatible with core's own .latent files for single tensors, so SD-family latents written here load fine in core and vice versa.
The second reason is the subtle one, and it's a real trap in ComfyUI's execution model. Save Latent is an output node, which means ComfyUI runs it on every submit, period. It then asks for its samples input, which drags the whole sampler upstream along with it - even on a run where you absolutely did not want to redo stage 1. This node's enabled flag and lazy inputs fix that: with enabled off, it never even requests samples, so the sampler feeding it is genuinely skipped.
The inputs that matter
- samples - the
LATENTto save. Lazy: only requested when the node will actually save. - filename - saved to
<output>/latents/<filename>.latent, overwriting. An absolute path is used as-is. Feed the same name toMpiLoadLatentto continue. - boolean - the continue/block gate. Labeled continue when on, block when off. On, the branch carries on past the save; off, downstream is blocked with an
ExecutionBlocker. - enabled (optional) - off means skip entirely. This is your stage-2 kill switch.
Outputs: samples (the latent, on a continue) and continue (a BOOLEAN that is never blocked, so it can drive a separate branch even when the main one stops).
Install
Part of ComfyUi-MpiNodes - install the pack and you've got it. ComfyUI Manager, search "MpiNodes" / publisher "mad-pony-interactive", or:
cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
Restart. No extra dependencies.
Where people get burned
The enabled gotcha is the one to internalize. If you leave enabled on and boolean off (block) on a run that doesn't need to save, the save still fires and the sampler still runs - you just silently waste the whole generation. On a stage-2 continue where the file is already on disk, flip enabled off or you're re-running stage 1 to overwrite the very thing you're continuing from. If you're building a two-stage graph, honestly consider MpiStageLatents, which rolls this save/block/load dance into one node with widgets for the stage switch.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| filename | STRING | mpi_stage1 | Saved to <output>/latents/<filename>.latent, overwriting. An absolute path is used as-is. Feed the same name to Mpi Load Latent. |
| boolean | BOOLEAN | false | — |
| enabledopt | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| samples | LATENT | — |
| continue | BOOLEAN | — |