Save Int4 Model
Bake your quantized checkpoint once, never re-quantize again
- model
The companion to the pack's loader, and the answer to a specific pain: on-the-fly INT4 quantization happens every time you load the model. That's fine for a test, miserable for a checkpoint you use daily. Save Int4 Model turns your quantized model into a permanent .safetensors on disk - the same convrot_w4a4 format comfyanonymous ships pre-quantized models in - so next time you just load the file and skip the whole quantization pass.
Think of it like this: load a float checkpoint with the INT4 loader, run this node once, and you've made your own private quantized release. It also exists because the author wanted an end-to-end quantization toolkit, not just a loader - quantize, save, share, reload.
How it works
It's a save node, so it has no outputs and is a dead end in the graph, exactly like the core Save Checkpoint. Two inputs, and you only ever touch one:
- model - the
MODELcoming out of the pack's loader (or any loaded model). - filename_prefix - a string, default
int4_models/INT4_Model. Files land in your ComfyUIoutputdirectory, with a counter appended (INT4_Model_00001_.safetensors).
Under the hood it walks the model, finds the layers holding QuantizedTensor weights, and writes them out with per-tensor weight_scale keys plus a comfy_quant metadata block per layer recording the format (convrot_w4a4), the convrot group size, and the quant group size. That metadata is what the loader reads back to know how each layer was quantized. It also pulls the original checkpoint's safetensors metadata through, and materializes any baked LoRA patches before saving so they're locked into the file.
What to actually do with it
- Load your model with the INT4 loader,
on_the_fly_quantizationchecked, from a BF16/FP16 checkpoint (not FP8 - the pack fixed a static-noise bug on that path). - Set
lora_modetoNoneorStochasticif you want LoRAs baked in.Dynamicapplies them at inference and doesn't make sense to save as a one-off. - Wire the loader's
MODELinto this node, give it a prefix, run once. - Copy the resulting file into
models/diffusion_models, and from then on load it withon_the_fly_quantizationunchecked.
Gotchas worth knowing
- The save step is memory-heavy. The node force-loads the full model onto the GPU (
load_models_gpuwith full load) before writing. On a small card that's the moment of truth - it's a serialization pass, not inference, so it can be slower than you expect. - Watch the console for a metadata warning. If it can't trace the source safetensors metadata back through the patcher chain, it saves anyway but logs that the file is missing its
int4_quantized/int4_model_typemetadata. A file saved without that will still load, but the loader has less to work with. - It's not for normalizing float models. This is specifically for the INT4 path; if you're just trying to merge LoRAs into a plain model, the core save node does that.
Install
It ships in the same pack as the loader, so one install gets you both: ComfyUI Manager (search "ComfyUI-INT4-Fast"), or
cd ComfyUI/custom_nodes/
git clone https://github.com/viralvfx/ComfyUI-INT4-Fast.git
restart, and make sure ComfyUI is current and comfy-kitchen is installed - it's the QuantizedTensor execution layer this pack is built on. First save after a fresh install runs slow while Triton operators compile; subsequent ones are quick.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| filename_prefix | STRING | int4_models/INT4_Model | — |
Outputs (0)
No outputs