Diffusers Save LoRA
Save the LoRA you just hacked together
- lora
DiffusersSaveLora is the endpoint for the pack's LoRA-editing story. Load a LoRA, zero or scale some transformer blocks with DiffusersLoraLayersOperation, and then persist the result to disk as a .safetensors file. It's a terminal node - no outputs, just a file landing somewhere you can find it.
Inputs
lora- theLORAstate dict, typically themodified_lorafrom DiffusersLoraLayersOperation (though it'll happily save anything you feed it, including a freshly-loaded untouched LoRA).filename- what to call the file (defaultmy_lora.safetensors). If you leave off the extension it appends.safetensorsfor you.output_dir- optional. Leave it empty and the file goes to ComfyUI's default output directory; set it and it saves wherever you point, creating the directory if needed.
What it actually does - and the one surprise
Before writing, the node sweeps the state dict for tensors that are all zeros and drops them from the file, logging how many it removed. That's the behavior worth understanding: those layers you zeroed out with the layers-operation node don't survive the save. If you zeroed a block to disable a concept, that's exactly what you want - the saved LoRA is leaner and the block is gone, not merely muted. If you were hoping to save the scaled but not zeroed edits, those still save fine; only all-zero tensors get stripped.
The output is a proper safetensors file written with the safetensors library, so anything that reads a LoRA - ComfyUI's normal loaders, other tools, training utilities - can pick it back up.
Install
ComfyUI Manager → "Comfyui-DiffusersUtils", or:
cd ComfyUI/custom_nodes
git clone https://github.com/lrzjason/Comfyui-DiffusersUtils
Restart ComfyUI. No extra deps for the LoRA path, and remember the README's requirements.txt step is a dead end (no such file ships).
A practical note
This node is where the whole "edit a LoRA before it's applied" workflow gets its payoff - you can build a small library of block-modified LoRAs from one download, or turn a one-off experiment into a file you keep. Check the console log after running: it prints the save path and the layer count before/after the zero-filter, which is your confirmation the edit took. And since it's a terminal node with no outputs, don't expect to wire anything downstream of it - it ends the line, on purpose.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| lora | LORA | The modified LoRA state dictionary to save. | |
| filename | STRING | my_lora.safetensors | Filename to save the LoRA as (e.g. my_lora.safetensors). |
| output_diropt | STRING | /tmp/ComfyUI/output | Directory to save the LoRA to. Defaults to ComfyUI output directory if not provided. |
Outputs (0)
No outputs