Edward Z. Yang
3bf922a6ce
Apply UFMT to low traffic torch modules ( #106249 )
...
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/106249
Approved by: https://github.com/Skylion007
2023-07-29 23:37:30 +00:00
Vasiliy Kuznetsov
1577c106dc
torch.ao migration: numeric suite, eager and fx ( #64817 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64817
This migrates `torch.quantization._numeric_suite` to `torch.ao.ns._numeric_suite`, and `torch.quantization._numeric_suite_fx` to `torch.ao.ns._numeric_suite_fx`.
1. move the files
```
HG: move eager mode
hg mv caffe2/torch/quantization/_numeric_suite.py caffe2/torch/ao/ns/
HG: move fx
hg mv caffe2/torch/quantization/_numeric_suite_fx.py caffe2/torch/ao/ns/
hg mv caffe2/torch/quantization/ns/* caffe2/torch/ao/ns/fx/
```
2. create new versions of `_numeric_suite.py` and `_numeric_suite_fx.py` with
imports
3. update all FB callsites
Test Plan: buck test mode/dev //caffe2/test:quantization
Reviewed By: z-a-f
Differential Revision: D30867538
fbshipit-source-id: 120ee830434ca490c1183a187a518eebcbbaf22c
2021-09-12 12:00:45 -07:00
Sam Estep
75024e228c
Add lint for unqualified type: ignore ( #56290 )
...
Summary:
The other half of https://github.com/pytorch/pytorch/issues/56272 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56290
Test Plan:
CI should pass on the tip of this PR, and we know that the lint works because the following CI runs (before this PR was finished) failed:
- https://github.com/pytorch/pytorch/runs/2384511062
- https://github.com/pytorch/pytorch/actions/runs/765036024
Reviewed By: seemethere
Differential Revision: D27867219
Pulled By: samestep
fbshipit-source-id: e648f07b6822867e70833e23ddafe7fb7eaca235
2021-04-21 08:07:23 -07:00
Vasiliy Kuznetsov
929b91a24d
ns_eager: rename Logger I/O var names to logger_cls ( #51359 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51359
`Logger` is the name of the base Logger class. It's confusing that
it is also used as a variable name, which can represent this class
or its subclasses. Renaming to `logger_cls` to make it clearer.
Test Plan:
```
python test/test_quantization.py TestEagerModeNumericSuite
```
Imported from OSS
Reviewed By: supriyar
Differential Revision: D26149577
fbshipit-source-id: a9c12f9446f66e5c683ab054b2a94aeb0cf9cc8a
2021-02-09 22:30:44 -08:00
Raghuraman Krishnamoorthi
14273126d2
Numeric Suite: Swap with shadow modules only for quantized part of model ( #51052 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51052
Ensure that shadow modules are inserted only for quantized modules in a model. Removes redundant module insertion.
ghstack-source-id: 121041113
Test Plan: buck test caffe2/test:quantization -- 'test_compare_model_stub_partial \(quantization\.test_numeric_suite\.TestEagerModeNumericSuite\)'
Reviewed By: vkuzo
Differential Revision: D26054016
fbshipit-source-id: 73fc2fd2f0239b0363f358c80e34566d06a0c7cb
2021-02-04 11:40:30 -08:00
Xin (Annie) Guan
74ec9e7ccf
compare_model_outputs_fx API implementation ( #49266 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49266
compare_model_outputs_fx API implementation
ghstack-source-id: 120828880
Test Plan:
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_outputs_linear_static_fx'
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_outputs_conv_static_fx'
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_stub_linear_static_fx'
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_stub_conv_static_fx'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_conv_static'
Reviewed By: vkuzo
Differential Revision: D25507933
fbshipit-source-id: 1b502b5eadb0fafbe9e8c2e843410bca03c63fd6
2021-02-02 10:43:25 -08:00
Vasiliy Kuznetsov
e9ffad088f
numeric suite: add types to eager ( #51168 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51168
Adds types to function I/O for numeric suite. This is for readability
and static type checking with mypy.
Test Plan:
```
mypy torch/quantization/
```
Imported from OSS
Reviewed By: jerryzh168
Differential Revision: D26092454
fbshipit-source-id: d37cf61e4d9604f4bc550b392f55fb59165f7624
2021-01-27 10:40:49 -08:00
Xin Guan
46d846f5bb
T78750158 Support varying size input in numeric suite at 10/30/2020, 3:55:01 PM ( #47391 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47391
Current Numeric Suite will fail if it's collecting for multiple inputs and each input is of not same size. This fix adds support for varying size input in numeric suite.
ghstack-source-id: 117058862
Test Plan:
buck test mode/dev caffe2/test:quantization -- 'test_shadow_logger'
buck test mode/dev caffe2/test:quantization -- 'test_output_logger'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_submodule_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_dynami
Reviewed By: hx89
Differential Revision: D24662271
fbshipit-source-id: 6908169ee448cbb8f33beedbd26104633632896a
2020-11-18 23:57:41 -08:00
Jerry Zhang
f9446cb15a
[quant][refactor] Remove register api and rename get_*_mapping to get_default_*_mapping ( #46337 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46337
We plan to pass around the mappings instead of using global registration api to keep
the mappings local to the transformations user is performing
Test Plan: Imported from OSS
Reviewed By: vkuzo
Differential Revision: D24317436
fbshipit-source-id: 81569b88f05eeeaa9595447e482a12827aeb961f
2020-10-20 15:53:47 -07:00
Vasiliy Kuznetsov
6dc763df30
PyTorch: add API usage logging to numeric suite ( #46504 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46504
As titled, so we can start seeing who is using this.
Test Plan: CI
Reviewed By: hx89
Differential Revision: D24375254
fbshipit-source-id: ff7b5560d0a6a175cecbf546eefc910759296dbb
2020-10-19 13:17:02 -07:00
Rong Rong
d1745c36dc
fix type check for torch.quantization._numeric_suite ( #46330 )
...
Summary:
fix https://github.com/pytorch/pytorch/issues/42977
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46330
Reviewed By: malfet
Differential Revision: D24320449
Pulled By: walterddr
fbshipit-source-id: f892b5c83cb932aee53245d6c825568b3e05f3c6
2020-10-15 20:45:07 -07:00
Xiang Gao
20ac736200
Remove py2 compatible future imports ( #44735 )
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/44735
Reviewed By: mruberry
Differential Revision: D23731306
Pulled By: ezyang
fbshipit-source-id: 0ba009a99e475ddbe22981be8ac636f8a1c8b02f
2020-09-16 12:55:57 -07:00
Jerry Zhang
0c58a017bd
[quant][eagermode][refactor] Add set/get method for quantization and fusion mappings ( #43990 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43990
Allow user to register custom quantization and fusion patterns
Test Plan: Imported from OSS
Reviewed By: z-a-f
Differential Revision: D23485344
fbshipit-source-id: 4f0174ee6d8000d83de0f73cb370e9a1941d54aa
2020-09-10 21:29:39 -07:00
Vinod Kumar S
2a1fc56694
replace the white list from default mappings ( #41802 )
...
Summary:
Replaced "whitelist" from default_mappings.py
Fixes https://github.com/pytorch/pytorch/issues/41756
Pull Request resolved: https://github.com/pytorch/pytorch/pull/41802
Reviewed By: ngimel
Differential Revision: D23521452
Pulled By: malfet
fbshipit-source-id: 019a2d5c06dc59dc53d6c48b70fb35b216299cf4
2020-09-04 10:04:28 -07:00
Haixin Liu
12b5bdc601
Remove unused Logger in get_matching_activations ( #41023 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/41023
Remove Logger in get_matching_activations since it's not used.
ghstack-source-id: 107237046
Test Plan:
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_submodule_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_dynamic'
Differential Revision: D22394957
fbshipit-source-id: 7d59e0f35e9f4c304b8487460d48236ee6e5a872
2020-07-07 00:33:07 -07:00
Haixin Liu
cab7d94d47
[PyTorch Numeric Suite] Remove unnecessary Logger in input arguments ( #40890 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40890
Remove unnecessary Logger in input arguments and simplify the API.
ghstack-source-id: 107110487
Test Plan:
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_submodule_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_dynamic'
Differential Revision: D22345477
fbshipit-source-id: d8b4eb3d6cb3049aa3296dead8ba29bf5467bd1c
2020-07-03 02:45:46 -07:00
Haixin Liu
46b9e519aa
Remove print ( #40475 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40475
As title
ghstack-source-id: 106474870
Test Plan: CI
Differential Revision: D22200640
fbshipit-source-id: 1f4c7bbf54be8c4187c9338fefdf14b501597d98
2020-06-24 00:42:25 -07:00
Haixin Liu
4cbf87dc92
[PyTorch Numeric Suite] Add support for dynamic LSTM ( #40065 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40065
Add support for dynamic LSTM of all three Numeric Suite APIs: compare_weights(), compare_model_stub() and compare_model_outputs().
ghstack-source-id: 106291782
Test Plan:
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_lstm_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_submodule_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_dynamic'
Differential Revision: D22058275
fbshipit-source-id: 76cb42ce16b6b02b0b90f7582252756582660921
2020-06-20 07:00:13 -07:00
Haixin Liu
d9c804ce22
[PyTorch Numeric Suite] Add support for dynamic quantization of linear module ( #39024 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39024
Add support for dynamic quantization of linear module.
ghstack-source-id: 106205450
Test Plan:
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_submodule_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub_linear_dynamic'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_conv_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_functional_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_dynamic'
Differential Revision: D21675971
fbshipit-source-id: c9562744dc59b61cf47f2787a934e6a5a53e12fd
2020-06-19 10:58:56 -07:00
Haixin Liu
cc0f1b22a2
[PyTorch Numeric Suite] Add module output comparison ( #36701 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36701
Add module output comparison API.
ghstack-source-id: 103368194
Test Plan: buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs'
Differential Revision: D21053197
fbshipit-source-id: cabcafbeeac1b604db069833a0f17ebce506ba65
2020-05-03 00:04:35 -07:00
Haixin Liu
ca39f99d48
[Pytorch Numeric Suite] Add module level comparison ( #37242 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37242
Add module level comparison API.
ghstack-source-id: 102853727
Test Plan: buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub'
Reviewed By: raghuramank100
Differential Revision: D21232277
fbshipit-source-id: de707eea101a66a37869129460274c56e4e07db2
2020-04-25 16:46:10 -07:00
Alban Desmaison
35b9c89dc1
Revert D21045393: [PyTorch Numeric Suite] Add module level comparison
...
Test Plan: revert-hammer
Differential Revision:
D21045393
Original commit changeset: 4303805f732c
fbshipit-source-id: 06d8a234eda800eb14bc3aa58ff14b0d3cf86d86
2020-04-24 07:03:04 -07:00
Haixin Liu
fba9b9a023
[PyTorch Numeric Suite] Add module level comparison ( #36669 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36669
Add module level comparison API.
ghstack-source-id: 102802362
Test Plan: buck test mode/dev caffe2/test:quantization -- 'test_compare_model_stub'
Differential Revision: D21045393
fbshipit-source-id: 4303805f732cc8c8fc67ce40d9594b664507bf82
2020-04-24 00:17:22 -07:00
Haixin Liu
455d4aab64
[PyTorch Numeric Suite] Add weight compare API ( #36186 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36186
Start PyTorch Numeric Suite under PyTorch quantization and add weight compare API to it.
ghstack-source-id: 102062165
Test Plan: buck test mode/dev caffe2/test:quantization -- 'test_compare_weights'
Differential Revision: D20903395
fbshipit-source-id: 125d84569837142626a0e2119b3b7657a32dbf4e
2020-04-13 19:02:00 -07:00