Model Save KJ(ModelSaveKJ)
From a technical implementation perspective, this node receives an input of type `MODEL` and obtains the model's parameter dictionary through the `state_dict_for_saving` method.
Model Save KJ
From a technical implementation perspective, this node receives an input of type MODEL and obtains the model's parameter dictionary via the state_dict_for_saving method.
Model Save KJ is a node used for saving the weights of processed or merged diffusion models. Its core function is to persist models from the workflow to disk in .safetensors format, allowing users to customize the save path and the key name prefix within the model. This node does not output any data; it only performs the save operation.
Node Functionality
From a technical implementation perspective, this node receives an input of type MODEL and obtains the model's parameter dictionary via the state_dict_for_saving method. Its core mechanism lies in allowing users to specify a model_key_prefix to replace the default key name prefix (model.diffusion_model.) in the model's parameter dictionary. The processed parameter dictionary is then saved as a .safetensors file. This provides flexibility for subsequent loading into other frameworks or tools that support different key name conventions.
Node Parameter Description - Model Save KJ
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
model | MODEL | Yes | - | - | Specifies the model object to be saved. This is the core data source for the node's operation. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
filename_prefix | STRING | Yes | diffusion_models/ComfyUI | - | Defines the path prefix and base filename for the saved file. By default, it is saved in the output directory under the path diffusion_models/ComfyUI, and a sequence number is automatically appended to the filename. |
model_key_prefix | STRING | Yes | model.diffusion_model. | - | Specifies the new string used to replace the original key name prefix in the saved model file. The default value is model.diffusion_model.. Modifying this value can adapt the model to the loading requirements of different frameworks. |
Usage Scenarios
A typical usage scenario is after a model merging or fine-tuning workflow. For example, after fusing and adjusting a base model with multiple LoRA models, you can save the final generated model using this node. This allows you to directly load this custom model in other projects or other ComfyUI workflows without repeating the entire complex merging process.
Model Save KJ Node Source Code Link
The Model Save KJ node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.