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
[quant][graphmode][fx][fix] Fix observer insert logic for ops that inherits quantization parameters for input #45473
Conversation
…herits quantization parameters for input Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 133bcad (more details on the Dr. CI page):
7 failures not recognized by patterns:
🚧 6 fixed upstream failures:These were probably caused by upstream breakages that were already fixed.
Please rebase on the
|
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
…herits quantization parameters for input Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: d4033c47e1fd672ada0d7b4018c157e4677dc6e9 Pull Request resolved: #45473
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
…herits quantization parameters for input Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: eab591ce82e2fea5e6f54bb078d5a1bac0dfa8ab Pull Request resolved: #45473
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
env[node.name] = observed_graph.create_node('call_module', observer_name, (load_arg(node),), {}) | ||
activation_post_process_name_map[node.name] = observer_name |
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.
Shouldn't this be self.activation_post_process
?
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.
oh this is storing the names of activation_post_process modules, since we need this information when we insert observer calls, and it's not stored anywhere else.
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.
this can be a local variable since it's just needed when we process the graph
torch/quantization/fx/quantize.py
Outdated
# use the same observer as input | ||
observed_input = node.args[0] | ||
if observed_input.name in activation_post_process_name_map: | ||
print('inserting observer of input', observed_input.target) |
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.
Extra print statement?
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.
Left couple comments that need to be addressed.
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
…ops that inherits quantization parameters for input" Summary: Currently we don't insert observer for the output, but we actually need to use input observer for the output to be consistent with the transformation we are doing. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23981312](https://our.internmc.facebook.com/intern/diff/D23981312) [ghstack-poisoned]
this is not needed anymore, we plan to observe the output for all the ops that inherits quantization parameters (e.g. average pool) and ops that currently have fixed quantization parameters (e.g. sigmoid). |
Stack from ghstack:
Summary:
Currently we don't insert observer for the output, but we actually need to
use input observer for the output to be consistent with the transformation
we are doing.
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D23981312