Nodes/ComfyUI-nodes-hnmr/StateDictMergerBlockWeighted
ComfyUI Node

StateDictMergerBlockWeighted

Blend different parts of a UNet at different strengths

By CYBERLOOM-INC·Created 3 years ago·Updated 2 years ago· 11
StateDictMergerBlockWeighted
  • model_A
  • model_B
  • DICT
position_ids
half
base_alpha0.000
alphas

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.

Categorymodel

Inputs (6)

NameTypeDefaultDescription
model_ADICT
model_BDICT
position_idsCOMBO3 options: A, B, Reset
halfCOMBO2 options: True, False
base_alphaFLOAT0.000-1–2
alphasSTRING

Outputs (1)

NameTypeDescription
DICTDICT