Nodes/ComfyUI_AutoDownloadModels/Get Models From Workflow
ComfyUI Node

Get Models From Workflow

Turn any workflow JSON into a shopping list of models to download

By AIExplorer25·Created about a year ago·Updated about a year ago· 21
Get Models From Workflow
    • pa
    workflow_path
    models_folder_path/workspace/ComfyUI/models/

    Here's the workflow problem nobody likes admitting: half the time a downloaded workflow won't run, it's not the code - it's the models. Someone shared a graph that references fourteen .safetensors files, and you have to figure out which ones you're missing, what folders they belong in, and where to get them. Get Models From Workflow is the pack's attempt to automate the first two of those: it reads a workflow JSON, pulls out every model filename it can find, guesses which models folder each one belongs in, and hands you a machine-readable shopping list.

    It doesn't download anything itself. Its output is designed to feed straight into the pack's AutoDownloadALLModels node, which does the actual downloading. Think of this one as the brains of the operation and AutoDownloadALLModels as the hands.

    How it works

    You give it two strings:

    • workflow_path - path to a .json workflow file on disk (the kind ComfyUI saves from the menu).
    • models_folder_path - where your models folders live, defaulting to /workspace/ComfyUI/models/. Note the default: that's the cloud convention. On a local install, set it to your real ComfyUI/models directory or the folder-detection step can't see what exists.

    Internally it scans the JSON for model filenames in two places: the per-node properties.models list (used by newer ComfyUI loaders) and any widget values ending in a known model extension (.safetensors, .ckpt, .pth, .pt, .bin, .onnx, and friends). Then - this is the clever, slightly unhinged part - for each model it dumps the whole node's JSON and uses fuzzy string matching (rapidfuzz) to decide which of the standard folders (unet, vae, clip, loras, controlnet, etc.) that node belongs to. So a model inside a VAE loader node scores high on "vae" and gets mapped there.

    The output is a pa string of mappings in the pack's format: (modelname.safetensors~~~foldername) entries, comma-joined.

    The honest caveat: it's a guess

    The folder assignment is a heuristic, and heuristics guess wrong. If the fuzzy match finds nothing convincing, the node defaults the folder to checkpoints - which means a missing VAE can get labeled as a checkpoint and downloaded to the wrong place. It also grabs every model filename it finds, even ones you already have. Treat its output as a starting point, not gospel: eyeball the mapping list before you let it run, and fix any obviously-wrong folder names.

    Wiring it up

    The intended chain is short and you can see the whole loop:

    1. GetModelsFromWorkflow reads your workflow → mapping string.
    2. Optionally pass that through ShowModelsAndFolderMappings to eyeball the list.
    3. Feed the mapping string into AutoDownloadALLModels, which searches HuggingFace for each filename and downloads it into the mapped folder.

    Install

    Pack-wide, as always: ComfyUI Manager → search ComfyUI_AutoDownloadModels → install, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/AIExplorer25/ComfyUI_AutoDownloadModels
    cd ComfyUI_AutoDownloadModels
    pip install -r requirements.txt
    

    then restart. The rapidfuzz dependency (the pack's fuzzy-matcher) comes along with it.

    When to use it

    If you're provisioning a machine from someone else's workflow and the model list is long, this genuinely saves time - the alternative is opening the JSON by hand and cross-referencing filenames against HuggingFace. If you're downloading two models, just use the pack's plain AutoDownloadModels node and skip the chain. And if the mapped folders look wrong, remember the fix is one edit in the mapping string before it hits the downloader. The pipeline is rough, but for a "feed me a workflow, get me running" tool it does the job.

    CategoryDownloadModel

    Inputs (2)

    NameTypeDefaultDescription
    workflow_pathSTRINGEnter path of your workflow
    models_folder_pathSTRING/workspace/ComfyUI/models/Enter path of your workflow

    Outputs (1)

    NameTypeDescription
    paSTRING