Nodes/ZF-ComfyUI-Helper/ZF Load Tensor Latent Folders
ComfyUI Node

ZF Load Tensor Latent Folders

Batch-load every .pt latent in up to ten folders, in one pass

By Z-yaofang·Created 2 months ago·Updated 19 days ago· 1
ZF Load Tensor Latent Folders
    • latent_1
    • latent_2
    • latent_3
    • latent_4
    • latent_5
    • latent_6
    • latent_7
    • latent_8
    • latent_9
    • latent_10
    wan_has_reftrue
    wan_drop_lastfalse
    wan_loopedfalse
    address_1/root/Latent
    address_2
    address_3
    address_4
    address_5
    address_6
    address_7
    address_8
    address_9
    address_10

    The single .pt loader in this pack is the right tool for "load this one tensor latent." This one, LoadTensorLatentsFromFolderPath (display name "ZF Load Tensor Latent Folders"), is the batch version: it scans up to ten folders of .pt/.pth files and returns every latent in each folder as a list. If you have a directory of saved WAN latent clips you want to resample, upscale, or re-decode in bulk, this is the node that turns a folder into a single wire.

    How it maps out

    Ten folder inputs (address_1 through address_10), ten matching list outputs (latent_1 through latent_10). Fill in only the folders you need - blanks are skipped. Each filled folder is scanned for .pt and .pth files, sorted alphabetically, and every file is loaded. The loading logic is the same as the single-file sibling: a full latent dict with samples is preserved, a latent_tensor dict gets wrapped, and a bare tensor gets wrapped as {"samples": ...}. So whatever flavor of "I saved it as a pickle" your pipeline produced, you get a normal LATENT list on the other side.

    The wan_has_ref, wan_drop_last, and wan_looped booleans sit at the top and apply to every latent loaded from every folder. Defaults are True/False/False - leave them unless your video pipeline says otherwise.

    Two validation behaviors are worth knowing before you queue:

    • Every filled folder must contain at least one .pt/.pth file, or the node errors with "No tensor latent files found in folder: …". It won't silently load nothing.
    • At least one folder is required. All ten blank = error.

    The loader also hashes every file for ComfyUI's change-detection, so dropping new pickles into a folder and re-running picks them up without bypassing the node - the same nice touch as the other loaders in this pack.

    The pickle warning, unskippable

    .pt files are Python pickles, and this node loads them with weights_only=False. Pickle can execute arbitrary code on load. That's not a hypothetical - it's the standard, well-documented risk of pickle-based formats, and it's why the README calls it out in bold. Only feed this node .pt/.pth files you created yourself or that come from a source you fully trust. A random file from a stranger's drive is how people get a nasty surprise. There's no way around it if you want to load these files at all; you just have to be careful about provenance.

    Installing it

    The whole pack is dependency-free, so this is a two-liner:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Z-yaofang/ZF-ComfyUI-Helper
    

    Restart ComfyUI, or use ComfyUI Manager and search ZF-ComfyUI-Helper. No models, no requirements.txt. The node shows up under ZF Helper/Latent.

    Where it bites

    Same /root/Latent default on address_1 - that's a Linux-root path, change it to a real folder on your machine or validation fails. And remember the outputs are lists: plug them into list-aware nodes, not into a sampler's single latent input. If you only want one specific pickle, this is overkill - grab the single-file node instead.

    CategoryZF Helper/Latent

    Inputs (13)

    NameTypeDefaultDescription
    wan_has_refBOOLEANtrue
    wan_drop_lastBOOLEANfalse
    wan_loopedBOOLEANfalse
    address_1STRING/root/Latent
    address_2STRING
    address_3STRING
    address_4STRING
    address_5STRING
    address_6STRING
    address_7STRING
    address_8STRING
    address_9STRING
    address_10STRING

    Outputs (10)

    NameTypeDescription
    latent_1LATENT
    latent_2LATENT
    latent_3LATENT
    latent_4LATENT
    latent_5LATENT
    latent_6LATENT
    latent_7LATENT
    latent_8LATENT
    latent_9LATENT
    latent_10LATENT