LoraSave_motorway_edition
Extract a LoRA from weight differences and save it, in the pipe
- MOTORWAY ππ¨
- MOTORWAY ππ¨
Most LoRAs are trained with tools like ai-toolkit or kohya. But there's a second, much lazier path to making one: take a fine-tuned model, subtract the base model, and compress the difference into a LoRA file. That's exactly what LoraSave_motorway_edition (core name: "Extract and Save Lora") does - and this is the version that gets its inputs from your Motorway pipe instead of direct wires.
The mechanics are worth understanding so you don't expect magic. The node needs a model diff (the output of a ModelSubtract node: fine-tune minus base) and optionally a text encoder diff (from CLIPSubtract). It then runs SVD - singular value decomposition - on the weight differences, keeping the top rank components, and writes out a .safetensors LoRA file. Rank is the expressiveness dial: higher rank preserves more of the difference but makes a bigger file; the LoRA-training lore says don't bother porting an SDXL rank table to other architectures, and the same caution applies here. bias_diff controls whether bias terms are stored as plain diffs, and lora_type (standard vs full_diff) picks between the compact SVD LoRA and a bulkier "store everything" format.
Honest expectations: this is the quick-and-dirty extraction path, great for distilling a fine-tune into something shareable, but a real trained LoRA usually beats it on quality per rank. Still, if someone hands you a fine-tuned checkpoint and you want a LoRA out of it in one sitting, this is the tool.
The wrapper
MOTORWAY ππ¨- the pipe. Required.INPUT_lora_type_key(defaultlora_type) - where the type string lives.INPUT_model_diff_key(defaultmodel_diff) - the model difference, from a subtract node, stored in the pipe.INPUT_text_encoder_diff_key(defaulttext_encoder_diff) - the CLIP difference.filename_prefix(defaultloras/ComfyUI_extracted_lora) - where the file is written underComfyUI/output.rank(INT, 1β4096, default 8) - SVD rank.bias_diff(BOOLEAN, default true) - save biases as diffs.
Output port is just the pipe; the real output is the .safetensors file on disk.
Installing
Part of the Motorway pack:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
# restart ComfyUI
Or ComfyUI Manager β search ComfyUI_agilly1989_motorway β Install. No model downloads.
Gotchas
- Nothing gets saved if there's no diff in the pipe -
Key: 'model_diff' doesn't exist in motorwaymeans the subtract step never wrote its output. - It's a
_for_testingcore node wrapped in a beta pack: expect rough edges. The author's README says "IF THINGS BREAK ITS BECAUSE I BROKE IT," and generated clones have been toggled off in some releases. - Keys are exact strings; match them to whatever your subtract nodes actually wrote.
- Rank 8 is a starting point, not a rule. For a meaningful extraction you'll often want more - but bigger isn't automatically better.
You're not training here; you're compressing a diff. Set your expectations at "useful baseline," not "production LoRA," and you'll be pleasantly surprised how often it's enough.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β | |
| INPUT_lora_type_key | STRING | lora_type | β |
| INPUT_model_diff_key | STRING | model_diff | β |
| INPUT_text_encoder_diff_key | STRING | text_encoder_diff | β |
| filename_prefix | STRING | loras/ComfyUI_extracted_lora | β |
| rank | INT | 81β4096 | β |
| bias_diff | BOOLEAN | true | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β |