SaveStateDict
Export a merged weight dict as a .safetensors checkpoint
- weights
You merged two checkpoints in ComfyUI. Now what? If you want to keep the result - use it later, share it, load it with another tool - SaveStateDict is the node that writes your merged DICT of weights to a file on disk.
Inputs are weights (the DICT - from StateDictMerger, StateDictMergerBlockWeighted, or a raw StateDictLoader), filename (defaults to merged_model.safetensors), and overwrite (False/True). Output: none - it's an output node that saves the file and reports the path in the console.
Mechanically it's simple and sensible. It writes into your ComfyUI output directory. The extension decides the format: .pt or .ckpt goes through torch.save, .safetensors (or .safetensor) through safetensors' save_file; anything else gets .safetensors appended. You can even include a subfolder in the filename. If the file already exists and overwrite is False, it doesn't clobber it - it renames with an incremented number suffix (merged_model_1.safetensors), which is a nice safety touch. It also refuses to write outside the output directory (path-traversal guard).
One thing to be clear-eyed about: this saves the raw state dict, not a packaged "checkpoint" with metadata. For a standard SD1.5 checkpoint, the dict from StateDictLoader contains the full model.diffusion_model + cond_stage_model + first_stage_model structure, and ComfyUI's own checkpoint loader can read it - but if your weights came from an unusual merge or a partial dict, don't be surprised if downstream loaders complain. When in doubt, test the round-trip: save, then load it back with StateDictLoader → Dict2Model in the same session.
Why would you do this instead of Dict2Model + sampling in-memory? Persistence, mostly. An in-memory merge dies with your workflow; a saved file is a real artifact you can reference from a plain checkpoint loader, back up, or share (mind model licenses - merges inherit their parents' terms, and much of the SD1.5 ecosystem is non-commercial).
Install via ComfyUI Manager (search "ComfyUI-nodes-hnmr") or:
cd ComfyUI/custom_nodes
git clone https://github.com/CYBERLOOM-INC/ComfyUI-nodes-hnmr
Restart ComfyUI. No extra dependencies - safetensors ships with ComfyUI.
Watch the overwrite toggle: leave it False for safety and it auto-renames; flip it True to stomp an old merge with the same name. And keep the console tab open while saving - the node prints the exact output path there, not in the UI. This is the maintained fork of hnmr293's pack; install the CYBERLOOM-INC repo, since the original stopped getting fixes and broke on modern ComfyUI.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| weights | DICT | — | |
| filename | STRING | merged_model.safetensors | — |
| overwrite | COMBO | 2 options: False, True |
Outputs (0)
No outputs