Skip to content

[quant] Add utility function get_fqn_to_example_inputs#78146

Closed
jerryzh168 wants to merge 7 commits intogh/jerryzh168/792/basefrom
gh/jerryzh168/792/head
Closed

[quant] Add utility function get_fqn_to_example_inputs#78146
jerryzh168 wants to merge 7 commits intogh/jerryzh168/792/basefrom
gh/jerryzh168/792/head

Conversation

@jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented May 24, 2022

Stack from ghstack (oldest at bottom):

Summary:
After #77608 example_inputs is required input for prepare_fx and prepare_qat_fx.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)

Example output:

{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented May 24, 2022

🔗 Helpful links

❌ 7 New Failures

As of commit e62653b (more details on the Dr. CI page):

Expand to see more
  • 7/7 failures introduced in this PR

🕵️ 7 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages

See GitHub Actions build pull / linux-xenial-py3.7-gcc5.4 / test (backwards_compat, 1, 1, linux.2xlarge) (1/7)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

2022-05-25T01:20:47.3401913Z The PR is introduc...m to confirm whether this change is wanted or not.
2022-05-25T01:20:47.3385964Z processing existing schema:  text(__torch__.torch.classes.profiling.SourceRef _0) -> (str _0)
2022-05-25T01:20:47.3387534Z processing existing schema:  count(__torch__.torch.classes.profiling.InstructionStats _0) -> (int _0)
2022-05-25T01:20:47.3389266Z processing existing schema:  duration_ns(__torch__.torch.classes.profiling.InstructionStats _0) -> (int _0)
2022-05-25T01:20:47.3391082Z processing existing schema:  source(__torch__.torch.classes.profiling.SourceStats _0) -> (__torch__.torch.classes.profiling.SourceRef _0)
2022-05-25T01:20:47.3393678Z processing existing schema:  line_map(__torch__.torch.classes.profiling.SourceStats _0) -> (Dict(int, __torch__.torch.classes.profiling.InstructionStats) _0)
2022-05-25T01:20:47.3394332Z processing existing schema:  __init__(__torch__.torch.classes.profiling._ScriptProfile _0) -> (NoneType _0)
2022-05-25T01:20:47.3396361Z processing existing schema:  enable(__torch__.torch.classes.profiling._ScriptProfile _0) -> (NoneType _0)
2022-05-25T01:20:47.3397589Z processing existing schema:  disable(__torch__.torch.classes.profiling._ScriptProfile _0) -> (NoneType _0)
2022-05-25T01:20:47.3400209Z processing existing schema:  _dump_stats(__torch__.torch.classes.profiling._ScriptProfile _0) -> (__torch__.torch.classes.profiling.SourceStats[] _0)
2022-05-25T01:20:47.3401557Z processing existing schema:  __init__(__torch__.torch.classes.dist_rpc.WorkerInfo _0, str _1, int _2) -> (NoneType _0)
2022-05-25T01:20:47.3401913Z The PR is introducing backward incompatible changes to the operator library. Please contact PyTorch team to confirm whether this change is wanted or not. 
2022-05-25T01:20:47.3402060Z 
2022-05-25T01:20:47.3402150Z Broken ops: [
2022-05-25T01:20:47.3402418Z 	prims::zeta(Tensor self, Tensor other) -> (Tensor)
2022-05-25T01:20:47.3402637Z 	prims::bessel_i1(Tensor self) -> (Tensor)
2022-05-25T01:20:47.3402856Z 	prims::bessel_i0(Tensor self) -> (Tensor)
2022-05-25T01:20:47.3402954Z ]
2022-05-25T01:20:47.4490379Z + cleanup
2022-05-25T01:20:47.4490514Z + retcode=1
2022-05-25T01:20:47.4490576Z + set +x
2022-05-25T01:20:47.4519873Z ##[error]Process completed with exit code 1.

See GitHub Actions build pull / linux-xenial-py3.7-gcc7 / test (default, 1, 2, linux.2xlarge) (2/7)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

2022-05-25T02:03:06.0130995Z FAIL [1.519s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:03:06.0129187Z   - Is public: it is an attribute that does not start with `_` on a module that does not have `__all__` defined
2022-05-25T02:03:06.0129664Z   - Does NOT look public: because its `__module__` attribute (`tensorboard.summary.writer.record_writer`) is not within the torch library or does not start with the submodule where it is defined (`torch.utils.tensorboard`)
2022-05-25T02:03:06.0129851Z   - You can do either of these two things to fix this problem:
2022-05-25T02:03:06.0130141Z     - To make it NOT public: either define a `__all__` for `torch.utils.tensorboard` or add a `_` at the beginning of the name
2022-05-25T02:03:06.0130441Z     - To make it look public: make sure the `__module__` is properly set and points to a submodule of `torch.utils.tensorboard`
2022-05-25T02:03:06.0130449Z 
2022-05-25T02:03:06.0130579Z   test_no_new_bindings (__main__.TestPublicBindings)
2022-05-25T02:03:06.0130742Z This test aims to stop the introduction of new JIT bindings into torch._C ... ok (0.004s)
2022-05-25T02:03:06.0130749Z 
2022-05-25T02:03:06.0130851Z ======================================================================
2022-05-25T02:03:06.0130995Z FAIL [1.519s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:03:06.0131166Z An API is considered public, if  its  `__module__` starts with `torch.`
2022-05-25T02:03:06.0131375Z ----------------------------------------------------------------------
2022-05-25T02:03:06.0131475Z Traceback (most recent call last):
2022-05-25T02:03:06.0131620Z   File "test_public_bindings.py", line 366, in test_correct_module_names
2022-05-25T02:03:06.0131731Z     self.assertTrue(not failure_list, msg)
2022-05-25T02:03:06.0132202Z AssertionError: False is not true : All the APIs below do not meet our guidelines for public API from https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation.
2022-05-25T02:03:06.0132599Z Make sure that everything that is public is expected (in particular that the module has a properly populated `__all__` attribute) and that everything that is supposed to be public does look public (it does not start with `_` and has a `__module__` that is properly populated).
2022-05-25T02:03:06.0132608Z 
2022-05-25T02:03:06.0132678Z Full list:
2022-05-25T02:03:06.0132784Z # torch.ao.quantization.utils.Any:

See GitHub Actions build pull / linux-bionic-py3.7-clang9 / test (crossref, 1, 2, linux.2xlarge) (3/7)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

2022-05-25T02:34:54.7360324Z FAIL [1.375s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:34:54.7358541Z   - Is public: it is an attribute that does not start with `_` on a module that does not have `__all__` defined
2022-05-25T02:34:54.7359000Z   - Does NOT look public: because its `__module__` attribute (`tensorboard.summary.writer.record_writer`) is not within the torch library or does not start with the submodule where it is defined (`torch.utils.tensorboard`)
2022-05-25T02:34:54.7359185Z   - You can do either of these two things to fix this problem:
2022-05-25T02:34:54.7359473Z     - To make it NOT public: either define a `__all__` for `torch.utils.tensorboard` or add a `_` at the beginning of the name
2022-05-25T02:34:54.7359771Z     - To make it look public: make sure the `__module__` is properly set and points to a submodule of `torch.utils.tensorboard`
2022-05-25T02:34:54.7359782Z 
2022-05-25T02:34:54.7359908Z   test_no_new_bindings (__main__.TestPublicBindings)
2022-05-25T02:34:54.7360072Z This test aims to stop the introduction of new JIT bindings into torch._C ... ok (0.004s)
2022-05-25T02:34:54.7360080Z 
2022-05-25T02:34:54.7360181Z ======================================================================
2022-05-25T02:34:54.7360324Z FAIL [1.375s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:34:54.7360464Z An API is considered public, if  its  `__module__` starts with `torch.`
2022-05-25T02:34:54.7360671Z ----------------------------------------------------------------------
2022-05-25T02:34:54.7360755Z Traceback (most recent call last):
2022-05-25T02:34:54.7360897Z   File "test_public_bindings.py", line 366, in test_correct_module_names
2022-05-25T02:34:54.7361006Z     self.assertTrue(not failure_list, msg)
2022-05-25T02:34:54.7361471Z AssertionError: False is not true : All the APIs below do not meet our guidelines for public API from https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation.
2022-05-25T02:34:54.7361833Z Make sure that everything that is public is expected (in particular that the module has a properly populated `__all__` attribute) and that everything that is supposed to be public does look public (it does not start with `_` and has a `__module__` that is properly populated).
2022-05-25T02:34:54.7361874Z 
2022-05-25T02:34:54.7362061Z Full list:
2022-05-25T02:34:54.7362174Z # torch.ao.quantization.utils.Any:

See GitHub Actions build pull / linux-xenial-cuda11.3-py3.7-gcc7 / test (default, 1, 4, linux.4xlarge.nvidia.gpu) (4/7)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

2022-05-25T02:55:54.6883347Z FAIL [2.958s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:55:54.6880794Z   - Is public: it is an attribute that does not start with `_` on a module that does not have `__all__` defined
2022-05-25T02:55:54.6881381Z   - Does NOT look public: because its `__module__` attribute (`tensorboard.summary.writer.record_writer`) is not within the torch library or does not start with the submodule where it is defined (`torch.utils.tensorboard`)
2022-05-25T02:55:54.6881624Z   - You can do either of these two things to fix this problem:
2022-05-25T02:55:54.6881998Z     - To make it NOT public: either define a `__all__` for `torch.utils.tensorboard` or add a `_` at the beginning of the name
2022-05-25T02:55:54.6882385Z     - To make it look public: make sure the `__module__` is properly set and points to a submodule of `torch.utils.tensorboard`
2022-05-25T02:55:54.6882408Z 
2022-05-25T02:55:54.6882669Z   test_no_new_bindings (__main__.TestPublicBindings)
2022-05-25T02:55:54.6882992Z This test aims to stop the introduction of new JIT bindings into torch._C ... ok (0.004s)
2022-05-25T02:55:54.6883012Z 
2022-05-25T02:55:54.6883153Z ======================================================================
2022-05-25T02:55:54.6883347Z FAIL [2.958s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:55:54.6883541Z An API is considered public, if  its  `__module__` starts with `torch.`
2022-05-25T02:55:54.6883813Z ----------------------------------------------------------------------
2022-05-25T02:55:54.6883954Z Traceback (most recent call last):
2022-05-25T02:55:54.6884133Z   File "test_public_bindings.py", line 366, in test_correct_module_names
2022-05-25T02:55:54.6884335Z     self.assertTrue(not failure_list, msg)
2022-05-25T02:55:54.6884906Z AssertionError: False is not true : All the APIs below do not meet our guidelines for public API from https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation.
2022-05-25T02:55:54.6885379Z Make sure that everything that is public is expected (in particular that the module has a properly populated `__all__` attribute) and that everything that is supposed to be public does look public (it does not start with `_` and has a `__module__` that is properly populated).
2022-05-25T02:55:54.6885399Z 
2022-05-25T02:55:54.6885503Z Full list:
2022-05-25T02:55:54.6885661Z # torch.ao.quantization.utils.Any:

See GitHub Actions build pull / linux-xenial-py3.7-clang7-asan / test (default, 4, 5, linux.2xlarge) (5/7)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

2022-05-25T02:17:53.4157330Z FAIL [2.162s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:17:53.4155485Z   - Is public: it is an attribute that does not start with `_` on a module that does not have `__all__` defined
2022-05-25T02:17:53.4155936Z   - Does NOT look public: because its `__module__` attribute (`tensorboard.summary.writer.record_writer`) is not within the torch library or does not start with the submodule where it is defined (`torch.utils.tensorboard`)
2022-05-25T02:17:53.4156111Z   - You can do either of these two things to fix this problem:
2022-05-25T02:17:53.4156389Z     - To make it NOT public: either define a `__all__` for `torch.utils.tensorboard` or add a `_` at the beginning of the name
2022-05-25T02:17:53.4156677Z     - To make it look public: make sure the `__module__` is properly set and points to a submodule of `torch.utils.tensorboard`
2022-05-25T02:17:53.4156689Z 
2022-05-25T02:17:53.4156925Z   test_no_new_bindings (__main__.TestPublicBindings)
2022-05-25T02:17:53.4157086Z This test aims to stop the introduction of new JIT bindings into torch._C ... ok (0.004s)
2022-05-25T02:17:53.4157092Z 
2022-05-25T02:17:53.4157191Z ======================================================================
2022-05-25T02:17:53.4157330Z FAIL [2.162s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:17:53.4157467Z An API is considered public, if  its  `__module__` starts with `torch.`
2022-05-25T02:17:53.4157666Z ----------------------------------------------------------------------
2022-05-25T02:17:53.4157759Z Traceback (most recent call last):
2022-05-25T02:17:53.4157890Z   File "test_public_bindings.py", line 366, in test_correct_module_names
2022-05-25T02:17:53.4157992Z     self.assertTrue(not failure_list, msg)
2022-05-25T02:17:53.4158427Z AssertionError: False is not true : All the APIs below do not meet our guidelines for public API from https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation.
2022-05-25T02:17:53.4158777Z Make sure that everything that is public is expected (in particular that the module has a properly populated `__all__` attribute) and that everything that is supposed to be public does look public (it does not start with `_` and has a `__module__` that is properly populated).
2022-05-25T02:17:53.4158828Z 
2022-05-25T02:17:53.4158895Z Full list:
2022-05-25T02:17:53.4159001Z # torch.ao.quantization.utils.Any:

See GitHub Actions build pull / linux-xenial-py3.7-gcc5.4 / test (default, 2, 2, linux.2xlarge) (6/7)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

2022-05-25T02:03:03.8137626Z FAIL [1.514s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:03:03.8135712Z   - Is public: it is an attribute that does not start with `_` on a module that does not have `__all__` defined
2022-05-25T02:03:03.8136161Z   - Does NOT look public: because its `__module__` attribute (`tensorboard.summary.writer.record_writer`) is not within the torch library or does not start with the submodule where it is defined (`torch.utils.tensorboard`)
2022-05-25T02:03:03.8136335Z   - You can do either of these two things to fix this problem:
2022-05-25T02:03:03.8136611Z     - To make it NOT public: either define a `__all__` for `torch.utils.tensorboard` or add a `_` at the beginning of the name
2022-05-25T02:03:03.8136895Z     - To make it look public: make sure the `__module__` is properly set and points to a submodule of `torch.utils.tensorboard`
2022-05-25T02:03:03.8136974Z 
2022-05-25T02:03:03.8137221Z   test_no_new_bindings (__main__.TestPublicBindings)
2022-05-25T02:03:03.8137385Z This test aims to stop the introduction of new JIT bindings into torch._C ... ok (0.003s)
2022-05-25T02:03:03.8137391Z 
2022-05-25T02:03:03.8137488Z ======================================================================
2022-05-25T02:03:03.8137626Z FAIL [1.514s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:03:03.8137763Z An API is considered public, if  its  `__module__` starts with `torch.`
2022-05-25T02:03:03.8137969Z ----------------------------------------------------------------------
2022-05-25T02:03:03.8138064Z Traceback (most recent call last):
2022-05-25T02:03:03.8138203Z   File "test_public_bindings.py", line 366, in test_correct_module_names
2022-05-25T02:03:03.8138295Z     self.assertTrue(not failure_list, msg)
2022-05-25T02:03:03.8138730Z AssertionError: False is not true : All the APIs below do not meet our guidelines for public API from https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation.
2022-05-25T02:03:03.8139109Z Make sure that everything that is public is expected (in particular that the module has a properly populated `__all__` attribute) and that everything that is supposed to be public does look public (it does not start with `_` and has a `__module__` that is properly populated).
2022-05-25T02:03:03.8139116Z 
2022-05-25T02:03:03.8139182Z Full list:
2022-05-25T02:03:03.8139289Z # torch.ao.quantization.utils.Any:

See GitHub Actions build pull / linux-bionic-py3.7-clang9 / test (default, 1, 2, linux.2xlarge) (7/7)

Step: "Test" (full log | diagnosis details | 🔁 rerun)

2022-05-25T02:04:24.1377480Z FAIL [1.298s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:04:24.1375597Z   - Is public: it is an attribute that does not start with `_` on a module that does not have `__all__` defined
2022-05-25T02:04:24.1376050Z   - Does NOT look public: because its `__module__` attribute (`tensorboard.summary.writer.record_writer`) is not within the torch library or does not start with the submodule where it is defined (`torch.utils.tensorboard`)
2022-05-25T02:04:24.1376232Z   - You can do either of these two things to fix this problem:
2022-05-25T02:04:24.1376515Z     - To make it NOT public: either define a `__all__` for `torch.utils.tensorboard` or add a `_` at the beginning of the name
2022-05-25T02:04:24.1376802Z     - To make it look public: make sure the `__module__` is properly set and points to a submodule of `torch.utils.tensorboard`
2022-05-25T02:04:24.1376812Z 
2022-05-25T02:04:24.1377082Z   test_no_new_bindings (__main__.TestPublicBindings)
2022-05-25T02:04:24.1377238Z This test aims to stop the introduction of new JIT bindings into torch._C ... ok (0.004s)
2022-05-25T02:04:24.1377245Z 
2022-05-25T02:04:24.1377341Z ======================================================================
2022-05-25T02:04:24.1377480Z FAIL [1.298s]: test_correct_module_names (__main__.TestPublicBindings)
2022-05-25T02:04:24.1377620Z An API is considered public, if  its  `__module__` starts with `torch.`
2022-05-25T02:04:24.1377852Z ----------------------------------------------------------------------
2022-05-25T02:04:24.1377949Z Traceback (most recent call last):
2022-05-25T02:04:24.1378075Z   File "test_public_bindings.py", line 366, in test_correct_module_names
2022-05-25T02:04:24.1378181Z     self.assertTrue(not failure_list, msg)
2022-05-25T02:04:24.1378620Z AssertionError: False is not true : All the APIs below do not meet our guidelines for public API from https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation.
2022-05-25T02:04:24.1378974Z Make sure that everything that is public is expected (in particular that the module has a properly populated `__all__` attribute) and that everything that is supposed to be public does look public (it does not start with `_` and has a `__module__` that is properly populated).
2022-05-25T02:04:24.1378980Z 
2022-05-25T02:04:24.1379050Z Full list:
2022-05-25T02:04:24.1379159Z # torch.ao.quantization.utils.Any:

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

jerryzh168 added a commit that referenced this pull request May 24, 2022
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 054930b
Pull Request resolved: #78146
@jerryzh168 jerryzh168 requested review from andrewor14 and vkuzo May 24, 2022 01:11
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request May 24, 2022
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 5a0fd7c
Pull Request resolved: #78146
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request May 24, 2022
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 8de0baf
Pull Request resolved: #78146
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request May 24, 2022
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 25d74e2
Pull Request resolved: #78146
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request May 25, 2022
Summary:
After #77608 `example_inputs` is required input for `prepare_fx` and `prepare_qat_fx`.
This makes quantizing submodules harder, so we added this utility function to get a dictionary from fqn to submodule example_inputs

Example Call:

```
example_inputs = (tensor0,)
get_fqn_to_example_inputs(m, example_inputs)
```

Example output:
```
{
   "linear1": (tensor1,),
   "linear2": (tensor2,),
   "sub": (tensor3,),
   "sub.linear1": (tensor4,),
   ...
}
```

Test Plan:
python test/test_quantization.py TestUtils

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 97e8017
Pull Request resolved: #78146
@jerryzh168
Copy link
Contributor Author

@pytorchbot merge -g

@jerryzh168 jerryzh168 added module: bc-breaking Related to a BC-breaking change release notes: quantization release notes category topic: bc breaking topic category and removed module: bc-breaking Related to a BC-breaking change topic: bc breaking topic category labels May 25, 2022
@github-actions
Copy link
Contributor

Hey @jerryzh168.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

@jerryzh168 jerryzh168 added the topic: new features topic category label May 25, 2022
@suo
Copy link
Member

suo commented May 25, 2022

@pytorchbot revert -m "broke TestPublicBindings" -c ignoredsignal

@pytorch-bot
Copy link

pytorch-bot bot commented May 25, 2022

Revert unsuccessful: please retry the command and provide a revert reason, e.g. @pytorchbot revert -m="this breaks mac tests on trunk" -c="ignoredsignal". See the wiki for more details on the commands.

@suo
Copy link
Member

suo commented May 25, 2022

@pytorchbot revert -m="This is breaking tests on trunk. hud.pytorch.org/" -c=ignoredsignal

@pytorchmergebot
Copy link
Collaborator

Don't want to revert based on edited command

@suo
Copy link
Member

suo commented May 25, 2022

@zengk95 I don't understand why my first command failed, is there something obvious I'm missing?

@jerryzh168
Copy link
Contributor Author

jerryzh168 commented May 25, 2022

Sorry for breaking trunk, I thought “merge -g” means merge on green and it is going to ensure not to break master? What does this command mean?

@suo
Copy link
Member

suo commented May 25, 2022

The option is currently poorly named. In the near future it will do what you expect

@suo
Copy link
Member

suo commented May 25, 2022 via email

@pytorch-bot
Copy link

pytorch-bot bot commented May 25, 2022

Revert unsuccessful: please retry the command and provide a revert reason, e.g. @pytorchbot revert -m="this breaks mac tests on trunk" -c="ignoredsignal". See the wiki for more details on the commands.

@suo
Copy link
Member

suo commented May 25, 2022

@pytorchbot revert this as it broke master

pytorchmergebot added a commit that referenced this pull request May 25, 2022
This reverts commit 50a44fe.

Reverted #78146 on behalf of https://github.com/suo due to as it broke master
@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/792/head branch May 28, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants