-
Notifications
You must be signed in to change notification settings - Fork 22.2k
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][fx] store dtype, axis as literals in the graph #54624
Conversation
Summary: previously we were creating setattr nodes for dtype and axis. The FX convention is that primitive types are embedded as literals in args/kwargs. With this change we won't see getattr nodes in the graph anymore for dtype/axis Test Plan: python test/test_quantization.py TestQuantizeFx Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 574efc3 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This 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 to the (internal) Dr. CI Users group. |
Summary: previously we were creating setattr nodes for dtype and axis. The FX convention is that primitive types are embedded as literals in args/kwargs. With this change we won't see getattr nodes in the graph anymore for dtype/axis Test Plan: python test/test_quantization.py TestQuantizeFx Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: b557e35c1303fe624d6cdaf5011d65e702c9e509 Pull Request resolved: #54624
do we need "dtype" to appear in state_dict? |
I don't think so. I think this change existed even before we added support for scale/zero_point to appear in the state_dict. Since we never call register_buffer for dtype, it was never part of state_dict. |
so only scale/zero_point need to be loaded from state_dict, dtype is fixed? |
Yes, the dtype information is retrieved from the qconfig, so it doesn't need to be stored in the state_dict. As long as we use the same config at load time, it should match. |
I see, sounds good. |
Codecov Report
@@ Coverage Diff @@
## gh/supriyar/220/base #54624 +/- ##
========================================================
- Coverage 77.47% 77.08% -0.40%
========================================================
Files 1893 1893
Lines 185921 185918 -3
========================================================
- Hits 144043 143307 -736
- Misses 41878 42611 +733 |
This pull request has been merged in a0a7a2d. |
Stack from ghstack:
Summary:
previously we were creating setattr nodes for dtype and axis.
The FX convention is that primitive types are embedded as literals in args/kwargs.
With this change we won't see getattr nodes in the graph anymore for dtype/axis
Test Plan:
python test/test_quantization.py TestQuantizeFx
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D27306898