Skip to content

[BE] Convert quantization internal methods private #2568

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jainapurva
Copy link
Contributor

@jainapurva jainapurva commented Jul 17, 2025

As a part of clean code, we're converting internal implementations private and removing old deprecated APIs.

  • torchao/quantization/autoquant.py

    • check_cache -> _check_cache
    • update_cache -> _update_cache
  • torchao/quantization/utils.py

    • guard_dtype_size -> _guard_dtype_size
    • quant_int8_per_token_matmul -> _quant_int8_per_token_matmul

Copy link

pytorch-bot bot commented Jul 17, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2568

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 9b6df39 with merge base 460aaed (image):
💚 Looks good so far! There are no failures yet. 💚

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

@meta-cla meta-cla 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 Jul 17, 2025
@jainapurva jainapurva added topic: bc-breaking Use this tag if this PR breaks backward compatibility topic: for developers Use this tag if this PR is mainly developer facing labels Jul 17, 2025
Copy link
Contributor

@andrewor14 andrewor14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, seems like there may be more functions in these two files that can be privatized

@@ -66,11 +66,11 @@
AUTOQUANT_CACHE = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also make this one private?

@@ -33,10 +32,8 @@

__all__ = [
"compute_error",
"_apply_logging_hook",
"quantize_activation_per_token_absmax",
"quant_int8_dynamic_per_token_linear",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which other functions in this list can also be privatized? Looks like these 2 at least aren't used outside of torchao (and I don't think we intend them to be). Seems like there are a few more

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. topic: bc-breaking Use this tag if this PR breaks backward compatibility topic: for developers Use this tag if this PR is mainly developer facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants