The DJZ Load Latent V2 node is an enhanced version of the original DJZ Load Latent node. It loads latent tensors from ComfyUI's output directory with additional features for seed-based selection and a numbered reference list of available latents.
-
latent_index: A dropdown menu showing a numbered list of all available .latent files in the ComfyUI output directory and its subdirectories. The files are sorted alphabetically and displayed with index numbers for reference (e.g., "[0] filename.latent"). This list serves as a reference to see what files are available.
-
seed: An integer value that determines which latent file to load. The seed value is used to select a position in the latent file list using modulo operation (seed % number_of_files). This allows for deterministic selection of latent files based on the seed value.
- Default: 0
- Min: 0
- Max: 18446744073709551615 (0xffffffffffffffff)
The node performs the following operations:
- Scans the ComfyUI output directory recursively for .latent files
- Creates a numbered list of all available latent files for reference
- Uses the provided seed value to deterministically select a file from the list
- Loads the selected latent file using safetensors
- Applies the appropriate scaling factor based on the latent format version:
- For version 0 format: multiplier = 1.0
- For other formats: multiplier = 1.0 / 0.18215
- Returns both the formatted latent tensor and the filename of the loaded file
The node provides two outputs:
- samples: The LATENT tensor that can be used with other nodes in your ComfyUI workflow
- current_file: A STRING containing the filename of the currently loaded latent file
The node includes several safety features:
- If no latent files are found, displays "No latents found" in the dropdown
- Validates that the seed value is an integer
- If there's an error loading the latent, returns a zero tensor (1, 4, 8, 8) to prevent workflow crashes
- Prints informative messages about which file is being loaded (position and filename)
- Deterministic loading of latent files using seed values
- Creating workflows that cycle through available latents systematically
- Easy reference of available latent files with numbered list
- Tracking which file is currently being used via the filename output
- Batch processing of multiple latent files using seed iteration