Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Open
sayakpaul wants to merge 5 commits into main
base: main
Choose a base branch
Loading
from aobaseconfig

Conversation

Copy link
Member

@sayakpaul sayakpaul commented Sep 3, 2025

What does this PR do?

The AOBaseConfig classes introduced in torchao (since 0.9.0) are more flexible. Similar to Transformers, this PR adds support for allowing them in Diffusers:

from diffusers import DiffusionPipeline, TorchAoConfig, PipelineQuantizationConfig
from torchao.quantization import Int8WeightOnlyConfig
import torch 
ckpt_id = "black-forest-labs/FLUX.1-dev"
pipeline_quant_config = PipelineQuantizationConfig(
 quant_mapping={"transformer": TorchAoConfig(Int8WeightOnlyConfig())}
)
pipe = DiffusionPipeline.from_pretrained(
 ckpt_id, quantization_config=pipeline_quant_config, torch_dtype=torch.bfloat16
).to("cuda")
_ = pipe("dog", num_inference_steps=2)

@stevhliu, would it be possible for you to propagate the relevant changes to our TorchAO docs from Transformers? Can happen in a later PR.

stevhliu, jerryzh168, and danielvegamyhre reacted with thumbs up emoji

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

@jerryzh168 jerryzh168 Sep 8, 2025

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

Copy link
Member Author

@sayakpaul sayakpaul Sep 9, 2025

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 <spsayakpaul@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@a-r-r-o-w a-r-r-o-w Awaiting requested review from a-r-r-o-w

@DN6 DN6 Awaiting requested review from DN6

@SunMarc SunMarc Awaiting requested review from SunMarc

1 more reviewer

@jerryzh168 jerryzh168 jerryzh168 left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /