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

is_linear fix for MHA #1141

Merged
merged 4 commits into from
Oct 25, 2024
Merged

is_linear fix for MHA #1141

merged 4 commits into from
Oct 25, 2024

Conversation

HDCharles
Copy link
Contributor

@HDCharles HDCharles commented Oct 22, 2024

Summary: filter fn may need access to parent types of module as in the case with mha

Test Plan: python /home/cdhernandez/local/ao/test/integration/test_integration.py -k "test_autoquant_mha"

Reviewers:

Subscribers:

Tasks:

Tags:

Copy link

pytorch-bot bot commented Oct 22, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 4f45e03 with merge base 4b563f2 (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 Oct 22, 2024
@HDCharles HDCharles changed the title [wip] fix for mha is_linear fix for MHA Oct 22, 2024
@@ -234,6 +234,7 @@ def _is_linear(mod, *args):
and not isinstance(mod.weight, AffineQuantizedTensor)
and not isinstance(mod.weight, LinearActivationQuantizedTensor)
and not isinstance(mod.weight, AffineFakeQuantizedTensor)
and not isinstance(mod, nn.modules.linear.NonDynamicallyQuantizableLinear)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe add a Note here, to say that if MHA is refactored to not use this module we'd need a different solution

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!

@@ -1278,6 +1278,32 @@ def test_autoquant_compile(self, device, dtype, m1, m2, k, n):
sqnr = SQNR(out, out2)
self.assertTrue(sqnr >= 30)

@parameterized.expand(COMMON_DEVICE_DTYPE)
@unittest.skipIf(not TORCH_VERSION_AT_LEAST_2_5, "autoquant requires 2.5+.")
Copy link
Contributor

Choose a reason for hiding this comment

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

according to CI, probably need to add skip if cuda is not available, or change this

COMMON_DEVICES = ["cpu", "cuda"]
to not include cuda when it's not available

Summary: filter fn may need access to parent types of module as in the
case with mha

Test Plan: TODO

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@HDCharles HDCharles merged commit fec5420 into main Oct 25, 2024
17 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants