-
Notifications
You must be signed in to change notification settings - Fork 87
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
Autoquant Config #368
base: main
Are you sure you want to change the base?
Autoquant Config #368
Conversation
Summary: this adds support for an autoquant config aq_config = AutoQuantConfig(model) or aq_config = AutoQuantConfig(file_path) ... aq_config.apply_to_model(model) aq_config.save(file_path) Test Plan: python test_integration.py -k "test_autoquant_config" Reviewers: Subscribers: Tasks: Tags:
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/368
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit fa0ebfb with merge base bc2f8b7 (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@@ -513,3 +513,42 @@ def clean_up_autoquant_hooks_and_attrs(): | |||
model(*example_input) | |||
|
|||
return model | |||
|
|||
class AutoQuantConfig: |
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.
sorry I keep harping on names :P
But this sounds like it's a Cache instead?
In which case wouldn't something like this be clearer torch.autoquant(model, cache_path = "test.pkl")
which would call apply_to_model()
on behalf of the user?
And shouldn't you always save
because most users would want shorter quantization times unless they're debugging cache issues?
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.
The cache (https://github.com/pytorch/ao/blob/main/torchao/quantization/autoquant.py#L22) is something different. I still need to write automatic serialization for that.
unless you're saying this new thing is reall a Cache? How would you define the difference between a cache and a 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 of configs as a class representing a common set of input arguments to a function while a cache is something that saves the result of some search process
Summary: this adds support for an autoquant config
#creating a AutoQuantConfig
aq_config = AutoQuantConfig(model)
#quantizing a model using hte AutoQuantConfig
aq_config.apply_to_model(model)
#save/load an AutoQuantConfig
aq_config.save(file_path)
aq_config.load(file_path) or AutoQuantConfig(file_path)
Test Plan:
python test_integration.py -k "test_autoquant_config"
Reviewers:
Subscribers:
Tasks:
Tags: