Nodes/ComfyUI-Info-Prompt-Toolkit/ModelSave with Net Prefix
ComfyUI Node

ModelSave with Net Prefix

Save a Model With net.* Keys Without Touching a Single Tensor

By kinorax·Created 5 months ago·Updated about a month ago· 2
ModelSave with Net Prefix
  • model
  • file_path
filename_prefixdiffusion_models/ComfyUI_net

Some diffusion-model loaders and tooling expect state dict keys prefixed net. instead of ComfyUI's usual model.diffusion_model.. If you've merged, fine-tuned, or otherwise modified a model in your graph and need to hand it off to something that wants the net. convention, plain Save Checkpoint won't do it - it writes the standard ComfyUI layout. IPT-ModelSaveWithNetPrefix exists for exactly that case: it saves the loaded MODEL through ComfyUI's own checkpoint path, then rewrites the model.diffusion_model.* keys to net.* in the file's header - without re-encoding or altering a single tensor byte.

That last part is the trick worth understanding. Safetensors files store their tensor bytes and a JSON header describing keys; this node edits only the header mapping, so the operation is fast and lossless. It's a rename, not a conversion.

How it works

You feed it a loaded runtime MODEL and it calls ComfyUI's standard save_checkpoint to write the file, then rewrites the safetensors header so every model.diffusion_model.* key becomes net.*. The default filename_prefix is diffusion_models/ComfyUI_net, which lands the file under your ComfyUI output directory in the diffusion_models folder - an intentional choice that makes the output easy to find and to feed back into a diffusion-model selector. The single output is file_path (relative to the output root) so downstream steps know where it went.

Inputs and outputs

  • model (required, MODEL) - the loaded runtime model to save.
  • filename_prefix (STRING, default diffusion_models/ComfyUI_net) - output path under the ComfyUI output directory.
  • file_path (output, STRING) - where the file was written.

Installing it

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt

Restart, or ComfyUI Manager → "ComfyUI-Info-Prompt-Toolkit". ComfyUI 0.17.0+. No models to download.

Common issues

This is a niche node - if you don't know whether your target tool wants net. keys, you probably don't need it, and the standard Save Checkpoint is the safer default. The node is not_idempotent and will rewrite (and overwrite) the file at the same path on each run, so watch that you're not silently clobbering an earlier export with the same filename_prefix. And the tensor payload is untouched, which means the resulting file is exactly as good as the model you fed it - it saves what you give it, no magic. If the downstream tool then fails to load, double-check that it truly wanted the net. convention and that your model came from a compatible architecture.

CategoryInfo-Prompt-Toolkit/ImageInfo

Inputs (2)

NameTypeDefaultDescription
modelMODELLoaded runtime MODEL to save
filename_prefixSTRINGdiffusion_models/ComfyUI_netOutput prefix under the ComfyUI output directory

Outputs (1)

NameTypeDescription
file_pathSTRING