StateDictMergerBlockWeighted
Blend different parts of a UNet at different strengths
- model_A
- model_B
- DICT
A plain weighted sum blends two checkpoints uniformly - every layer gets the same alpha. Block-weighted merging is the smarter sibling: it lets you blend different regions of the UNet at different strengths. The idea comes from the sd-webui merge block weighted GUI and the SuperMerger scene, and this node brings it into ComfyUI for SD 1.5-class models.
The concept: a Stable Diffusion 1.x UNet is organized into 25 blocks - the time embedding, input blocks, middle block, output blocks, and the final out layer. Early blocks handle broad composition; late blocks handle fine detail. So you might take composition from model A but fine detail from model B - or anywhere in between - by giving each block its own alpha instead of one global value.
Inputs are model_A, model_B (DICTs), position_ids (A/B/Reset) and half (same as StateDictMerger), plus the two that matter: base_alpha and alphas. base_alpha is the fallback blend for weights that don't belong to a numbered block (CLIP, VAE, embeddings). alphas is a multiline text field where you type exactly 25 comma-separated floats - one per block, from time embedding (0) through the out layer (24). Give it 24 and it throws a clear expected 25 error; that's the syntax to remember.
Each block's result is (1 - alpha_i) * A + alpha_i * B, so 0 keeps model A's block and 1 takes model B's. Typical recipe: keep low blocks from your base model, push higher blocks toward the model whose style you want, and leave base_alpha low so the non-UNet parts stay mostly from A.
The output is a merged DICT - feed it to Dict2Model to sample it immediately, or SaveStateDict to write a .safetensors checkpoint.
Install via ComfyUI Manager (search "ComfyUI-nodes-hnmr") or:
cd ComfyUI/custom_nodes
git clone https://github.com/CYBERLOOM-INC/ComfyUI-nodes-hnmr
Restart ComfyUI; no model downloads, no extra dependencies.
The big caveat: this is SD1.5-only territory. The 25-block structure it indexes is the SD 1.x UNet layout, so don't feed it SDXL dicts and expect sensible results - SDXL's block structure is different and this node doesn't understand it. And as with all merging, block-weighted or not, the results are only as good as your patience: you'll be doing a lot of small sweeps to find a recipe that doesn't smear both parents. That's exactly what the pack's ...Multi variant and KSamplerXYZ are for. This is the maintained fork of hnmr293's pack, so install the CYBERLOOM-INC repo, not the abandoned original.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model_A | DICT | — | |
| model_B | DICT | — | |
| position_ids | COMBO | 3 options: A, B, Reset | |
| half | COMBO | 2 options: True, False | |
| base_alpha | FLOAT | 0.000-1–2 | — |
| alphas | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DICT | DICT | — |