Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuantizedModel: support group_size -1 (per-channel) #1244

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

jambayk
Copy link
Contributor

@jambayk jambayk commented Feb 12, 2025

Both gptq and awq support per channel quantization. This is represented using group_size = -1. But the builder is not able to handle this case.

This PR makes group_size into a property that returns in_features if _group_size == -1. The group size cannot be set during init since in_features is set after init.

Note: The resultant MatMulNBits node might be invalid if the group_size is not supported by the operator kernel, but it can be converted into a valid DQ -> MatMul. This can be done either in the builder or subsequently using an olive pass https://github.com/microsoft/Olive/blob/50f360aeacfb949abc0d845e4070922555f7c58a/olive/passes/onnx/mnb_to_qdq.py#L27.

This PR also fixes this issue.

@jambayk jambayk merged commit e0123fc into main Feb 12, 2025
14 checks passed
@jambayk jambayk deleted the jambayk/quant-per-channel branch February 12, 2025 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Builder does not support group_size: -1 for quantized models
3 participants