Model Save with Original
Re-save an edited model without mangling its keys or dropping tensors
- original_model
- model
Saving an edited model in ComfyUI is where a lot of merge experiments quietly die. The built-in save path writes ComfyUI's internal key layout - prefixes like diffusion_model. that the original file never had - and it drops any tensor the workflow didn't actually touch. Load the result back with a stock loader and you're staring at key mismatches or missing weights. Model Save with Original is the fix: it merges your edited model back onto the original, unedited tensor set and writes a file that keeps the original key names and restores everything that went missing.
It's the second half of the loop that starts with this pack's Load Original Model. Together they make model editing round-trip: load raw + load editable, run your scale or merge nodes on the editable copy, then save both back out clean.
How it works
The clever part is the key matching. ComfyUI's state dict may prefix keys with something like diffusion_model., and the original file may have its own prefix too - so the node brute-forces every dot-separated prefix candidate on both sides and picks the pair that maximizes the number of matching keys. That pair then drives the merge:
- Keys present in both → the edited value wins (cast back to the original tensor's dtype).
- Keys only in the original → restored from the original, which is how you recover tensors ComfyUI dropped.
- Keys only in ComfyUI's state dict → skipped, and logged to the console.
It prints a summary of matched vs restored vs skipped counts, which doubles as a health check: if matched is tiny, your edited model probably doesn't share the original's architecture, and the save would be garbage - the console tells you before you trust the file.
Inputs
- original_model - the raw output of Load Original Model. This is what makes the restore possible.
- model - your edited model (output of a scale/merge node, or whatever you modified).
- filename_prefix - base name, default
model_restored. Saves to ComfyUI'soutputfolder with an auto-incrementing numeric suffix so it never overwrites. - save_metadata (optional, default on) - writes the original file's metadata plus a record of restored/matched counts into the new file.
No outputs - it's an output node; the file is the product.
Install
Search Easygoing in the ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/easygoing0114/ComfyUI-easygoing-nodes.git
Restart ComfyUI. No pip extras; needs a ComfyUI with the V3 node API.
The honest caveats
This is a power tool for the model-merging workflow, not an everyday node. Keeping Load Original Model in a daily generation graph costs you RAM (it holds a full raw copy on CPU); only wire it in for edit-and-save sessions. And the restore philosophy cuts both ways: "restored" tensors are the original values, so if your edit was supposed to change them and ComfyUI never touched them, you get the original back - which is exactly what you want for a clean round-trip, but it means this node preserves your edits where they landed and quietly keeps everything else original. Check the console numbers on your first save; a healthy save shows most tensors matched, a handful restored, and zero surprises.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| original_model | ORIGINAL_MODEL | — | |
| model | MODEL | — | |
| filename_prefix | STRING | model_restored | — |
| save_metadataopt | BOOLEAN | true | — |
Outputs (0)
No outputs