Nodes/DJZ-Nodes/DJZ Load Latent
ComfyUI Node

DJZ Load Latent

Pick up where you left off in latent space — no decode-encode round trip needed

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 80
DJZ Load Latent
    • LATENT
    latent_file

    ComfyUI gives you a SaveLatent node that writes the raw latent tensor - the compressed representation the diffusion model actually works in - to a .latent file. DJZ Load Latent is the other half of that pair: it reads those files back out of your output directory and hands the tensor straight to your graph as a LATENT. No VAE decode, no re-encode, no quality loss. You just pick up exactly where a previous run left off.

    Why you'd reach for it

    The whole point is skipping the decode/encode round trip. Every trip through the VAE is a lossy cycle - the KB's latent-space notes make the point that staying in latent space is the way to avoid compounding that loss. So when you want to continue refining a generation, feed a latent back in instead of an image, or build a workflow that starts from a previously-sampled result rather than a fresh EmptyLatentImage.

    The second use case is batch iteration: generate a bunch of latents in one workflow, then process or animate from them in another without dragging the decoded images around.

    How it works

    On load, the node:

    1. Scans ComfyUI's output directory recursively for .latent files.
    2. Loads the selected file via safetensors.
    3. Applies a scaling multiplier depending on the latent format version: 1.0 for version-0 files, and 1.0 / 0.18215 for everything else.

    That 0.18215 is the classic SD/SDXL VAE scaling convention - the number that puts raw VAE output into the range the sampler expects. The version check is there so v0-era files (already-scaled) aren't scaled twice.

    The input that matters

    There's exactly one: latent_file, a dropdown populated from every .latent file it finds in your output tree, sorted alphabetically. If the folder is empty, the dropdown is empty - that's the node's way of telling you to run SaveLatent first.

    Output

    A single LATENT (samples), ready to plug into a KSampler, an img2img-style LatentDenoise, or any node that accepts latent input.

    Installing it

    This is one node in the DJZ-Nodes pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MushroomFleet/DJZ-Nodes
    cd DJZ-Nodes
    pip install -r requirements.txt
    

    Or ComfyUI Manager → search "DJZ-Nodes" → install. No models to download for this node.

    Troubleshooting

    • Dropdown is empty. No .latent files in your output directory. Save one first - wire a SaveLatent node after your sampler and run it once.
    • You get noise instead of your image. The latent carries its VAE family implicitly. A latent saved from an SD/SDXL pipeline won't decode correctly under a different VAE convention, and this node's 1/0.18215 scaling assumes that family. If your output looks like static, the file wasn't produced by a compatible model.
    • A workflow that should fail doesn't. If the file can't be loaded, the node returns a zero tensor shaped (1, 4, 8, 8) so the graph doesn't crash - which means you can silently generate garbage. If something looks wrong, check the console; it prints a clear message when it had to bail.
    CategoryDJZ-Nodes

    Inputs (1)

    NameTypeDefaultDescription
    latent_fileCOMBO1 options:

    Outputs (1)

    NameTypeDescription
    LATENTLATENT