ComfyUI Node

Save Condition

Freeze a prompt embedding to disk and never re-encode it

By lrzjason·Created about a year ago·Updated about a year ago· 13
Save Condition
  • condition
    filenamecondition_tensor

    The CONDITIONING wire that runs from a CLIP Text Encode node into your sampler is a product - the text embedding plus extras like pooled_output, all bundled as a list of (tensor, cond_info) tuples. Usually you recompute it every run and never think about it. SaveCondition is the node that lets you stop: it writes that whole structure to a .ckpt file in ComfyUI/models/conditions, so a future workflow can load it back with LoadCondition and skip the encoder entirely.

    When does that actually matter? A few cases. You've spent an hour tuning one long prompt and don't want to re-type it into every workflow you share. Or you're queuing a big batch where the encode cost adds up. Or you want to hand someone a condition without handing them your prompt text - save it, send the file, done. It's also handy as a consistency trick: lock the exact same conditioning across many runs so prompt drift can't sneak in.

    How it works

    It's an output node, which is ComfyUI-speak for "terminal node that doesn't pass data on" - SaveCondition has no outputs and ends the line. Feed it any CONDITIONING, give it a name, and it clones the tensors, then torch.saves the tuple list to ComfyUI/models/conditions/<name>.ckpt. The .ckpt extension is added automatically. It also sanitizes the filename with basename, so you can't path-traverse your way into writing files elsewhere - though that means a name like subfolder/my_condition silently becomes my_condition, which can surprise you.

    The models/conditions folder is created on the fly if it doesn't exist, and it's registered with ComfyUI's folder_paths system so the sibling LoadCondition can list it as a dropdown.

    The inputs

    Just two:

    • condition - the CONDITIONING tensor to save. Wire it from any CLIP Text Encode (positive or negative), or from whatever conditioning-modifying nodes you have downstream.
    • filename - a string, defaulting to condition_tensor. Whatever you type becomes the saved file's name. Extensions are handled for you.

    Gotchas worth knowing

    • No overwrite warning. Save to a name that already exists and it quietly replaces the file. Your old condition is gone.
    • It's a pickled torch object, not a shareable model. The condition is tied to the exact text encoder that produced it. Save it from an SDXL workflow and it's an SDXL condition, forever; feeding it to a Pony or Flux workflow is asking for a shape mismatch or garbage. This is a save-and-load-within-one-model-family tool.
    • Nothing is written until the run executes. You can build the node and save the workflow, but the file only appears after you actually queue a run.

    Installation

    Either clone it into your custom nodes directory:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lrzjason/Comfyui-Condition-Utils
    

    then restart ComfyUI, or search "Comfyui-Condition-Utils" in ComfyUI Manager. It shows up under conditioning/utils. No dependencies beyond ComfyUI's own torch and folder_paths, and no models to download - the pack is one person's utility, small and dependency-free.

    Honest verdict: you don't need this node until you do. When you're in the "reuse this exact prompt embed everywhere" situation, it's the missing half of the puzzle - just remember the LoadCondition on the other end.

    Categoryconditioning/utils

    Inputs (2)

    NameTypeDefaultDescription
    conditionCONDITIONING
    filenameSTRINGcondition_tensor

    Outputs (0)

    No outputs