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

Autoquant Config #368

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Autoquant Config #368

wants to merge 1 commit into from

Conversation

HDCharles
Copy link
Contributor

@HDCharles HDCharles commented Jun 14, 2024

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:

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:
Copy link

pytorch-bot bot commented Jun 14, 2024

🔗 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 Failures

As of commit fa0ebfb with merge base bc2f8b7 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 14, 2024
@@ -513,3 +513,42 @@ def clean_up_autoquant_hooks_and_attrs():
model(*example_input)

return model

class AutoQuantConfig:
Copy link
Member

@msaroufim msaroufim Jun 14, 2024

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?

Copy link
Contributor Author

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?

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants