-
Notifications
You must be signed in to change notification settings - Fork 6.3k
[quantization] feat: support aobaseconfig classes in TorchAOConfig
#12275
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
base: main
Are you sure you want to change the base?
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
||
quantization_config = TorchAoConfig(Int8WeightOnlyConfig()) | ||
|
||
# String-based config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can deprecate this one since this is less scalable than AOBaseConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will do so after this PR. Meanwhile, if you could review the PR, it'd be helpful.
init Co-authored-by: Sayak Paul <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this !
) | ||
|
||
if isinstance(self.quant_type, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: merge this with the branch in L521 to keep relevant things relevant together?
if isinstance(self.quant_type, str): | ||
methods = self._get_torchao_quant_type_to_method() | ||
quant_type_kwargs = self.quant_type_kwargs.copy() | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably clean this up in the future..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, would be good to put up a deprecation plan for torchao version support and clean up the old code for str support I think, I don't think there is any reason why people can't upgrade to the most recent version currently
@jerryzh168 thanks for your reviews! I agree that it will make the library codebase cleaner if we started a deprecation cycle to promote the |
What does this PR do?
The
AOBaseConfig
classes introduced intorchao
(since 0.9.0) are more flexible. Similar to Transformers, this PR adds support for allowing them in Diffusers:@stevhliu, would it be possible for you to propagate the relevant changes to our TorchAO docs from Transformers? Can happen in a later PR.