LatentApplyOperationCFG_motorway_edition
Bake a latent operation into the model itself, via the pipe
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
LatentApplyOperationCFG_motorway_edition wraps the CFG variant of LatentApplyOperation, and this one's different from every other node in the family: instead of applying a math operation to a latent and handing you a latent back, it takes a MODEL and returns a MODEL. The operation gets baked into the model's sampling behavior, so it applies during the denoise rather than as a one-shot transform on an existing latent.
Why would you patch the model
Core's LatentApplyOperation computes on a latent you already have. Its CFG sibling changes what the model does while it samples: every time it refines the noisy latent, it applies the operation to the working values as part of the step. That's a much more invasive intervention - you're not post-processing, you're altering the sampler's behavior mid-flight, which is why this node returns a patched MODEL and sits in the latent/advanced/operations category. Realistically this is for people doing custom sampling research, noise-space manipulation, or reproducing a specific paper's trick. For normal generation it's a footgun: you're modifying the model's internal latent handling, and the "what does cosine in the CFG step actually do to my image" question rarely has a satisfying answer.
The operation itself comes from the pipe as a string key, matching core's menu: "add", "subtract", "multiply", "divide", "cosine", "sine". Since it's a free-text key rather than a dropdown, a typo means a wrong or meaningless operation - double-check the string that wrote the "operation" key.
Set:
INPUT_model_key(default"model") - the model to patch.INPUT_operation_key(default"operation") - the operation to bake in.OUTPUT_MODEL_key(default"MODEL") - where the patched model lands.
Only output socket is MOTORWAY 🚌💨; read the patched MODEL out via a Motorway AxB ramp and feed it to a sampler. The patched model replaces the original under "MODEL" in the pipe, so anything downstream that samples will use the patched version - which is the point, and also the thing to remember when you wonder why your images changed.
Install and caveats
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart ComfyUI, or install via ComfyUI Manager. No pip deps, no model files - the patch is applied in memory at runtime.
Pack-wide reality check applies fully: one-developer beta, README-explicit about breakage ("IF THINGS BREAK ITS BECAUSE I BROKE IT"), and the current repo HEAD comments out the _motorway_edition registration mid-refactor, so a fresh clone may not even load this node. The signature error, 'MotorwayClass' object has no attribute 'hash_', means a key you referenced was never written to the pipe - check that "model" actually exists upstream before the run. And the honest close: model-patching latent math is deep-experimental territory in core, wrapped here in a beta pipe. Unless you already know exactly why you need it, the stock LatentApplyOperationCFG is the same experiment with sockets.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_model_key | STRING | model | — |
| INPUT_operation_key | STRING | operation | — |
| OUTPUT_MODEL_key | STRING | MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |