-
Activate ComfyUI's venv.
-
Copy config from
configs/and customize yours.
Rules are matched top-to-bottom (first match = highest priority/fallback){ "format": "comfy_quant", "block_names": ["net.blocks."], "rules": [ { "policy": "keep", "match": ["blocks.0."] }, { "policy": "float8_e4m3fn", "match": ["v_proj", "adaln_modulation", ".mlp"] }, { "policy": "nvfp4", "match": ["k_proj", "q_proj", "output_proj"] } ] } -
Run quantize.py with:
python quantize.py your_config.json model.safetensors output.safetensors
NVFP4 requires input scale calibration.
-
Setup ComfyUI:
- Apply patches from
patch/directory to ComfyUI - Copy
patch/extra/calibration.py→ComfyUI/extra/ - Run ComfyUI with:
COMFY_CALIB=1 python3 main.py ...
- Apply patches from
-
Generate calibration data:
- Use your NVFP4-quantized model for normal image generation
- This creates
CALIB_DATA.json
-
Apply calibration:
python add_input_scale.py CALIB_DATA.json uncalibrated_model.safetensors output.safetensors
-
Verify: Test generation with the calibrated model.
Group-wise Hadamard rotation for INT8 quantization quality improvement.
Uses the Kronecker construction from ConvRot (2025) Theorem 3.3.
Originally from: https://github.com/newgrit1004/ComfyUI-ZImage-Triton
License: MIT