Nodes/ComfyUI-DareMerge/Model Merger (Masked)
ComfyUI Node

Model Merger (Masked)

The classic masked merge, before gradients existed

By 54rt1n·Created 3 years ago·Updated about a year ago· 98
Model Merger (Masked)
  • model_a
  • model_b
  • model_mask
  • MODEL
time1.00
label1.00
input1.00
middle1.00
output1.00
out1.00
method

Model Merger (Masked) is the old-school version of this pack's masked merge: two checkpoints in, a MODEL_MASK in, and it merges them - but only on the parameters the mask says are allowed to change. Everything the mask excludes stays exactly as model A has it. No DARE, no gradients; just a plain block-weighted merge wearing a mask.

This node is also a bit of a museum piece, and it's worth knowing that up front. The current pack (and this comfy.icu page's sibling nodes) handles masking through the optional model_mask input on Model Merger (Advanced), Block, and the DARE variants, and it expresses block weights through LAYER_GRADIENTs. Model Merger (Masked) is the earlier, standalone shape: the mask is a required input, the ratios are the classic six (time/label/input/middle/output/out), and the merge method is the simpler four-way dropdown (comfy, lerp, slerp, gradient). If you're on a current install and this exact node doesn't appear, that's why - the capability moved into the other mergers.

The inputs that matter

  • model_a, model_b - base and injected model.
  • model_mask - required. This is what makes it a masked merge. Build one with Magnitude Masker (protect A's high-magnitude weights) or Simple Masker / Mask Edit (arbitrary or random selection). Where the mask is true, the merge applies; where false, model A's value is kept verbatim.
  • time / label / input / middle / output / out - the six block ratios, all default 1. Remember the convention: 1 = keep model A, 0 = take model B.
  • method - comfy (default), lerp, slerp, gradient.

How it works

For each parameter tensor, the node looks up the block's ratio, applies the mask (masked-out parameters pinned to model A), blends the masked-in ones between A and B at the block ratio, and installs the result as a patch on a clone of model A. The mask and the block ratios compose: a parameter needs to be both mask-selected and in a block with a non-default ratio to actually change.

The output

A MODEL patch - KSampler for testing, Save Checkpoint (with CLIP + VAE) to keep. Nothing writes to disk on its own.

Install and gotchas

ComfyUI Manager (search "DareMerge") or git clone https://github.com/54rt1n/ComfyUI-DareMerge into ComfyUI/custom_nodes, then restart. Dependencies: matplotlib, numpy, torch, pillow, no downloads. SD1.5 and SDXL.

The practical takeaway: if you're learning the pack today, use the current masked-capable mergers rather than hunting for this node - the same job, with the mask optional and gradients available when you want them. But if you're reading a tutorial or an older workflow that references "the masked merge workflow" (the pack's own examples folder has exactly such an image), this is what it was pointing at, and the mask semantics it taught are unchanged: the mask whitelists what the merge is allowed to touch.

Categoryddare/unet

Inputs (10)

NameTypeDefaultDescription
model_aMODEL
model_bMODEL
model_maskMODEL_MASK
timeFLOAT1.000–1
labelFLOAT1.000–1
inputFLOAT1.000–1
middleFLOAT1.000–1
outputFLOAT1.000–1
outFLOAT1.000–1
methodCOMBO4 options: comfy, lerp, slerp, gradient

Outputs (1)

NameTypeDescription
MODELMODEL