Support convrot int4 models. - #14859
Conversation
linear_dtype in comfy_quant metadata can be used to set if the int4 op does the matrix multiplication in int8 or int4, the default is int4 on GPUs that support it with fallback to int8 for GPUs that don't.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📜 Recent review details⏰ Context from checks skipped due to timeout. (7)
🧰 Additional context used📓 Path-based instructions (3)**⚙️ CodeRabbit configuration file
Files:
⚙️ CodeRabbit configuration file
Files:
**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
comfy/**⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (3)📚 Learning: 2026-02-24T06:20:53.084ZApplied to files:
📚 Learning: 2026-02-21T14:01:41.482ZApplied to files:
📚 Learning: 2026-05-13T12:31:45.069ZApplied to files:
🪛 ast-grep (0.44.1)tests-unit/comfy_quant/test_mixed_precision.py[info] 315-315: use jsonify instead of json.dumps for JSON output (use-jsonify) 🔇 Additional comments (4)
📝 WalkthroughWalkthroughAdds ConvRot W4A4 quantization support through Comfy-Kitchen layout registration and algorithm configuration. Quantized weight loading now records ConvRot-specific metadata, state-dict serialization preserves selected parameters, and MoE expert reconstruction forwards the added layout values. The Comfy-Kitchen dependency is updated, and unit tests cover loading, layout parameters, forward computation, and metadata round-tripping. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
linear_dtype in comfy_quant metadata can be used to set if the int4 op does the matrix multiplication in int8 or int4, the default is int4 on GPUs that support it with fallback to int8 for GPUs that don't.
Here's a test model file, this model will not be very high quality because 99% of the linears are quantized to int4 (with int4 matrix mult on supported gpus) but it is good for testing: https://huggingface.co/comfyanonymous/int4_tests/blob/main/split_files/diffusion_models/krea2_turbo_convrot_int4_fast.safetensors
A proper quant would have a mix of: pure convrot int4, convrot int4 with int8 matrix mult, convrot int8 and 16 bit precision linears to get the best speed/size/quality.