LC Strip Metadata π§Ή
Ship the weights, not your workflow
- report
What it does
Cleans the header of a model you've already saved. Embedded workflow, training details, titles, edit notes - gone. The part that matters: it never loads or re-saves the weights. A .safetensors file is an 8-byte header length, a JSON header (the tensor table plus a __metadata__ block), and then the raw tensor bytes. This node rewrites only the JSON header and copies every weight byte straight across, so the file loads exactly like the original did. There's no re-encode, so there's nothing to lose.
Why you'd want it
If you've ever opened a checkpoint from CivitAI and found the author's training config, dataset notes and a full node graph in the metadata, you know the shape of this. The image world already learned the lesson - the metadata is the payload in a shared PNG - and models are no different. When you publish a merge, the metadata is where your private pipeline, your prompt structure, your LoRA list and the name of your dataset live. Most tools never give you a way to take it out without re-saving the model and changing the weights in the process.
The save nodes in this pack (LC Checkpoint Save, LC Diffusion Model Save, LC LoRA Save, LC LoRA Extract) have the same switch built in for new files. This node is for the file you already have.
The inputs
file - a saved model, checkpoint, LoRA, VAE or text encoder (.safetensors), picked from diffusion_models, checkpoints, loras, vae or text_encoders.
mode - necessary only (the default) keeps what loading needs plus the architecture and trigger words, and drops everything else: no workflow, no training details, no titles. everything leaves an empty header, with one exception: the _quantization_metadata key survives, because other tools' quant formats need it to load at all.
save_as - new file (_clean) writes name_clean.safetensors next to the original; replace the original swaps the original for the cleaned copy once the new file is completely written, never mid-way.
enabled - off skips it and writes nothing.
One output: report, which names the file, the count and size of the fields removed, and lists what was kept.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/lonecatone23/ComfyUI_LC_ModelBuilder_nodes
Restart. Strictly standard library for this node - struct, json, shutil - plus ComfyUI's folder paths. Nothing to pip install.
Where people get burned
The report gives you the numbers rather than assuming it worked, and if it can't write it deletes the partial file instead of leaving you a half-copied checkpoint in your models folder. Two things still bite:
If you chose replace the original while the model is loaded somewhere in an active graph, the swap fails with a permission error - the node tells you to free the model or restart ComfyUI, which is the honest answer. Do it before you queue.
And if name_clean.safetensors already exists, it refuses rather than picking a new name - delete or rename the old one. That's deliberate; quietly numbering the output is how you end up with four copies of a 12B model and no idea which is which.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| file | COMBO | A saved model, checkpoint, LoRA, VAE or text encoder (.safetensors). | |
| mode | COMBO | necessary only | necessary only = keep what loading needs plus the architecture and trigger words (same as the save nodes' switch). everything = an empty header (quant settings other tools need to load are still kept). |
| save_as | COMBO | new file (_clean) | new file = writes name_clean.safetensors next to the original and leaves it alone. replace = swaps the original for the cleaned copy once it's fully written. |
| enabled | BOOLEAN | true | Off skips it (nothing is written). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| report | STRING | β |