Nodes/Comfyui-LoraUtils/Merge LoRA to Model
ComfyUI Node

Merge LoRA to Model

Finally patch your checkpoint with that edited LoRA

By lrzjason·Created 11 months ago·Updated 5 months ago· 32
Merge LoRA to Model
  • model
  • lora
  • clip
  • MODEL
  • CLIP
strength_model1.00
strength_clip1.00

Every node in this pack up to this point has been preparation. Load LoRA Only reads the file. LoRA Layers Operation, Lora Add, and friends mutate the raw tensors. Merge LoRA to Model is where all that preparation finally touches a real checkpoint: it takes your modified LoRA state dict and patches it into the diffusion model and CLIP, producing the same kind of MODEL / CLIP pair you'd get from a stock LoraLoader.

Under the hood it's a thin wrapper around ComfyUI's own comfy.sd.load_lora_for_models - the exact same machinery the built-in loader uses. That's worth knowing for two reasons. One, it means the merge is battle-tested; you're not betting on hand-rolled LoRA math. Two, it means everything you know about how ComfyUI applies LoRAs applies here: the LoRA patches the frozen checkpoint weights at load time, and it's architecture-bound, so a Flux LoRA merged into an SDXL model produces noise, not art.

The inputs: model (from your checkpoint or UNET loader), lora (the LORA output of anything upstream in this pack), and strength_model (default 1.0, range −10 to 10). clip and strength_clip are optional - pass a CLIP in and the LoRA's text-encoder half gets applied too, skip it and only the diffusion model is touched.

Three things to actually use, not just acknowledge:

  • Negative strengths are the inverse-LoRA trick. Set strength_model to −1 and you're subtracting the LoRA's contribution instead of adding it. Useful for counteracting a baked-in style you regret, though results vary - it's a hack, not a science.
  • You can skip CLIP entirely. If the LoRA has no text-encoder keys, or you just don't want to touch it, leave clip unwired and the node applies model-only. Real gotcha: when you do that, the CLIP output isn't a usable model - don't wire it downstream, or your next node will choke on a None.
  • Keep the strength here, not in the loader. Load LoRA Only can scale tensors too, but its scaling touches everything in the file including alpha metadata. Do your fine strength tuning on this node, where ComfyUI's loader math does the right thing.

A subtle strength: this is also the node that makes the separation philosophy pay off. Because loading, editing, and applying are separate steps, you can save an edited LoRA, reload it, apply it at three different strengths across three branches - or apply the same raw LoRA to a model and its distilled variant in parallel. Stock ComfyUI can't do that without re-loading the file per branch.

On the troubleshooting side, the community's standard LoRA advice all still applies: if the output looks wrong, check the base-model match first, then the trigger word, then whether stacking order is fighting you. And when a merge or an edit goes sideways, the fastest diagnostic is the classic one - run the same seed with and without the LoRA and see what changed.

Installing the pack is the usual two minutes, no new dependencies (this node leans on ComfyUI's own loader, so torch and safetensors are all it needs):

cd ComfyUI/custom_nodes
git clone https://github.com/lrzjason/Comfyui-LoraUtils

Restart ComfyUI and you'll find it under LoraUtils. ComfyUI Manager users can search Comfyui-LoraUtils. It's a small pack by lrzjason (a.k.a. xiaozhijason on Civitai) with a modest footprint - the wrapper design here is the safe part of this pack, so if you're trying this family for the first time, this is a reassuring node to start with.

CategoryLoraUtils

Inputs (5)

NameTypeDefaultDescription
modelMODELThe diffusion model to apply the LoRA to.
loraLORAThe loaded LoRA to apply.
strength_modelFLOAT1.00-10–10How strongly to modify the diffusion model. This value can be negative.
clipoptCLIPThe CLIP model to apply the LoRA to (optional).
strength_clipoptFLOAT1.00-10–10How strongly to modify the CLIP model. This value can be negative.

Outputs (2)

NameTypeDescription
MODELMODELThe modified diffusion model.
CLIPCLIPThe modified CLIP model.