Diffusion Model Loader KJ
A UNET loader with the speed knobs built in
- MODEL
This is ComfyUI's stock "Load Diffusion Model" node with the performance switches you'd normally set via command-line flags or extra patch nodes moved onto the loader itself. Instead of loading your model and then bolting on a SageAttention node, an fp16-accumulation node, and a dtype override, you pick it all here in one place. For anyone who runs Flux, Wan, or the newer DiT models and cares about squeezing speed and VRAM, that's a genuine convenience.
What it actually does
Under the hood it's a UNET/diffusion-model loader - you point it at a weights file and it hands you a MODEL. What makes it the "KJ" version is the row of optimization options baked in:
- weight_dtype - how the weights get loaded:
default,fp8_e4m3fn,fp8_e4m3fn_fast,fp8_e5m2,fp16,bf16, orfp32. This is the big one. fp8 halves VRAM versus fp16 at near-zero quality loss - it's been the default way to run Flux-class models since 2024, and if the fp8 file fits, you just use it. The_fastvariant leans on native fp8 compute on RTX 40-series and newer cards for extra speed. - sage_attention - turn on SageAttention right here, choosing the kernel (
autois the sane pick; the list runs through the int8/fp8 variants up tosageattn3). SageAttention is a memory-efficient attention implementation that gives a real speedup - the catch is it needs Triton, which is famously painful to install on Windows. - enable_fp16_accumulation - the same thing ComfyUI's
--fastflag does, as a per-model toggle. It's a meaningful speed boost on supported models, but some (Qwen, for instance) don't play nice with fp16 accumulation, so having it on the loader means you flip it per-model instead of restarting Comfy with a different flag every time you switch.
There's also compute_dtype (default/fp16/bf16/fp32) for the math precision, patch_cublaslinear (swaps in CublasLinear for the linear layers), and an optional extra_state_dict string. The model_name dropdown is your weights file - it reads from your diffusion_models folder, so if it's empty, your model isn't where ComfyUI expects it.
The single output is MODEL, which goes wherever a model goes - LoRAs, sampler, the works.
Why bother, versus the stock loader
Two reasons. First, tidiness: one node instead of a loader plus three patch nodes. Second, and more useful, is the per-model toggling. fp16 accumulation is the clearest example - it helps most models and hurts a few, and toggling it on the loader beats maintaining two ComfyUI launch shortcuts. That's exactly the pain this consolidates.
Installing it
Comes with kijai's KJNodes pack - kijai being the person who ships the fp8 conversions for basically every new model, so a loader that foregrounds fp8 and SageAttention is on-brand.
- ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, thenpip install -r requirements.txt, and restart.
Common issues
SageAttention is the usual troublemaker. Selecting a sageattn option here does nothing if SageAttention (and Triton) aren't actually installed in your environment - the node exposes the switch, it doesn't install the dependency. On Windows that Triton install is the real work; budget for it. Leave sage_attention at disabled until you've confirmed the library imports.
Second, don't assume fp8 fits everything below 12GB. fp8 is a single point, not a ladder - under roughly 10–12GB the fp8 file stops fitting and you want GGUF's lower quant levels instead, which this loader doesn't cover. And enable_fp16_accumulation is a no-op (or worse) on models that don't support it, so if output degrades right after you flip it, that's your suspect - turn it back off for that model.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | The name of the checkpoint (model) to load. | |
| weight_dtype | COMBO | 7 options: default, fp8_e4m3fn, fp8_e4m3fn_fast, fp8_e5m2, fp16, bf16, +1 | |
| compute_dtype | COMBO | default | The compute dtype to use for the model. |
| patch_cublaslinear | BOOLEAN | false | Enable or disable the cublas_ops arg |
| sage_attention | COMBO | false | Patch comfy attention to use sageattn. |
| enable_fp16_accumulation | BOOLEAN | false | Enable torch.backends.cuda.matmul.allow_fp16_accumulation, requires pytorch 2.7.0 nightly. |
| extra_state_dictopt | STRING | 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. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |