ComfyUI Node

UNet Name

A Clean Dropdown for Diffusion Models, and a String Out

By lihaoyun6·Created 12 months ago·Updated 13 days ago· 20
UNet Name
    • unet_name
    unet_name

    The diffusion model loader gives you a patched MODEL, not the filename. UNet Name (class UNETName) is the lhyNodes utility that fills that gap: a dropdown of every model in your models/diffusion_models folder, and the only thing it outputs is the name you picked, as a string.

    Why does that matter? Because the moment you want the name of the model you used - in a filename, a prompt template, a log line, or a metadata string - the loader can't give it to you. ComfyUI's type system keeps MODEL and text strictly apart, so without a node like this you'd retype flux1-dev-fp8.safetensors everywhere it needs to appear. Wire UNetName's output into a String Format node and the name flows into your save prefix automatically; change the model in the dropdown and every downstream string updates with it. One source of truth, no transcription errors.

    Mechanically it's trivial and that's the point: the input is an enum generated from folder_paths.get_filename_list("diffusion_models"), and the function returns the selected string. The output is typed *, so it plugs into any text-accepting socket.

    The inputs that matter

    • unet_name - the dropdown of files in models/diffusion_models. That's it.

    Output: unet_name, the selected filename as a string.

    A distinction worth knowing

    The dropdown reads diffusion_models specifically, not checkpoints. For the big all-in-one checkpoint files (model + CLIP + VAE in one), you want the pack's sibling CheckpointName node; UNETName is for the standalone diffusion-model files - the Flux/SD3/Hunyuan-style UNets and LoRA-patched architectures that sit in diffusion_models. If your model isn't showing up in the dropdown, that's the first thing to check: it's in the wrong folder, or you're looking for a checkpoint and grabbed the wrong sibling node.

    This is one of a matching set in the pack - LoraName, VAEName, CLIPName, ControlNetName, UpscaleModelName all do the identical trick for their own folders. Learn one, you know them all. And like the rest of the set, it pairs beautifully with the pack's String Format node for auto-named outputs.

    Installing it

    Part of lhaoyun6/ComfyUI-lhyNodes. Install via ComfyUI Manager by searching for lhyNodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lihaoyun6/ComfyUI-lhyNodes.git
    python -m pip install -r ComfyUI-lhyNodes/requirements.txt
    

    Restart ComfyUI. The pack's shared requirements are ultralytics, opencv-python, numpy, and yarl; this node needs none of them and downloads no models.

    It's a small thing that quietly removes a whole class of "which model did I use again?" confusion. If you build workflows you'll reuse, spend the two minutes to wire it in once.

    CategorylhyNodes/Utils

    Inputs (1)

    NameTypeDefaultDescription
    unet_nameCOMBOThe name of the U-Net.

    Outputs (1)

    NameTypeDescription
    unet_name*