Nodes/Duanyll Nodepack/HuggingFace LoRA Loader
ComfyUI Node

HuggingFace LoRA Loader

Load a LoRA From a Hugging Face Repo, No Copying Into Models/Loras

By Duanyll·Created about a year ago·Updated 4 months ago· 2
HuggingFace LoRA Loader
  • model
  • clip
  • MODEL
  • CLIP
repo_id
strength_model1.00
strength_clip1.00
subfolder
filename

ComfyUI's LoraLoader only sees files sitting in models/loras. But a huge share of LoRAs live in Hugging Face repos, and after hf download they're already in your cache - just not where ComfyUI looks. HfLoraLoader closes that gap: point it at a repo (or any local path), set your strengths, and it applies the LoRA to both the diffusion model and the CLIP in one shot.

It's the LoRA member of the pack's HF loader family, and it uses the exact same engine as the CLIP loaders: resolve the HF cache snapshot (or local path), auto-detect the checkpoint, merge shards if needed, and apply. Same mental model, different payload.

How it works

The core call is Comfy's load_lora_for_models(model, clip, state_dict, strength_model, strength_clip) - the same function the built-in LoRA loader uses. So the result behaves identically: a patched MODEL and a patched CLIP that slot straight into your existing graph, with the usual negative-strength option if you want to de-emphasize instead.

What's different from the core loader is only where the file comes from. No need to move LoRAs between your HF cache and models/loras; no need to fight folder conventions. Type the repo ID, done.

Inputs and outputs

  • model / clip - the diffusion model and text encoder the LoRA applies to (from your checkpoint or loaders). The tooltip spells it out: "the diffusion model/CLIP the LoRA will be applied to."
  • repo_id - the HF repo, absolute path, or ./relative path holding the LoRA. This is the field you actually type.
  • strength_model / strength_clip - how hard to apply (default 1.0, range −100 to 100). The classic gotcha from the LoRA world applies here too: LoRAs are architecture-bound, so an SDXL LoRA on a Flux model does nothing useful no matter the strength.
  • subfolder / filename - optional; defaults auto-detect the file, override when a repo holds several LoRAs.

Outputs are MODEL and CLIP, ready to wire onward.

Installing it

Part of Duanyll Nodepack:

cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack

or via ComfyUI Manager, then restart. Requires huggingface-hub and safetensors (both in the pack's requirements).

Where people get burned

The recurring family trap applies fully: the node reads your HF cache, it doesn't download. The description says "Downloads a model from Hugging Face," but the code raises FileNotFoundError with Run \hf download <repo>` first` when the repo isn't cached. So:

hf download some-user/some-lora-repo

Second, remember the architecture rule: a LoRA trained for SDXL won't port to Flux (or vice versa), and this loader won't stop you - it'll happily apply a mismatch and give you a model that looks wrong. And if a repo has several .safetensors files and you leave filename blank, the node refuses to guess; name the file explicitly. For LoRAs already in models/loras, the built-in LoraLoader remains the zero-friction choice - this node is specifically for the cache/repo case.

Categoryduanyll/loaders

Inputs (7)

NameTypeDefaultDescription
modelMODELThe diffusion model the LoRA will be applied to.
clipCLIPThe CLIP model the LoRA will be applied to.
repo_idSTRINGThe Hugging Face repo ID, an absolute path (/path/to/model), or a relative path (./models/...) from the ComfyUI root.
strength_modelFLOAT1.00-100–100How strongly to modify the diffusion model. This value can be negative.
strength_clipFLOAT1.00-100–100How strongly to modify the CLIP model. This value can be negative.
subfolderoptSTRINGThe 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 (2)

NameTypeDescription
MODELMODEL
CLIPCLIP