Nodes/ComfyUI-aihub-workflow-exposer/AIHub Expose Project Latent
ComfyUI Node

AIHub Expose Project Latent

Load a stored latent file from the project — complete with the VAE scale fix

By otavanopisto·Created about a year ago·Updated 22 days ago· 7
AIHub Expose Project Latent
    • LATENT
    idexposed_latent
    file_namelatent.safetensors
    batch_index
    optionalfalse

    AIHub Expose Project Latent loads a stored latent tensor file out of the project and hands it to your workflow as a LATENT - no VAE encode round-trip, no pixels involved. This is the node for projects that keep intermediate results in latent space on purpose, and the pack's own example is video: for something like LTXV's step-by-step generation, storing latent files is far more reasonable than decoding frames to images and back between workflows.

    The project setup is the usual one - a workflow has a project when its AIHubWorkflowController sets a project_type and the project is initialized; the client manages the files. This node asks the client for the latent file (default latent.safetensors), the server injects the resolved path, and the node loads it.

    What you set

    • file_name - the latent file as stored, extension included.
    • batch_index - if the file belongs to a batch, pick one by index; a single integer, and negatives count from the end, Python-style.
    • optional - true means a missing file yields a null instead of aborting.
    • id - protocol field id.

    Output is just LATENT, ready to feed a sampler or a VAE decoder.

    The detail that shows this pack reads its own code

    When the node loads the file, it does something subtle: it checks for a latent_format_version_0 key in the safetensors file, and if it's not there, it multiplies the samples by 1 / 0.18215. That 0.18215 constant is the SD1.5/SDXL VAE scaling factor. So a latent saved by older tooling gets unscaled back to the value range samplers expect, while latents carrying the format marker are left as-is. In practice: don't be alarmed if a latent you wrote out with plain SD1.5-era code comes back looking different from how you saved it - that's this node undoing the standard scaling. If latents look wrong downstream, the format marker (or its absence) is the thing to check.

    Install & gotchas

    Standard pack install: ComfyUI Manager → search ComfyUI-aihub-workflow-exposer, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
    

    then restart. No requirements.txt, no model downloads.

    Beyond the project-context gotcha (no project → no file), the real constraint is the same one that hits AIHubExposeLatent: latents are model-family-specific. A latent saved for one VAE won't silently work in a sampler expecting another's shape or scale. If you're chaining workflows through stored latents, keep them within the same model family - the node can fix scaling constants, but it can't fix "wrong latent for this model."

    Categoryaihub/expose

    Inputs (4)

    NameTypeDefaultDescription
    idSTRINGexposed_latentA unique custom id for this workflow.
    file_nameSTRINGlatent.safetensorsThe name of the latent file as stored in the project files, including extension
    batch_indexSTRINGIf the file belongs to a batch, the index of the latent to load, it must be a single integer, and it can be negative to count from the end
    optionalBOOLEANfalseIf set to true, it will not raise an error if the latent is not found

    Outputs (1)

    NameTypeDescription
    LATENTLATENT