Add Save/Load Latent (Absolute Path) nodes from Comfyui-save-latent

Consolidates SaveLatentAbsolute and LoadLatentAbsolute into this project
as latent_node.py. Saves and loads LATENT data to absolute file paths in
safetensors format, preserving device info and non-tensor metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 16:50:24 +01:00
parent 5f59ec34e9
commit d2f00d1141
3 changed files with 149 additions and 0 deletions

View File

@@ -282,6 +282,49 @@ Saves a WanVideo diffusion model (with merged LoRAs) as a `.safetensors` file. F
- Clones all tensors before saving to handle shared/aliased weights safely.
- Automatically avoids overwriting existing files by appending `_1`, `_2`, etc.
---
## Node: Save Latent (Absolute Path)
Saves a LATENT to an absolute file path as `.latent` (safetensors format). Found under the **latent** category.
### Inputs
| Input | Type | Default | Description |
|---|---|---|---|
| `samples` | LATENT | — | Latent samples to save. |
| `path` | STRING | `/path/to/latent.latent` | Absolute file path. `.latent` extension is appended if missing. |
| `overwrite` | BOOLEAN | `False` | If false, appends `_1`, `_2`, etc. to avoid overwriting. |
### Outputs
| Output | Description |
|---|---|
| `LATENT` | Pass-through of the input samples (for chaining). |
### Behavior
- Saves all tensor data via safetensors, with device info and non-tensor metadata stored in the file header.
- Creates parent directories automatically.
---
## Node: Load Latent (Absolute Path)
Loads a LATENT from an absolute file path. Found under the **latent** category.
### Inputs
| Input | Type | Default | Description |
|---|---|---|---|
| `path` | STRING | `/path/to/latent.latent` | Absolute path to a `.latent` file previously saved by Save Latent. |
### Outputs
| Output | Description |
|---|---|
| `LATENT` | Restored latent samples with original devices and non-tensor data. |
## Dependencies
PyTorch and safetensors, both bundled with ComfyUI.