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

Merge Models (3 Models)

Three-way blending for UNet-only diffusion models

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

    ModelTwoMerger with a third input. Same idea as CheckpointThreeMerger vs CheckpointTwoMerger, just aimed at standalone diffusion-model files instead of full checkpoints - the UNet-only weights you'd load through a dedicated diffusion-model loader rather than a checkpoint loader, which is how most Flux-family workflows are wired. If you're merging three of those in one shot instead of chaining two-way merges twice, this is the node.

    How it works

    model_a, model_b, model_c are your three source models. calc_mode picks the merge algorithm - the dropdown's option list isn't documented in the schema, so open it on your install to see what's there. The six weight knobs default to the three-input pattern this pack uses consistently: alpha, beta, gamma all at 0.5 (one knob per source, a flat three-way split reads as the obvious default), delta at 2, epsilon at 0.01, zeta at 0 - the same shape as CheckpointThreeMerger and LoRAThreeMerger. None of the six ship a tooltip, so the defaults are your best guide until you've experimented or checked what your particular calc_mode does with them.

    mismatch_mode (default skip) and alignment_mode (default pad/crop) reconcile tensors that don't match across all three source models - worth knowing this exists as a real setting, because three separately fine-tuned UNets frequently don't share identical layer shapes even within the same architecture family. exclude_patterns/discard_patterns (regex, glob if glob_patterns is on) scope specific layers out of the merge. lazy_load streams tensors from disk rather than loading three full models into memory at once - worth keeping on here more than almost anywhere else in the pack, since three UNets in VRAM simultaneously is a real number. force_clear_cache trades speed for headroom, save_dtype/override_dtype set output precision, process_device picks CPU or GPU, and seed covers whichever calc_mode uses randomness. Output is output_filename (default merged_3_model) and 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 downloads beyond your existing model files - this is local tensor math, nothing fetched.

    Where people get burned

    Three-way model merging inherits the same honest tension the community has documented at length around checkpoint merging: combining models doesn't reliably combine their strengths, it tends to average them toward something blander than any single input. Adding a third source doesn't fix that - if anything it gives the merge more ways to drift from a coherent style. Use exclude_patterns deliberately if you only want one of your three models contributing a specific set of layers rather than its entire self diluted into the average.

    The mechanical failure mode is the same as every merger in this pack: point it at the wrong file type (a full checkpoint instead of a bare diffusion model) and it won't behave as expected, and merging across genuinely different architectures produces garbage regardless of how carefully mismatch_mode/alignment_mode are tuned - those settings keep the math from erroring out, not from being meaningless. And three full-size diffusion models in flight is the heaviest memory ask in this pack's merger family; if lazy_load and force_clear_cache aren't enough, drop process_device to CPU and let it run slower instead of crashing.

    CategoryModelUtils/Merging

    Inputs (23)

    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.
    model_cCOMBOThird diffusion model contributing to the selected three-model calculation mode.
    calc_modeCOMBOThree-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.50-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_3_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