-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[quant][eagermode] Custom module support #44835
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
Conversation
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23745086](https://our.internmc.facebook.com/intern/diff/D23745086) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 6e66c85 (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 27 times. |
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23745086](https://our.internmc.facebook.com/intern/diff/D23745086) [ghstack-poisoned]
| if type(mod) not in SWAPPABLE_MODULES: | ||
| # both swappable modules and observed custom modules are | ||
| # swapped as one unit | ||
| if type(mod) not in SWAPPABLE_MODULES and \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we support custom module fusion, we will need to change code here. Currently, it looks like Swappable modules defines the list of fusions that are supported. Thoughts on how this can be addressed? There main use case would be : nn.module A + nn.module B => Custom Fused Module C
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can make this configuration with registrations as well, can be done in a separate PR before we need this feature
| self.checkDynamicQuantizedModule(quantized_model.emb, torch.nn.quantized.EmbeddingBag, torch.quint8) | ||
|
|
||
| @skipIfNoFBGEMM | ||
| def test_custom_module_class(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar request as in the previous PR, lets add tests for each of the workflows (PTQ, Dynamic and QAT) and also for modules with multiple input/outputs (LSTMs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for dynamic/qat, will do that after the mixed mode support change.
lstm test will be done after zafar write the lstm pr. but I'll add multiple input/output support in a separate PR
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23745086](https://our.internmc.facebook.com/intern/diff/D23745086) [ghstack-poisoned]
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23745086](https://our.internmc.facebook.com/intern/diff/D23745086) [ghstack-poisoned]
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23745086](https://our.internmc.facebook.com/intern/diff/D23745086) [ghstack-poisoned]
z-a-f
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| if type(mod) not in SWAPPABLE_MODULES: | ||
| # both swappable modules and observed custom modules are | ||
| # swapped as one unit | ||
| if type(mod) not in SWAPPABLE_MODULES and \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: will the SWAPPABLE_MODULES be a globa variable, or are we planning on replacing it with a getter function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah we can do that when there is a need
raghuramank100
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can add more tests like requested in the other PR for both eager and IR custom module support, that would be great.
Codecov Report
@@ Coverage Diff @@
## gh/jerryzh168/437/base #44835 +/- ##
=========================================================
Coverage ? 67.92%
=========================================================
Files ? 385
Lines ? 50169
Branches ? 0
=========================================================
Hits ? 34079
Misses ? 16090
Partials ? 0 Continue to review full report at Codecov.
|
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23745086](https://our.internmc.facebook.com/intern/diff/D23745086) [ghstack-poisoned]
Summary: This is for feature parity with fx graph mode quantization Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23745086](https://our.internmc.facebook.com/intern/diff/D23745086) [ghstack-poisoned]
|
This pull request has been merged in f93ead6. |
Stack from ghstack:
Summary:
This is for feature parity with fx graph mode quantization
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D23745086