Merge Text Encoders (2 Models)
Blend two CLIP/T5 files at the weight level
- output_filename
- documentation
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.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| execution_mode | COMBO | MERGE writes the selected result; DOCUMENTATION ONLY returns the operation reference without loading model files. | |
| model_a | COMBO | Primary text encoder; anchors metadata, tensor shapes, and values preserved by exclusions or skip handling. | |
| model_b | COMBO | Second text encoder contributing to the selected calculation mode. | |
| calc_mode | COMBO | Two-model operation to apply per comparable tensor; DOCUMENTATION ONLY shows its formula and coefficient meanings. | |
| mismatch_mode | COMBO | skip | Handle missing or incompatible tensors: preserve Model A, substitute zeros where supported, or abort with an error. |
| alignment_mode | COMBO | pad/crop | Resolve compatible shape differences by zero-padding/cropping or by interpolating Model B and Model C to Model A shape. |
| alpha | FLOAT | 0.50-10–10 | Mode-specific coefficient; use DOCUMENTATION ONLY for its exact role in the selected calculation mode. |
| beta | FLOAT | 0.50-10–10 | Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula. |
| gamma | FLOAT | 0.990-10–10 | Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula. |
| delta | FLOAT | 2.00-10–10 | Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula. |
| epsilon | FLOAT | 0.01-10–10 | Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula. |
| zeta | FLOAT | 0.00-10–10 | Mode-specific coefficient; some calculation modes ignore it. See DOCUMENTATION ONLY for the selected formula. |
| seed | INT | 00–18446744073709550000 | Random seed used only by calculation modes with stochastic behavior. |
| output_filename | STRING | merged_2_textencoder | Output filename without extension, written under the matching ComfyUI model directory. |
| save_dtype | COMBO | Output tensor dtype; when Override Dtype is disabled, source tensors with higher precision remain at that precision. | |
| process_device | COMBO | Device used for per-tensor merge arithmetic; CUDA out-of-memory retries the affected tensor on CPU. | |
| exclude_patterns | STRING | Newline-separated regex or glob patterns for tensors excluded from merging and preserved from Model A. | |
| discard_patterns | STRING | Newline-separated regex or glob patterns for tensors omitted entirely from the output. | |
| glob_patterns | BOOLEAN | false | When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). When False (default), patterns are Python regex matched as substrings. |
| lazy_load | BOOLEAN | true | Low memory mode: load tensors from disk on demand |
| force_clear_cache | BOOLEAN | true | Clear CUDA cache after each layer |
| override_dtype | BOOLEAN | false | Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| output_filename | * | — |
| documentation | STRING | — |