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

Enable autoquant for CPU userbenchmark #2547

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

Conversation

zxd1997066
Copy link
Contributor

No description provided.

@zxd1997066 zxd1997066 changed the title Enable auto_quant for CPU userbenchmark Enable autoquant for CPU userbenchmark Nov 25, 2024
change_linear_weights_to_int8_dqtensors,
change_linear_weights_to_int8_woqtensors,
)
if model.device == "cuda":
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep original behavior in here, suggest to change as

if model.device == "cpu":
    xxx
else:
    original path

if args.quantization == "auto_quant":
module, example_inputs = model.get_module()
with torch.no_grad():
module=torchao.autoquant(torch.compile(module, mode='max-autotune'))
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need compile the module before autoquant? and why we need to hard code the compile mode as max-autotune? Can we follow similar style with original part?

elif args.quantization == "int4weightonly":
change_linear_weights_to_int4_woqtensors(module)
elif model.device == "cpu" and model.test == "eval":
if args.quantization == "auto_quant":
Copy link
Contributor

Choose a reason for hiding this comment

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

add else statement to warining that the other quant modes are still not support for cpu device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants