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

[WIP] Activation Aware Weight Quantization (AWQ) #743

Merged
merged 83 commits into from
Oct 7, 2024
Merged

Conversation

vayuda
Copy link
Collaborator

@vayuda vayuda commented Aug 24, 2024

Adds AWQ per #530

To do:

  • Verify correctness of implementation and add tests for this
  • Fold activation scaling into previous layer if applicable
  • Model works with compile
  • Move implementation into the right files

Copy link

pytorch-bot bot commented Aug 24, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit e7e329b with merge base 09b8b3c (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-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 Aug 24, 2024
return insert_subclass


def awq_uintx(quant_dtype: torch.dtype = torch.uint4,
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 just remove weight_quant_fn and add use_hqq to the function?

Copy link
Contributor

Choose a reason for hiding this comment

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

also when it's uint4, I think it's fine to just use TensorCoreTiledLayout

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added that as a feature so maybe people can find ways to compose on top of AWQ esp if they come up with new kernels or what not, but I would agree that its not a necessary feature for an initial release

Copy link
Contributor

@jerryzh168 jerryzh168 left a comment

Choose a reason for hiding this comment

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

looks good, thanks for addressing all the comments! I think the main thing remaining is just to use use_hqq flag for awq_uintx so we don't take a random weight_quant_fn

also make sure to fix the CI issues as well

@vayuda vayuda merged commit f81fe11 into pytorch:main Oct 7, 2024
17 checks passed
jainapurva pushed a commit that referenced this pull request Oct 9, 2024
Integrate AWQ within the TorchAO framework
jainapurva pushed a commit that referenced this pull request Oct 15, 2024
Integrate AWQ within the TorchAO framework
@HDCharles
Copy link
Contributor

this shouldn't be in generate.py, it should be in eval so we can actually see the accuracy impact

@vayuda vayuda deleted the awq branch November 10, 2024 00:04
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants