Nodes/ComfyUI_agilly1989_motorway/CLIPMergeSubtract_motorway_edition
ComfyUI Node

CLIPMergeSubtract_motorway_edition

Carving one text encoder out of another

By agilly1989·Created 2 years ago·Updated about a year ago· 7
CLIPMergeSubtract_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
INPUT_clip1_keyclip1
INPUT_clip2_keyclip2
multiplier1.00
OUTPUT_CLIP_keyCLIP

CLIPMergeSubtract is the text-encoder version of subtraction-based model merging: take CLIP1 and subtract CLIP2 (scaled by a multiplier) from its weights. In practice it's how you remove a tendency from a text encoder - if a merged or fine-tuned CLIP picked up a bias you don't want, subtracting the weights that caused it, scaled down, is the tool. This _motorway_edition wraps it for agilly1989's Motorway pipe: both CLIPs come out of the Motorway by key, the multiplier is a slider, and the result goes back in under a key you name.

Fair warning before you get excited: this is deep-end stuff. The subtraction-merge crowd mostly lives in model-merging forums debating weight-space semantics, and CLIP subtraction specifically is even thinner on the ground. If you inherited a Motorway workflow that uses it, the mental model is simple enough - result = clip1 - (clip2 * multiplier) - but don't expect a slide-deck of community results to copy. This is "experiment and observe" territory.

How it works

The wrapper pulls two things out of the Motorway and writes one back:

  • INPUT_clip1_key - key for the CLIP you're subtracting from (default clip1)
  • INPUT_clip2_key - key for the CLIP being subtracted (default clip2)
  • multiplier - how much of CLIP2 to remove, default 1.0, range −10 to 10. Negative values flip the subtraction into an addition, which is a neat trick: with multiplier = -1 this node behaves like CLIPMergeAdd.
  • OUTPUT_CLIP_key - where the result goes, default CLIP

The node instantiates the real core CLIPMergeSubtract, applies the arithmetic, and stores the result under the output key. The only visible output is the MOTORWAY 🚌💨.

The multiplier is where all the care lives. Subtracting a full 1.0 of a whole encoder is a big, often destructive move; the patient approach is a small multiplier like 0.1–0.3 and iterating. If the result looks wrong in a way you can't dial out, remember the sources are still in the Motorway - you can always re-merge from the originals, since keys overwrite and the input CLIPs were left untouched.

Motorway specifics

MOTORWAY 🚌💨 is required. Defaults assume your chain stored the sources under clip1 and clip2; if your loaders used the pack's other convention (CLIP), update the fields or you'll hit the signature 'MotorwayClass' object has no attribute 'hash_' error, which just means you asked for a key nobody wrote. Don't write the result over a source you still need downstream.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart, or find "ComfyUI_agilly1989_motorway" in ComfyUI Manager. No pip dependencies, no model downloads.

Fine print

This is an explicitly-beta pack - README opens "BIG BROKEN WITH ASYNC WILL FIX WHEN I GET THE TIME/MOTIVATION" - and the current hotfix release has the _motorway_edition clone generation commented out of __init__.py, so on the newest main these nodes may not load at all. A workflow referencing them with missing nodes is hitting exactly that. Report via GitHub issues; the author has said Discord DMs get ignored.

Categoryagilly1989 Nodes/Motorway-ed/advanced/model_merging

Inputs (5)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_clip1_keySTRINGclip1
INPUT_clip2_keySTRINGclip2
multiplierFLOAT1.00-10–10
OUTPUT_CLIP_keySTRINGCLIP

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨