CLIP Math
The deprecated CLIP merger old workflows still reference
- a
- b
- c
- d
- CLIP
If you're looking at mrmth_CLIPMathNode specifically, odds are a downloaded workflow brought it in. This is the legacy, fixed-input version of the More Math CLIP merger - the one that fuses text encoders by running a math expression over their weights. It's superseded by mrmth_ag_CLIPMathNode, marked deprecated in the pack's source, and still works fine for old graphs. Here's the honest rundown.
What it is
The node takes up to four CLIP models - a is the required base, b, c, d are optional extras - plus four float variables w, x, y, z. The expression field is named Model (a quirk left over from when the model-like nodes shared one template) and defaults to a*(1-w)+b*w: a weighted blend of CLIP a and CLIP b by weight w. Feed it two text encoders and a blend factor and you get a patched CLIP that merges their weight distributions - the same trick as checkpoint merging, applied to the thing that reads your prompts.
Under the hood it shares the model-like merge machinery with the model and VAE nodes: it walks the union of state-dict keys across the input CLIPs, evaluates the expression per tensor, and applies the result as patches on a clone of a. length_mismatch handles different layer counts (error default, tile, pad) - the tooltip notes that for model-like nodes this "usually defaults to broadcast (zero for missing layers)."
Inputs and outputs
Required: a (CLIP), Model (the expression). Optional: b, c, d (CLIP), w, x, y, z (floats), length_mismatch. Output: one CLIP. Lazy evaluation skips unconnected inputs.
Installing it
Same as the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/mcDandy/more_math
cd more_math
pip install -r requirements.txt
Restart ComfyUI, or install "More math" from ComfyUI Manager. Only real dependency is antlr4-python3-runtime plus torch. No models.
Why you should care about the new one
The _ag_ version swaps the fixed a/b/c/d inputs for autogrow lists (V0..Vn, F0..Fn), which means more than two CLIPs without re-wiring, and an expression field that's actually labeled. Same engine, better surface. If you're rebuilding a workflow that used this node, migrating is a two-minute change. And as always with this pack: it's brand new and solo-maintained, so merged-CLIP outputs deserve a quick side-by-side test against the parents before you trust them - a subtly wrong text encoder doesn't crash, it just makes your prompts land slightly off.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| a | CLIP | Main CLIP (base) | |
| Model | STRING | a*(1-w)+b*w | Expression to apply on weights |
| length_mismatch | COMBO | error | How to handle mismatched layer counts. For models, this usually defaults to broadcast (zero for missing layers). |
| bopt | CLIP | Optional 2nd CLIP | |
| copt | CLIP | Optional 3rd CLIP | |
| dopt | CLIP | Optional 4th CLIP | |
| wopt | FLOAT | 0.00 | — |
| xopt | FLOAT | 0.00 | — |
| yopt | FLOAT | 0.00 | — |
| zopt | FLOAT | 0.00 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CLIP | CLIP | — |