Model Merger (Advanced)
The general model merger — every other one is sugar
- model_a
- model_b
- gradient
- model_mask
- MODEL
If you use one merger from ComfyUI-DareMerge, make it this one - because every other UNet merger in the pack is just this node with a gradient pre-wired for you. Model Merger (Advanced) is the general-purpose engine: two models in, a LAYER_GRADIENT in, and it merges them where the gradient says to. The Block, MBW, and gradient nodes exist so you don't have to build that gradient by hand, but they all bottom out here.
What's a layer gradient? In this pack it's a dict of merge ratios, one per layer of the model. 1.0 for a layer means keep 100% of model A's weight there; 0.0 means keep 100% of model B's. Anything between is a blend. That's the whole language of the pack - Block Gradient gives you six coarse ratios, Attention Gradient lets you weight norm/attention/feed-forward separately, Gradient Edit lets you reach in and change individual layers, and Gradient Operations lets you combine two of those into one. They all produce the same thing: a LAYER_GRADIENT you hand to this node.
How it works
The merge itself is unglamorous and fast: for each parameter tensor in the model, it looks up the layer's ratio from the gradient, applies an optional MODEL_MASK (masked-out parameters are pinned to model A's values), blends A and B, and installs the result as a patch on a clone of A. The method dropdown is the fun part - 12 options, borrowed from the MergeMonster and FreeU Advanced projects:
comfy(default) - the merged tensor is applied as a patch with strength tied to the ratio.lerp,slerp,bislerp,hslerp,cosine,cubic,colorize- different interpolation curves.slice,cyclic,gradient- exotic blends that mix the tensors along their width rather than uniformly.scaled_add- additive blending.
For a first merge, leave it on comfy. The exotic methods are for when you've exhausted the normal ones and want to get weird with it.
The inputs that matter
- model_a, model_b - your two checkpoints.
- gradient - the
LAYER_GRADIENT. Start with a Block Gradient (six sliders) or an Attention Gradient (norm/attn/ff weights). - method - leave
comfyuntil you know why you'd change it. - model_mask (optional) - restrict the merge to specific parameters. This is where Magnitude Masker enters: build a mask that protects model A's biggest weights and the merge won't touch them.
The output
A MODEL - the merged checkpoint as an in-memory patch. Wire it into a KSampler to test, or into Save Checkpoint (with a CLIP and VAE) to keep it as a file. Nothing is saved automatically.
Install and gotchas
Install via ComfyUI Manager (search "DareMerge") or git clone https://github.com/54rt1n/ComfyUI-DareMerge into ComfyUI/custom_nodes, then restart. Requirements are matplotlib, numpy, torch, pillow - no model files to download. It works on SD1.5 and SDXL checkpoints; the pack sniffs the architecture and bails on unknown ones.
The classic beginner trap here is the ratio convention: 1 means keep model A, 0 means keep model B. It's the opposite of an intuition you might bring from other merge UIs, and it's easy to invert the whole merge by accident. Second trap: if a layer's key isn't in your gradient, that layer just doesn't merge - which is how you end up with a model that's half-merged and don't know why. Use Gradient Reporting to dump what the gradient actually covers before you hit run.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model_a | MODEL | — | |
| model_b | MODEL | — | |
| gradient | LAYER_GRADIENT | — | |
| method | COMBO | comfy | 12 options: comfy, lerp, slerp, slice, cyclic, gradient, +6 |
| model_maskopt | MODEL_MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |