Nodes/ComfyUI-Inference-Core-Nodes/Inference_Core_ModelMergeBlockNumber
ComfyUI Node

Inference_Core_ModelMergeBlockNumber

Per-block checkpoint merging for SD1.5

By LykosAI·Created 2 years ago·Updated about a year ago· 33
Inference_Core_ModelMergeBlockNumber
  • model1
  • model2
  • MODEL
time_embed.1.00
label_emb.1.00
input_blocks.0.1.00
input_blocks.1.1.00
input_blocks.2.1.00
input_blocks.3.1.00
input_blocks.4.1.00
input_blocks.5.1.00
input_blocks.6.1.00
input_blocks.7.1.00
input_blocks.8.1.00
input_blocks.9.1.00
input_blocks.10.1.00
input_blocks.11.1.00
middle_block.0.1.00
middle_block.1.1.00
middle_block.2.1.00
output_blocks.0.1.00
output_blocks.1.1.00
output_blocks.2.1.00
output_blocks.3.1.00
output_blocks.4.1.00
output_blocks.5.1.00
output_blocks.6.1.00
output_blocks.7.1.00
output_blocks.8.1.00
output_blocks.9.1.00
output_blocks.10.1.00
output_blocks.11.1.00
out.1.00

ComfyUI's stock checkpoint-merge node gives you one global dial: how much of model A versus model B. This node throws that out and gives you a separate dial for every named block in an SD1.5 UNet instead - the time embedding, the label embedding, each of the 12 input blocks, all 3 middle blocks, each of the 12 output blocks, and the final output layer. That's roughly two dozen individual ratios instead of one, which means you can do things a single global merge can't: keep model1's early layers (where composition and rough structure live) while pulling in model2's later layers (where style and fine detail live), or any other combination across the network.

If you've used A1111 or Forge, this is the ComfyUI-native version of what SuperMerger's MBW (merge block weighted) mode does - it's one of the small handful of features people cite as a genuine reason to keep a legacy webui install around, and this node exists so you don't have to.

How the ratios work

model1 and model2 are your two checkpoints. Every other input is a FLOAT slider from 0 to 1 (step 0.01, default 1) named after the block it controls - time_embed., label_emb., input_blocks.0. through input_blocks.11., middle_block.0. through middle_block.2., output_blocks.0. through output_blocks.11., and out.. Each slider is "how much of model2 to mix in at that block": set every slider to 0 and you get model1 back untouched, set them all to 1 and you get model2 back untouched, and the actually useful merges live somewhere in between. The output is a single merged MODEL.

This node's block names match SD1.5's UNet layout specifically. If you're merging SDXL checkpoints, you want Inference_Core_ModelMergeSDXL instead - SDXL's UNet has a different, coarser block structure and the names won't line up.

What to expect from block merging in practice

Worth setting expectations honestly before you dive in: the community's actual experience with checkpoint merging is that combining two models with genuinely different training distributions - a realistic model and an anime model, say - tends to produce something weaker at both rather than the best of each. Per-block control like this node gives you is the real workaround for that, along with partial merges and LoRA injection, not a guarantee that any ratio combination will magically resolve incompatible training targets. Expect to iterate on specific block ratios rather than land on a great merge in one try.

Installing it

Comes with the pack. ComfyUI Manager: search "ComfyUI-Inference-Core-Nodes". Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes

then install.py, or pip install -e . (no acceleration extras needed - this is pure tensor arithmetic on two already-loaded checkpoints, no neural-network inference involved) and restart.

Troubleshooting

There's no crash mode here worth worrying about - feeding it two genuinely incompatible checkpoints doesn't error, it just produces a mushy, worse-at-everything merge. If your merge looks weaker than either source model, that's the quality-dilution problem the community already knows well, not a sign you're using the node wrong. Try leaning the ratios more heavily toward whichever model you actually want to dominate, rather than starting from an even split across every block.

Categoryadvanced/model_merging

Inputs (32)

NameTypeDefaultDescription
model1MODEL
model2MODEL
time_embed.FLOAT1.000–1
label_emb.FLOAT1.000–1
input_blocks.0.FLOAT1.000–1
input_blocks.1.FLOAT1.000–1
input_blocks.2.FLOAT1.000–1
input_blocks.3.FLOAT1.000–1
input_blocks.4.FLOAT1.000–1
input_blocks.5.FLOAT1.000–1
input_blocks.6.FLOAT1.000–1
input_blocks.7.FLOAT1.000–1
input_blocks.8.FLOAT1.000–1
input_blocks.9.FLOAT1.000–1
input_blocks.10.FLOAT1.000–1
input_blocks.11.FLOAT1.000–1
middle_block.0.FLOAT1.000–1
middle_block.1.FLOAT1.000–1
middle_block.2.FLOAT1.000–1
output_blocks.0.FLOAT1.000–1
output_blocks.1.FLOAT1.000–1
output_blocks.2.FLOAT1.000–1
output_blocks.3.FLOAT1.000–1
output_blocks.4.FLOAT1.000–1
output_blocks.5.FLOAT1.000–1
output_blocks.6.FLOAT1.000–1
output_blocks.7.FLOAT1.000–1
output_blocks.8.FLOAT1.000–1
output_blocks.9.FLOAT1.000–1
output_blocks.10.FLOAT1.000–1
output_blocks.11.FLOAT1.000–1
out.FLOAT1.000–1

Outputs (1)

NameTypeDescription
MODELMODEL