ComfyUI Node

LoadLatent_AS

Load a latent straight from a .pt file — if you know where to look

By flyingshutter·Created 3 years ago·Updated about a year ago· 8
LoadLatent_AS
    • LATENT

    LoadLatent_AS loads a latent from disk and hands it back as a LATENT you can continue working with. On the surface that sounds useful - persist a latent, pick it up in another workflow. The reality is a lot more limited, because this node hardcodes everything: it loads a file literally named latent.pt from ComfyUI's working directory, with no filename field, no path picker, and no options at all.

    It's the companion to SaveLatent_AS in flyingshutter's As_ComfyUI_CustomNodes pack - a dependency-free playground collection where "playground" is doing real work in this description.

    How it works

    The node runs torch.load('latent.pt') and returns the result as a LATENT. That's the entire mechanism. A latent saved with torch.save is just a Python dictionary (the samples tensor plus metadata), and torch.load reads it straight back. There's no file browser, no type checking, no error handling - if latent.pt isn't there, the node throws a FileNotFoundError and the run dies.

    The inputs

    None. This node has no inputs at all - the required set is empty, and there are no optional inputs either. You can't tell it which file to open. It loads latent.pt, full stop. Output is a LATENT.

    The big gotcha: where the file lives

    Because the filename is relative, it resolves against ComfyUI's current working directory - wherever you launched ComfyUI from, not the models folder, not the output folder. On a portable Windows install that might be something like ComfyUI_windows_portable\ (the source code even has a commented example pointing at e:/portables/ComfyUI_windows_portable/latent.pt). The practical upshot: SaveLatent_AS and LoadLatent_AS must run from the same working directory, and if you launch ComfyUI from a different folder later, "load my latent" silently becomes "file not found."

    Where you'd use it

    Honestly? It's for the author's own experiments - save a latent mid-pipeline, close everything, and load it back to keep poking. If that's your workflow, this works. But for most people, ComfyUI's built-in latent save/load (or simply keeping the whole graph in one workflow) is more robust, and if you want persistent latents with a proper file picker, other packs do this far better. This node is the "I know exactly what file I want and it's always named latent.pt" approach.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/flyingshutter/As_ComfyUI_CustomNodes
    

    Restart ComfyUI and it's under ASNodes (or ComfyUI Manager → "As_ComfyUI_CustomNodes"). No extra dependencies.

    Common issues

    • FileNotFoundError on load. You saved a latent, restarted ComfyUI from a different directory, and now it can't find latent.pt. That's the hardcoded relative path biting you - launch from the same working directory, or check that the file exists where you think it does.
    • Overwriting by accident. Because the name is fixed, SaveLatent_AS overwrites your previous latent.pt every time. There's no versioning. Save what you care about elsewhere if it matters.
    • Expecting a file picker. There isn't one. If you need to choose files, this isn't your node.

    It's a two-line utility with a hardcoded name. Works as advertised for its narrow case; don't build a whole persistent-latent system on it.

    CategoryASNodes

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    LATENTLATENT