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

Merge LoRAs (3 Models)

Three LoRA files through the generic weighted-merge engine

By silveroxides·Created about a year ago·Updated 4 days ago· 14
Merge LoRAs (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_lora
    save_dtype
    process_device
    exclude_patterns
    discard_patterns
    glob_patternsfalse
    lazy_loadtrue
    force_clear_cachetrue
    override_dtypefalse

    LoRATwoMerger with a third slot. Same caveat applies here even more than there: this pack has two separate systems for combining LoRAs, and this one is the generic one - the same weighted-merge engine that powers CheckpointThreeMerger and ModelThreeMerger, just pointed at three LoRA files instead. It treats each LoRA's tensors as arbitrary weights to blend, without any rank-aware logic. If you want to actually stack several trained adapters cleanly - reconciling different ranks and naming conventions on purpose - this pack's LoRAMultiMerge node (up to eight LoRAs, with an explicit concatenate-vs-weighted-sum choice) is the more purpose-built tool. Reach for this one when you specifically want three LoRAs blended with the same math you'd use to blend three checkpoints.

    How it works

    model_a, model_b, model_c are your three source LoRAs. calc_mode picks the merge algorithm (option list not documented in the schema - check the dropdown on your install). The six weight knobs follow this pack's three-input pattern: alpha, beta, gamma default to 0.5 each (one knob per source), delta to 2, epsilon to 0.01, zeta to 0 - identical to CheckpointThreeMerger and ModelThreeMerger. None carry tooltips, so treat the defaults as your best clue until you know what a particular calc_mode does with them.

    mismatch_mode (default skip) and alignment_mode (default pad/crop) are doing real work here - three LoRAs from three different training runs very plausibly have three different ranks and three different naming schemes, and this is what keeps the merge from erroring out on the first shape mismatch it hits. exclude_patterns/discard_patterns (regex, glob with glob_patterns on) let you scope specific layers out. lazy_load and force_clear_cache handle memory (less of a concern here than with three full checkpoints - LoRAs are small), save_dtype/override_dtype control output precision, process_device picks CPU or GPU, and seed covers whichever calc_mode involves randomness. Output is output_filename (default merged_3_lora) 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 needed beyond the LoRA files themselves.

    Where people get burned

    Three LoRAs averaged generically is a rougher operation than it sounds. Rank mismatches, different training conventions, different base architectures - any one of these across your three sources means the merge is reconciling shape differences (via mismatch_mode/alignment_mode) rather than genuinely combining trained knowledge. The result can load and run and still look worse than any one of the three sources at full strength, because you've diluted three low-rank approximations into one without the rank-aware reconstruction that LoRAMultiMerge's weighted_sum mode does on purpose. If that's what you're actually after - combining several character or style LoRAs into a single portable file - try that node first and come back to this one if you specifically need the generic engine's flexibility (arbitrary calc_mode, exclude/discard patterns, precision control) that LoRAMultiMerge doesn't expose.

    Architecture mismatch remains absolute regardless of node: a LoRA trained for one base model contributes nothing useful when merged into a LoRA stack for a different one.

    CategoryModelUtils/Merging

    Inputs (23)

    NameTypeDefaultDescription
    execution_modeCOMBO2 options: MERGE, DOCUMENTATION ONLY
    model_aCOMBO1 options: None
    model_bCOMBO1 options: None
    model_cCOMBO1 options: None
    calc_modeCOMBO4 options: Add-Difference, Train-Difference, Extract-Features, Add-Dissimilarities
    mismatch_modeCOMBOskip3 options: skip, zeros, error
    alignment_modeCOMBOpad/crop2 options: pad/crop, interpolate
    alphaFLOAT0.50-10–10
    betaFLOAT0.50-10–10
    gammaFLOAT0.50-10–10
    deltaFLOAT2.00-10–10
    epsilonFLOAT0.01-10–10
    zetaFLOAT0.00-10–10
    seedINT00–18446744073709550000
    output_filenameSTRINGmerged_3_lora
    save_dtypeCOMBO3 options: fp32, fp16, bf16
    process_deviceCOMBO2 options: cuda, cpu
    exclude_patternsSTRING
    discard_patternsSTRING
    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_filenameSTRING
    documentationSTRING