Nodes/Duanyll Nodepack/HuggingFace CLIP Loader
ComfyUI Node

HuggingFace CLIP Loader

Pull text encoders from the HF cache by type

By Duanyll·Created about a year ago·Updated 4 months ago· 2
HuggingFace CLIP Loader
    • CLIP
    repo_id
    type
    subfoldertext_encoder
    filename

    HuggingFace CLIP Loader loads a text encoder (CLIP) from the Hugging Face cache - or a local path - and emits a CLIP object ready to feed your positive/negative conditioning. It's the specialized sibling of the pack's HuggingFace Checkpoint Loader, for when you want just the text-encoding half, and it inherits that node's defining quirk: it never downloads anything. The model must already be sitting in your local HF cache (~/.cache/huggingface), or you point it at a local folder.

    Its superpower is the type dropdown. ComfyUI's own CLIPLoader has this too, but this node inherits the full list of known CLIP types from ComfyUI's core loader - everything from stable_diffusion and sd3 to mochi, ltxv, wan, pixart, cosmos, hidream, and two dozen more. That matters because text encoders are not interchangeable: an SD3 conditioning won't work with a Wan text encoder, and ComfyUI needs to know the family to wire the CLIP output into the right downstream nodes. A wrong type quietly produces garbage conditioning instead of an error, so pick deliberately.

    The inputs

    • repo_id - a HF repo ID, absolute path, or ./relative path from the ComfyUI root.
    • type - the CLIP family, chosen from ComfyUI's standard list (25 options).
    • subfolder (optional) - defaults to text_encoder, which is where most HF repos keep their CLIP weights. Clever default.
    • filename (optional) - auto-detects; for sharded models, give the .index.json.

    One output: CLIP.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/Duanyll/duanyll_nodepack
    cd duanyll_nodepack && pip install -r requirements.txt
    

    or ComfyUI Manager → "Duanyll Nodepack" → install → restart. Needs huggingface-hub for cache resolution, which is in the pack's requirements.

    Using it without tripping over it

    The pattern mirrors the checkpoint loader: run hf download <repo_id> first, then wire the node. One genuine advantage over stock ComfyUI: because it reads the HF cache, you can load a text encoder without moving files into ComfyUI's models/clip folder - a real convenience if you already maintain an HF cache for other tooling. Just be honest about the tradeoff: the first-run error message ("Run hf download first") can feel like a broken node if you missed the cache-only design. And if you need the encoder plus the diffusion model plus a VAE, the pack's HfCheckpointLoader or HfDiffusionModelLoader gives you more in one node - use this one when a workflow needs the text encoder in isolation, or a nonstandard encoder type the combined loaders can't handle.

    Categoryduanyll/loaders

    Inputs (4)

    NameTypeDefaultDescription
    repo_idSTRING
    typeCOMBO25 options: stable_diffusion, stable_cascade, sd3, stable_audio, mochi, ltxv, +19
    subfolderoptSTRINGtext_encoderThe subfolder where the model is located. Applies to both Hugging Face repos and local paths.
    filenameoptSTRINGThe checkpoint file to load. If not specified, will auto-detect. For sharded checkpoints, use the index file (e.g., 'model.index.json').

    Outputs (1)

    NameTypeDescription
    CLIPCLIP