Nodes/ComfyUI-JNodes/Diffusion Model Selector + String
ComfyUI Node

Diffusion Model Selector + String

Pick or randomize a UNET by seed

By JaredTherriault·Created 3 years ago·Updated about a month ago· 91
Diffusion Model Selector + String
    • unet_name
    • STRING
    unet_name
    mode
    seed0

    This node picks which diffusion model (UNET) to load - but with a twist the built-in loader doesn't give you: it can choose randomly based on a seed, or step through your models by index. So instead of manually swapping the model dropdown every time you want to compare checkpoints, you let the seed pick one for you, and the same seed always lands on the same model. It also spits out the chosen name as a plain string, so you can stamp "which model made this" into your image metadata or filename automatically.

    The obvious use is model roulette - batch a run across your whole diffusion-model folder to see which one nails a prompt, with the seed driving the choice so it's reproducible. The quieter use is provenance: pair the string output with a metadata or filename node and every output records the model that made it, no manual bookkeeping. It's one of a family of JNodes "selector + string" nodes (checkpoint, VAE, sampler, scheduler) that all work this way.

    How it works

    It reads your installed diffusion models - the ones a standard UNET/diffusion-model loader would list - and, depending on mode, either returns the one you picked, one chosen from the seed, or one at a positional index. The primary output is the model name, typed to plug directly into a diffusion-model loader's input; the second output is that same name as a string for logging. Note the node hands you the name to feed a loader, not the loaded model itself - wire its unet_name output into a loader node, then take the model from there.

    The inputs and outputs that matter

    • unet_name - the model dropdown, populated from your diffusion-models folder. In select mode this is your manual pick.
    • mode - select (use the dropdown), seed (pick from the seed, reproducibly), or index (walk the list positionally, e.g. one per run across a batch).
    • seed - drives the choice in seed mode. Share it with your sampler's seed to keep the run coherent, or give it its own so the model varies independently.

    Outputs:

    • unet_name - the chosen model name, typed for a diffusion-model loader's input.
    • STRING - the same name as text, for metadata, filenames, or a display.

    How to install it

    ComfyUI Manager, search JNodes, install, restart. Or:

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

    No models ship with the pack - this node lists the diffusion models you've already got in ComfyUI/models (in whichever folder your loader reads).

    Common issues & troubleshooting

    The dropdown is empty. The node populates from your diffusion-models directory. If it's blank, you have no UNET/diffusion-model files where ComfyUI looks - this node lists models, it doesn't download them. Put some in the right folder and refresh.

    It picks a different model every run when I wanted one fixed. You're in seed mode with a changing seed. Switch to select and set the dropdown, or lock the seed to reproduce a specific pick.

    The output won't plug into my KSampler. Right - this outputs a model name, not a loaded MODEL. Route unet_name into a diffusion-model loader first; the loader gives you the MODEL the sampler wants.

    New model doesn't appear. ComfyUI caches the folder listing. Refresh the browser (or restart) after dropping a new file in so the selector sees it.

    Categorysd

    Inputs (3)

    NameTypeDefaultDescription
    unet_nameCOMBO0 options:
    modeCOMBO3 options: select, seed, index
    seedINT0

    Outputs (2)

    NameTypeDescription
    unet_name
    STRINGSTRING