Skip to content

from 1.11.0, torchao.prototype.low_bit_optim is promoted to torchao.optim #38689

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

Merged
merged 5 commits into from
Jun 11, 2025

Conversation

yao-matrix
Copy link
Contributor

per https://github.com/pytorch/ao/tree/main/torchao/prototype, from1.11.0, torchao.prototype.low_bit_optim is promoted to torchao.optim, so will have AttributeError: module 'torchao.prototype' has no attribute 'low_bit_optim' w/ torchao 1.11.0.

@ydshieh , pls help review, thx.

@ydshieh ydshieh requested a review from SunMarc June 9, 2025 10:54
@Rocketknight1
Copy link
Member

cc @MekkCyber

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Thanks, just a nit

Comment on lines 5373 to 5376
has_torchao_optim = version.parse(importlib.metadata.version("torchao")) >= version.parse("0.11.0")
AdamW4bitModule = torchao.optim.AdamW4bit if has_torchao_optim else torchao.prototype.low_bit_optim.AdamW4bit
AdamW8bitModule = torchao.optim.AdamW8bit if has_torchao_optim else torchao.prototype.low_bit_optim.AdamW8bit

Copy link
Member

Choose a reason for hiding this comment

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

just fix the import, we will always use the latest version of torchao

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SunMarc , done, pls take a look, thx

@yao-matrix yao-matrix changed the title from1.11.0, torchao.prototype.low_bit_optim is promoted to torchao.optim from 1.11.0, torchao.prototype.low_bit_optim is promoted to torchao.optim Jun 10, 2025
@SunMarc SunMarc enabled auto-merge (squash) June 11, 2025 12:03
@SunMarc SunMarc merged commit c8c1e52 into huggingface:main Jun 11, 2025
11 checks passed
@HuggingFaceDocBuilderDev

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.

@yao-matrix yao-matrix deleted the torchao-fix branch June 11, 2025 13:40
lmarshall12 pushed a commit to lmarshall12/transformers that referenced this pull request Jun 12, 2025
…ptim (huggingface#38689)

* since 1.11.0, torchao.prototype.low_bit_optim is promoted to
torchao.optim

Signed-off-by: YAO Matrix <[email protected]>

* fix review comments

Signed-off-by: YAO Matrix <[email protected]>

---------

Signed-off-by: YAO Matrix <[email protected]>
Co-authored-by: Marc Sun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants