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

Merge Text Encoders (2 Models)

Blend two CLIP/T5 files at the weight level

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

    This is the third leg of the merger family this pack ships - same engine as CheckpointTwoMerger and ModelTwoMerger, aimed at standalone text encoders. If your setup loads CLIP or a T5/Qwen encoder as its own file (which is how basically every current-generation model does it - Flux, Chroma, and the LLM-encoder architectures all keep the text encoder separate from the diffusion weights), this is where you'd blend two of those files together rather than the checkpoint or UNet.

    Why you'd want this at all

    It's the least common of the three merger types in this pack for a reason: merging text encoders isn't the same operation as merging fine-tuned checkpoints. A checkpoint merge is blending two things that were each independently trained to be good at generating images. A text-encoder merge is blending two things that were trained to produce embeddings the diffusion model downstream learned to interpret - and unless both encoders came from closely related training runs, averaging their weights doesn't obviously produce a coherent encoder, it produces an embedding space neither downstream model was ever conditioned on. This node exists for the narrower, legitimate case: two encoder checkpoints from the same base architecture (say, two CLIP fine-tunes, or two versions of the same T5 checkpoint) where a careful blend genuinely makes sense.

    How it works

    model_a and model_b pick your two source encoders. calc_mode selects the merge algorithm (option list not documented in the schema - check your install's dropdown). The six weight knobs - alpha 0.5, beta 0.5, gamma 0.99, delta 2, epsilon 0.01, zeta 0 - match the exact defaults every other two-input merger in this pack ships with, which is the same engine underneath all of them. alpha is the one you'd reach for on a basic blend; the rest feed more specific algorithms and aren't documented per-field.

    mismatch_mode (default skip) and alignment_mode (default pad/crop) handle tensors that don't line up between the two encoder files. exclude_patterns/discard_patterns (regex, or glob with glob_patterns) scope layers out of the result. lazy_load streams tensors instead of holding both encoders fully in memory, force_clear_cache clears CUDA cache per layer, save_dtype/override_dtype control output precision, process_device picks CPU or GPU, and seed covers whichever calc_mode is stochastic. Output is output_filename (default merged_2_textencoder) 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. Nothing to download - it works on encoder files already on disk.

    Where people get burned

    The one that actually matters here: never merge text encoders across architecture families. A T5-class encoder and a CLIP-class encoder don't share a token space, a dimensionality, or a training objective - merging them isn't a bad idea that produces a mediocre result, it's an operation that doesn't mean anything, and mismatch_mode/alignment_mode will at best pad/crop the shapes into something that loads without actually being sensible. Even within the same family, current-generation text encoders are increasingly full language models (Qwen3, T5-XXL) rather than small CLIP towers - the training that shaped one Qwen3-based encoder checkpoint and another can diverge more than two CLIP fine-tunes ever did, so a naive weighted blend is more likely to produce something the downstream diffusion model was never conditioned to read. If your merged encoder produces prompts that render as noise or ignore the prompt entirely, that's the first thing to suspect - not a bug in the node, a mismatch in what you fed it.

    CategoryModelUtils/Merging

    Inputs (22)

    NameTypeDefaultDescription
    execution_modeCOMBO2 options: MERGE, DOCUMENTATION ONLY
    model_aCOMBO1 options: None
    model_bCOMBO1 options: None
    calc_modeCOMBO10 options: Weight-Sum, Comparative-Interpolation, Power-Up (DARE), Power-Up (DARE+TIES), SVD LoRA Extraction, Enhanced Man Interp, +4
    mismatch_modeCOMBOskip3 options: skip, zeros, error
    alignment_modeCOMBOpad/crop2 options: pad/crop, interpolate
    alphaFLOAT0.50-10–10
    betaFLOAT0.50-10–10
    gammaFLOAT0.990-10–10
    deltaFLOAT2.00-10–10
    epsilonFLOAT0.01-10–10
    zetaFLOAT0.00-10–10
    seedINT00–18446744073709550000
    output_filenameSTRINGmerged_2_textencoder
    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