- mask
- MODEL_MASK
Mask Edit is where ComfyUI-DareMerge stops being a merge tool and starts being a toy box. A model mask in this pack is essentially a big boolean signature of the model - for every parameter, a flag saying "merge this one" or "leave it alone." Magnitude Masker builds that signature by looking at weight deltas. Mask Edit ignores all that and lets you just... draw it. Per layer. With randomness if you feel like it.
The author's own framing is worth quoting, because it's the honest argument for why you'd bother: selecting parameters by magnitude is one approach, but "a potentially more powerful approach would be pure random selection; until we can find a pattern in our latent space and account for it, we can assume that the distribution of the parameters for a given state is random." In other words: nobody actually knows which specific weights matter, so randomly picking which parameters to merge in (rather than only the low-magnitude ones) is a legitimate alternative to try when a merge isn't working.
The inputs
- mask - a
MODEL_MASKfrom Magnitude Masker, Simple Masker, or another edit chain. - operation -
random(Bernoulli),gaussian,true, orfalse. Random and gaussian replace the target layer's mask with noise;true/falseset every parameter in the layer to included/excluded. - arg_one and arg_two - meaning changes with the operation. For
random, arg_one is the Bernoulli threshold. Forgaussian, arg_one is the mean and arg_two is the standard deviation. Fortrue/falsethey're ignored. - seed - because the random and gaussian ops are stochastic.
- layers - the field you must actually fill in, and the real power of the node. It's multiline: comma or newline separated layer patterns, with
*as a wildcard that matches everything. Sodiffusion_model.input_blocks.4.1.transformer_blocks.0.attn2.*targets one attention layer, while*hits every layer in the model. You can also use{0,1}style expansions to fan out across block numbers. If you leave it empty or type a name that doesn't exist, the node errors out with "No layers specified" - get the exact names from the Mask Reporting node'sdetailsreport, which lists every layer.
The output
One MODEL_MASK, with the targeted layers replaced by whatever you generated. Everything else in the mask is untouched. That's the key mental model: Mask Edit is destructive only on the layers you name, and each run replaces those layers wholesale rather than blending with what was there.
Why you'd chain it
The classic recipe: build a Magnitude Masker that protects model A's high-magnitude parameters, then run Mask Edit to randomize or force-specific the layers you actually care about, then feed the result into Model Merger (DARE) or Model Merger (Advanced) as the optional model_mask. Because DARE is stochastic anyway, the mask is your way of steering where the randomness gets to act.
Install and gotchas
Install the pack with ComfyUI Manager (search "DareMerge") or git clone https://github.com/54rt1n/ComfyUI-DareMerge into ComfyUI/custom_nodes and restart. No model downloads; the only real dependency beyond torch is matplotlib, and that's for the reporting nodes, not this one.
Two gotchas worth knowing. First, masks are memory-hungry - a boolean per parameter of a whole checkpoint is a lot of booleans, and the pack chunks the math to cope. Second, because this is random selection, the seed matters and your results will vary run to run. If you're comparing two merges, fix the seed. And a realistic note: this is the "more advanced features in development" corner of the pack, so expect to experiment rather than follow a recipe that's known to work.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MODEL_MASK | — | |
| operation | COMBO | random | 4 options: random, gaussian, true, false |
| arg_one | FLOAT | 0.000–1 | — |
| arg_two | FLOAT | 0.000–1 | — |
| seed | INT | 10–99999999999 | — |
| layers | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL_MASK | MODEL_MASK | — |