-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[quant] Attach qconfig to all modules #42576
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: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 7b89e56 Pull Request resolved: #42576
💊 CI failures summary and remediationsAs of commit 998586a (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
|
|
||
| if type(module) in white_list: | ||
| module.qconfig = module_qconfig | ||
| module.qconfig = module_qconfig |
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.
How do we make sure only the ones that are allowed are getting the qconfig?
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, I realized that, just updated the diff. Ideally we don't have people using this "white_list" API, otherwise we'll need to make changes to callsite.
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.
The numeric suite tests might be impacted by this change, please check if they are passing prior to landing.
|
btw, what's the context for this change? Is this for GraphModule, for adding finer grain control such as "don't quantize stateless aten op X", something else? |
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: regression tests Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D22939453](https://our.internmc.facebook.com/intern/diff/D22939453) [ghstack-poisoned]
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 01614db Pull Request resolved: #42576
Yeah this is for graphmodule, we need to attach qconfig to the parent_module to be able to quantize the ops in the forward of that module. for example: class Linear(torch.nn.Module):
def __init__(self, weight):
super().__init__()
def forward(self, x, weight):
return F.linear(x, weight) |
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: regression tests Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D22939453](https://our.internmc.facebook.com/intern/diff/D22939453) [ghstack-poisoned]
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 38b8608 Pull Request resolved: #42576
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: regression tests Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D22939453](https://our.internmc.facebook.com/intern/diff/D22939453) [ghstack-poisoned]
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 545c486 Pull Request resolved: #42576
torch/quantization/quantize.py
Outdated
| if hasattr(module, 'qconfig') and module.qconfig is not None and \ | ||
| len(module._modules) == 0 and not isinstance(module, torch.nn.Sequential): | ||
| len(module._modules) == 0 and not isinstance(module, torch.nn.Sequential) \ | ||
| and type(module) in DEFAULT_QCONFIG_PROPAGATE_WHITE_LIST: |
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 should be using white_list instead of DEFAULT_QCONFIG_PROPAGATE_WHITE_LIST
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.
Had a few questions. Thanks!
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: regression tests Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D22939453](https://our.internmc.facebook.com/intern/diff/D22939453) [ghstack-poisoned]
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: b8287c7 Pull Request resolved: #42576
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: regression tests Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D22939453](https://our.internmc.facebook.com/intern/diff/D22939453) [ghstack-poisoned]
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: regression tests Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D22939453](https://our.internmc.facebook.com/intern/diff/D22939453) [ghstack-poisoned]
Summary: Previously we have qconfig propagate list and we only attach qconfig for modules in the list, this works when everything is quantized in the form of module. but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig to all modules Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 4629ad4 Pull Request resolved: #42576
|
This pull request has been merged in ac93d45. |
Stack from ghstack:
Summary:
Previously we have qconfig propagate list and we only attach qconfig for modules
in the list, this works when everything is quantized in the form of module.
but now we are expanding quantization for functional/torch ops, we'll need to attach qconfig
to all modules
Test Plan:
regression tests
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D22939453