Save Latent (Numpy)
Save a latent to disk and get the filename back
- samples
- filename
Most Save nodes in ComfyUI are pure dead ends - a file lands on disk and nothing comes back out. SaveLatentNumpy is the exception in this pack: it writes your latent to a .npy file (a plain numpy array in the standard torch layout, per the README) and hands you back the filename it used as a string output. That's not an accident - it's exactly what ComfyUI_NetDist's cross-instance latent recipe needs, since you're meant to take that filename and string-replace it straight into a URL for LoadLatentUrl on the other side, or just note it down to pull later with LoadLatentNumpy.
How it works
It's an output node like any Save node, but with one extra wire coming out. The write itself is the write side of the pack's "remote latents" system described in the README - a .npy file goes into your output folder, and unlike the image side (SaveImageUrl), this one does touch disk, since the whole point is for something else - another instance, or you later - to go find that file.
The inputs and outputs that matter
samples(LATENT, required) - the latent to save.filename_prefix(STRING, defaultlatents/ComfyUI) - nests saves under alatents/subfolder in your output directory, the same conventionSaveDiskWorkflowJSONuses for its ownworkflow/subfolder.
Output: filename (STRING) - the actual filename used, ready to feed into a string-replace node ahead of LoadLatentUrl's URL template.
How to install it
Via ComfyUI Manager: search ComfyUI_NetDist. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/city96/ComfyUI_NetDist
pip install requests
Restart ComfyUI. requests is the whole pack's only dependency.
Common issues & troubleshooting
Trying to load the saved file somewhere else and it doesn't read. Make sure whatever you're loading it with expects .npy specifically - don't confuse it with the sd_scripts .npz cache format that LoadLatentNumpy also happens to support; they're different containers despite both starting with "np," and a loader expecting one won't parse the other.
Files accumulating in the latents/ folder. Nothing here gets cleaned up automatically, same as any other Save node - if you're saving latents routinely as part of a NetDist workflow, that folder will grow, and pruning it is on you.
Using the filename output. If you're not doing the string-replace-into-a-URL trick, the filename output is easy to leave dangling - that's fine, it's optional to actually use, the save happens regardless of whether anything reads the output.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| filename_prefix | STRING | latents/ComfyUI | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filename | STRING | — |