Nodes/ComfyUI-JDCN/JDCN_BatchLatentLoadFromList
ComfyUI Node

JDCN_BatchLatentLoadFromList

Re-open your saved latents from a path list, a page at a time

By daxcayΒ·Created 2 years agoΒ·Updated about a year agoΒ· 159
JDCN_BatchLatentLoadFromList
    • Latents
    • LatentNames
    • LatentPaths
    • Index
    β—„PathListβ€”β–Ί
    β—„Index1β–Ί
    β—„BatchSize5β–Ί
    β—„BatchDirectionβ–Ύβ–Ί

    JDCN_BatchLatentLoadFromList is the paged sibling of JDCN_BatchLatentLoadFromDir: same idea - reload latents saved by this pack to skip re-encoding - but instead of pointing at a folder, it takes a list of paths and loads them in batches. If you're processing a big latent library a few files at a time across multiple queue runs, this is the node.

    How it works

    Four inputs, mirroring the image-list loader:

    • PathList - the latent paths to load from (list-input).
    • Index - which batch to load, 1-based. It's a page number, not an element offset. With BatchSize = 2 over a 4-item list, Index = 1 returns items 1–2, Index = 2 returns 3–4. The pack's docs spell this out explicitly with an a/b/c/d example - it's the single most misunderstood thing in these list loaders.
    • BatchSize - items per batch.
    • BatchDirection - TOPTOBOTTOM, BOTTOMTOTOP, or RANDOM (random sample of BatchSize from the list).

    Outputs: Latents (the loaded tensors), LatentNames, LatentPaths (for just this batch), and Index echoed back.

    How to use it

    The natural pipeline: JDCN_AnyFileList (filter tensors / .latent) β†’ PathList β†’ this node β†’ sampler. Bump Index per run to chew through the library a page at a time. Or chain it after JDCN_AnyFileSelector if you want to hand-pick a specific latent rather than paging. RANDOM is nice for grabbing a random page of latents for variation runs.

    Only .latent files written by JDCN_BatchSaveLatent are guaranteed to load correctly - the format is this pack's own save_torch_file layout. Don't point it at arbitrary checkpoint or diffuser latents and expect clean results.

    Installing it

    Part of ComfyUI-JDCN:

    • ComfyUI Manager β†’ Install Custom Node β†’ search JDCN β†’ install ComfyUI-JDCN β†’ restart.
    • Or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/daxcay/ComfyUI-JDCN.git
    cd ComfyUI-JDCN
    pip install -r requirements.txt
    

    Restart; under πŸ”΅ JDCN πŸ”΅. Only dependency is piexif, no models.

    Common issues

    Same empty-batch-when-past-the-end behavior as the image version - Index beyond the list returns nothing, not an error, so if you see empty latents, check your page number. BatchSize = 0 selects nothing meaningful. And the usual VAE rule applies on decode: the checkpoint you sample with needs to match what produced the latents, or colors will be off. Verify one page loads and decodes correctly before running the whole library.

    One more: because the node reads from a list, make sure the list is actually full paths with directory prefixes. A list of bare filenames will fail to resolve - the PathList from JDCN_AnyFileList is already correct, which is why that pairing is the smoothest path.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (4)

    NameTypeDefaultDescription
    PathListSTRINGβ€”
    IndexINT11–9999β€”
    BatchSizeINT50–9999β€”
    BatchDirectionCOMBO3 options: TOPTOBOTTOM, BOTTOMTOTOP, RANDOM

    Outputs (4)

    NameTypeDescription
    LatentsLATENTβ€”
    LatentNamesSTRINGβ€”
    LatentPathsSTRINGβ€”
    IndexINTβ€”