Skip to content

Conversation

jerryzh168
Copy link
Contributor

Summary:
This is to support AWQ for gemma3

Test Plan:
Before change:

File "/data/users/jerryzh/ao/.github/scripts/torchao_model_releases/quantize_gemma3.py", line 59, in <module>
    TransformerEvalWrapper(
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/torchao-0.14.0+gitb47f1a36-py3.10.egg/torchao/_models/_eval.py", line 82, in run_eval
    result = evaluate(
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/utils.py", line 456, in _wrapper
    return fn(*args, **kwargs)
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/evaluator.py", line 585, in evaluate
    resps = getattr(lm, reqtype)(cloned_reqs)
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/api/model.py", line 391, in loglikelihood
    return self._loglikelihood_tokens(new_reqs, disable_tqdm=disable_tqdm)
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/models/huggingface.py", line 1279, in _loglikelihood_tokens
    multi_logits = F.log_softmax(
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/torch/nn/functional.py", line 2245, in log_softmax
    ret = input.log_softmax(dim)
AttributeError: 'Gemma3CausalLMOutputWithPast' object has no attribute 'log_softmax'
Running loglikelihood requests:   0%|

After change:
quantize_qwen3.py: https://gist.github.com/jerryzh168/85cc75bc1feb4723fddb156582adc6ad Uploaded checkpoint after the change: https://huggingface.co/jerryzh168/gemma-3-12b-it-AWQ-INT4

Reviewers:

Subscribers:

Tasks:

Tags:

Summary:
This is to support AWQ for gemma3

Test Plan:
Before change:
```
File "/data/users/jerryzh/ao/.github/scripts/torchao_model_releases/quantize_gemma3.py", line 59, in <module>
    TransformerEvalWrapper(
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/torchao-0.14.0+gitb47f1a36-py3.10.egg/torchao/_models/_eval.py", line 82, in run_eval
    result = evaluate(
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/utils.py", line 456, in _wrapper
    return fn(*args, **kwargs)
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/evaluator.py", line 585, in evaluate
    resps = getattr(lm, reqtype)(cloned_reqs)
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/api/model.py", line 391, in loglikelihood
    return self._loglikelihood_tokens(new_reqs, disable_tqdm=disable_tqdm)
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/lm_eval/models/huggingface.py", line 1279, in _loglikelihood_tokens
    multi_logits = F.log_softmax(
  File "/home/jerryzh/.conda/envs/hmbd/lib/python3.10/site-packages/torch/nn/functional.py", line 2245, in log_softmax
    ret = input.log_softmax(dim)
AttributeError: 'Gemma3CausalLMOutputWithPast' object has no attribute 'log_softmax'
Running loglikelihood requests:   0%|
```

After change:
quantize_qwen3.py: https://gist.github.com/jerryzh168/85cc75bc1feb4723fddb156582adc6ad
Uploaded checkpoint after the change: https://huggingface.co/jerryzh168/gemma-3-12b-it-AWQ-INT4

Reviewers:

Subscribers:

Tasks:

Tags:
Copy link

pytorch-bot bot commented Sep 26, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit feae967 with merge base b47f1a3 (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 Sep 26, 2025
@jerryzh168 jerryzh168 added the topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories) label Sep 26, 2025
@jerryzh168 jerryzh168 merged commit 2a98f58 into pytorch:main Sep 26, 2025
19 of 20 checks passed
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: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants