Diffusion Model Loader KJ(DiffusionModelLoaderKJ)
This node provides fine-grained control over weight data types and computational data types when loading models, supporting various precision formats from fp8 to fp32.
Diffusion Model Loader KJ
The Diffusion Model Loader KJ node provides fine-grained control over weight data types and computation data types when loading models, supporting various precision formats from fp8 to fp32.
Diffusion Model Loader KJ is a node for loading and configuring diffusion models (such as Stable Diffusion). Its core function is to load model files from a specified path and allows users to adjust the numerical precision and computational behavior of the model at runtime to optimize performance or compatibility.
Node Features
This node provides fine-grained control over weight data types and computation data types when loading models, supporting various precision formats from fp8 to fp32. Its key technical features include an optional CublasLinear patch to leverage specific GPU acceleration libraries, integration capability for the SageAttention mechanism, and support for merging or enhancing model functionality via additional state dictionaries (e.g., adding a VACE module to a video model).
Node Parameter Description - Diffusion Model Loader KJ
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
model_name | COMBO | Yes | - | - | Select the diffusion model file to load. This parameter lists all available models from the model directories managed by ComfyUI. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
weight_dtype | COMBO | Yes | default | default, fp8_e4m3fn, fp8_e4m3fn_fast, fp8_e5m2, fp16, bf16, fp32 | Used to balance memory usage and computational precision. |
compute_dtype | COMBO | Yes | default | default, fp16, bf16, fp32 | Affecting computation speed and numerical stability. |
patch_cublaslinear | BOOLEAN | Yes | False | - | Enable or disable the cublas_ops arg |
sage_attention | COMBO | Yes | False | false, true | Patch comfy attention to use sageattn. |
enable_fp16_accumulation | BOOLEAN | Yes | False | - | Enable torch.backends.cuda.matmul.allow_fp16_accumulation, requires pytorch 2.7.0 nightly. |
extra_state_dict | STRING | No | - | - | The full path to an additional state dict to load, this will be merged with the main state dict. Useful for example to add VACE module to a WanVideoModel. You can use DiffusionModelSelector to easily get the path. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| MODEL | MODEL | Outputs the loaded and configured model for use by subsequent nodes. |
Usage Scenarios
This node is very useful in workflows that require loading a base model and applying specific optimizations or functional extensions. For example, you can first use this node to load a WanVideoModel, then merge a state dictionary for a VACE module via the extra_state_dict parameter, thereby constructing a functionally enhanced video generation model.
Notes
This node belongs to the experimental category. Some features (such as enable_fp16_accumulation) require specific versions of PyTorch (e.g., 2.7.0 nightly) to function properly. Before using advanced data types (like fp8) or patch features, please ensure your hardware and software environment supports them.
Diffusion Model Loader KJ Node Source Code Link
The Diffusion Model Loader KJ node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.