Nodes/Model Utility Toolkit/Merge Models (2 Models)
ComfyUI Node

Merge Models (2 Models)

Blend two UNet-only diffusion models

By silveroxides·Created about a year ago·Updated 7 days ago· 16
Merge Models (2 Models)
    • output_filename
    • documentation
    execution_mode
    model_a
    model_b
    calc_mode
    mismatch_modeskip
    alignment_modepad/crop
    alpha0.50
    beta0.50
    gamma0.990
    delta2.00
    epsilon0.01
    zeta0.00
    seed0
    output_filenamemerged_2_model
    save_dtype
    process_device
    exclude_patterns
    discard_patterns
    glob_patternsfalse
    lazy_loadtrue
    force_clear_cachetrue
    override_dtypefalse

    Same merge engine as CheckpointTwoMerger, but pointed at the other kind of model file: standalone diffusion-model weights loaded on their own, without a bundled CLIP or VAE. That's the norm for Flux-style workflows, where you load the UNet, the text encoder(s), and the VAE as three separate files through their own loaders instead of one all-in-one checkpoint. If your model of choice comes that way, this is the merger you want - not CheckpointTwoMerger, which expects the whole bundle.

    What's actually different from the checkpoint version

    Structurally, nothing - it's the identical parameter set, which tells you the pack shares one merge engine across model types rather than reimplementing the math three times. model_a and model_b pick your two source models. calc_mode selects the merge algorithm (the dropdown's options aren't documented in the node metadata, so check what's on your install). The six weight knobs - alpha, beta, gamma, delta, epsilon, zeta - carry the same defaults as CheckpointTwoMerger's two-input version too (0.5, 0.5, 0.99, 2, 0.01, 0), which is a useful thing to notice: every two-input merger in this pack, whether it's checkpoints, models, LoRAs, or text encoders, ships with identical defaults. Learn the pattern once on whichever node you touch first and it carries over.

    mismatch_mode (default skip) and alignment_mode (default pad/crop) handle tensors that don't line up between the two source models - genuinely common when the two UNets come from different fine-tunes or slightly different training runs of the same architecture. exclude_patterns/discard_patterns (regex, or glob with glob_patterns on) let you keep specific layers out. lazy_load streams tensors from disk instead of holding both models in VRAM simultaneously; force_clear_cache clears CUDA memory between layers. save_dtype/override_dtype set output precision, process_device picks CPU or GPU for the math, and seed is there for whichever calc_mode uses randomness. Output is output_filename (default merged_2_model) plus a documentation string.

    Installing it

    ComfyUI Manager: search Model Utility Toolkit, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI-ModelUtils
    

    Restart ComfyUI. No model downloads required - you're merging files you already have locally.

    Where people get burned

    The number one mistake with this node specifically is pointing it at the wrong kind of file - feeding it a full all-in-one checkpoint when it expects a bare diffusion-model file (or vice versa with CheckpointTwoMerger) will either fail to load into the dropdown at all or, worse, half-work in a confusing way depending on how your ComfyUI install categorizes the file. Check which loader you normally use for these two models before reaching for a merger.

    Past that, the same caveats apply as any checkpoint merge: two UNets from genuinely different architectures (say, one Flux-family model and one SDXL-family model) will not produce something coherent no matter how mismatch_mode/alignment_mode are set - those settings keep the tensor math from crashing, they don't make the merge make sense. And merging two large diffusion models is memory-heavy; if you're getting OOM, lazy_load plus force_clear_cache is the first fix, process_device: cpu the fallback when even that isn't enough.

    CategoryModelUtils/Merging

    Inputs (22)

    NameTypeDefaultDescription
    execution_modeCOMBOMERGE writes the selected result; DOCUMENTATION ONLY returns the operation reference without loading model files.
    model_aCOMBOPrimary diffusion model; anchors metadata, tensor shapes, and values preserved by exclusions or skip handling.
    model_bCOMBOSecond diffusion model contributing to the selected calculation mode.
    calc_modeCOMBOTwo-model operation to apply per comparable tensor; DOCUMENTATION ONLY shows its formula and coefficient meanings.
    mismatch_modeCOMBOskipHandle missing or incompatible tensors: preserve Model A, substitute zeros where supported, or abort with an error.
    alignment_modeCOMBOpad/cropResolve compatible shape differences by zero-padding/cropping or by interpolating Model B and Model C to Model A shape.
    alphaFLOAT0.50-10–10Mode-specific coefficient; use DOCUMENTATION ONLY for its exact role in the selected calculation mode.
    betaFLOAT0.50-10–10Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula.
    gammaFLOAT0.990-10–10Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula.
    deltaFLOAT2.00-10–10Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula.
    epsilonFLOAT0.01-10–10Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula.
    zetaFLOAT0.00-10–10Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula.
    seedINT00–18446744073709550000Random seed used only by calculation modes with stochastic behavior.
    output_filenameSTRINGmerged_2_modelOutput filename without extension, written under the matching ComfyUI model directory.
    save_dtypeCOMBOOutput tensor dtype; when Override Dtype is disabled, source tensors with higher precision remain at that precision.
    process_deviceCOMBODevice used for per-tensor merge arithmetic; CUDA out-of-memory retries the affected tensor on CPU.
    exclude_patternsSTRINGNewline-separated regex or glob patterns for tensors excluded from merging and preserved from Model A.
    discard_patternsSTRINGNewline-separated regex or glob patterns for tensors omitted entirely from the output.
    glob_patternsBOOLEANfalseWhen True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). When False (default), patterns are Python regex matched as substrings.
    lazy_loadBOOLEANtrueLow memory mode: load tensors from disk on demand
    force_clear_cacheBOOLEANtrueClear CUDA cache after each layer
    override_dtypeBOOLEANfalseForce the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved.

    Outputs (2)

    NameTypeDescription
    output_filename*
    documentationSTRING