Skip to content

[quant][graphmode][fix] Handle the case when observed node has no users#53210

Closed
jerryzh168 wants to merge 3 commits intogh/jerryzh168/567/basefrom
gh/jerryzh168/567/head
Closed

[quant][graphmode][fix] Handle the case when observed node has no users#53210
jerryzh168 wants to merge 3 commits intogh/jerryzh168/567/basefrom
gh/jerryzh168/567/head

Conversation

@jerryzh168
Copy link
Copy Markdown
Contributor

@jerryzh168 jerryzh168 commented Mar 3, 2021

Stack from ghstack:

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D26791724

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Mar 3, 2021
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 92c7dce
Pull Request resolved: #53210
@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented Mar 3, 2021

💊 CI failures summary and remediations

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


  • 12/15 failures possibly* introduced in this PR
    • 2/12 non-scanned failure(s)
  • 3/15 broken upstream at merge base a76b473 since Mar 10

🕵️ 10 new failures recognized by patterns

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

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_test (1/10)

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

Mar 10 21:09:35 RuntimeError: test_autograd failed!
Mar 10 21:09:35   File "test_autograd.py", line 42, in <module>
Mar 10 21:09:35     from torch.testing._internal.common_methods_invocations import (method_tests,
Mar 10 21:09:35   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2460, in <module>
Mar 10 21:09:35     skipCUDAIfRocm
Mar 10 21:09:35 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 21:09:35 Traceback (most recent call last):
Mar 10 21:09:35   File "test/run_test.py", line 1073, in <module>
Mar 10 21:09:35     main()
Mar 10 21:09:35   File "test/run_test.py", line 1052, in main
Mar 10 21:09:35     raise RuntimeError(err_message)
Mar 10 21:09:35 RuntimeError: test_autograd failed!
Mar 10 21:09:35 + cleanup
Mar 10 21:09:35 + retcode=1
Mar 10 21:09:35 + set +x
Mar 10 21:09:35 =================== sccache compilation log ===================
Mar 10 21:09:36 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 10 21:09:36 Compile requests                     28
Mar 10 21:09:36 Compile requests executed            26
Mar 10 21:09:36 Cache hits                            2
Mar 10 21:09:36 Cache hits (C/C++)                    2
Mar 10 21:09:36 Cache misses                         24

See CircleCI build pytorch_windows_vs2019_py36_cuda10.1_test1 (2/10)

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

RuntimeError: test_jit failed!
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\jit_metaprogramming_utils.py", line 5, in <module>
    from torch.testing._internal.common_methods_invocations import non_differentiable, create_input, \
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\common_methods_invocations.py", line 2460, in <module>
    skipCUDAIfRocm
TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Traceback (most recent call last):
  File "run_test.py", line 1073, in <module>
    main()
  File "run_test.py", line 1052, in main
    raise RuntimeError(err_message)
RuntimeError: test_jit failed!

(base) C:\Users\circleci\project\test>if ERRORLEVEL 1 exit /b 1 
+ cleanup
+ retcode=1
+ set +x


Exited with code exit status 1

See CircleCI build pytorch_linux_bionic_py3_8_gcc9_coverage_test2 (3/10)

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

Mar 10 21:41:53 RuntimeError: test_ops failed!
Mar 10 21:41:52   File "test_ops.py", line 10, in <module>
Mar 10 21:41:52     from torch.testing._internal.common_methods_invocations import \
Mar 10 21:41:52   File "/opt/conda/lib/python3.8/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2451, in <module>
Mar 10 21:41:52     OpInfo('eig',
Mar 10 21:41:52 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 21:41:53 Traceback (most recent call last):
Mar 10 21:41:53   File "test/run_test.py", line 1073, in <module>
Mar 10 21:41:53     main()
Mar 10 21:41:53   File "test/run_test.py", line 1052, in main
Mar 10 21:41:53     raise RuntimeError(err_message)
Mar 10 21:41:53 RuntimeError: test_ops failed!
Mar 10 21:41:53 
Mar 10 21:41:53 real	0m6.395s
Mar 10 21:41:53 user	0m4.449s
Mar 10 21:41:53 sys	0m0.805s
Mar 10 21:41:53 + cleanup
Mar 10 21:41:53 + retcode=1
Mar 10 21:41:53 + set +x
Mar 10 21:41:53 =================== sccache compilation log ===================
Mar 10 21:41:54 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 10 21:41:54 Compile requests                      28

See CircleCI build pytorch_windows_vs2019_py36_cuda10.1_test2 (4/10)

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

RuntimeError: test_jit_fuser_te failed!
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\jit_metaprogramming_utils.py", line 5, in <module>
    from torch.testing._internal.common_methods_invocations import non_differentiable, create_input, \
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\common_methods_invocations.py", line 2460, in <module>
    skipCUDAIfRocm
TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Traceback (most recent call last):
  File "run_test.py", line 1073, in <module>
    main()
  File "run_test.py", line 1052, in main
    raise RuntimeError(err_message)
RuntimeError: test_jit_fuser_te failed!

(base) C:\Users\circleci\project\test>if ERRORLEVEL 1 exit /b 1 
+ cleanup
+ retcode=1
+ set +x


Exited with code exit status 1

See CircleCI build pytorch_linux_xenial_py3_clang5_asan_test1 (5/10)

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

Mar 10 22:08:53 RuntimeError: test_autograd failed!
Mar 10 22:08:53   File "test_autograd.py", line 42, in <module>
Mar 10 22:08:53     from torch.testing._internal.common_methods_invocations import (method_tests,
Mar 10 22:08:53   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2460, in <module>
Mar 10 22:08:53     skipCUDAIfRocm
Mar 10 22:08:53 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 22:08:53 Traceback (most recent call last):
Mar 10 22:08:53   File "test/run_test.py", line 1073, in <module>
Mar 10 22:08:53     main()
Mar 10 22:08:53   File "test/run_test.py", line 1052, in main
Mar 10 22:08:53     raise RuntimeError(err_message)
Mar 10 22:08:53 RuntimeError: test_autograd failed!
Mar 10 22:08:54 + cleanup
Mar 10 22:08:54 + retcode=1
Mar 10 22:08:54 + set +x
Mar 10 22:08:54 =================== sccache compilation log ===================
Mar 10 22:08:54 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 10 22:08:54 Compile requests                      28
Mar 10 22:08:54 Compile requests executed             26
Mar 10 22:08:54 Cache hits                             2
Mar 10 22:08:54 Cache hits (C/C++)                     2
Mar 10 22:08:54 Cache misses                          24

See CircleCI build pytorch_linux_bionic_py3_6_clang9_test (6/10)

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

Mar 10 21:31:46 RuntimeError: test_jit failed!
Mar 10 21:31:45   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/jit_metaprogramming_utils.py", line 5, in <module>
Mar 10 21:31:45     from torch.testing._internal.common_methods_invocations import non_differentiable, create_input, \
Mar 10 21:31:45   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2460, in <module>
Mar 10 21:31:45     skipCUDAIfRocm
Mar 10 21:31:45 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 21:31:46 Traceback (most recent call last):
Mar 10 21:31:46   File "test/run_test.py", line 1073, in <module>
Mar 10 21:31:46     main()
Mar 10 21:31:46   File "test/run_test.py", line 1052, in main
Mar 10 21:31:46     raise RuntimeError(err_message)
Mar 10 21:31:46 RuntimeError: test_jit failed!
Mar 10 21:31:46 
Mar 10 21:31:46 real	8m40.097s
Mar 10 21:31:46 user	16m27.804s
Mar 10 21:31:46 sys	1m47.947s
Mar 10 21:31:46 + cleanup
Mar 10 21:31:46 + retcode=1
Mar 10 21:31:46 + set +x
Mar 10 21:31:46 =================== sccache compilation log ===================
Mar 10 21:31:46 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 10 21:31:46 Compile requests                      28

See CircleCI build pytorch_linux_xenial_cuda10_2_cudnn7_py3_jit_legacy_test (7/10)

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

Mar 10 23:00:45 RuntimeError: test_jit_legacy failed!
Mar 10 23:00:45   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/jit_metaprogramming_utils.py", line 5, in <module>
Mar 10 23:00:45     from torch.testing._internal.common_methods_invocations import non_differentiable, create_input, \
Mar 10 23:00:45   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2460, in <module>
Mar 10 23:00:45     skipCUDAIfRocm
Mar 10 23:00:45 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 23:00:45 Traceback (most recent call last):
Mar 10 23:00:45   File "test/run_test.py", line 1073, in <module>
Mar 10 23:00:45     main()
Mar 10 23:00:45   File "test/run_test.py", line 1052, in main
Mar 10 23:00:45     raise RuntimeError(err_message)
Mar 10 23:00:45 RuntimeError: test_jit_legacy failed!
Mar 10 23:00:46 + cleanup
Mar 10 23:00:46 + retcode=1
Mar 10 23:00:46 + set +x
Mar 10 23:00:46 =================== sccache compilation log ===================
Mar 10 23:00:46 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 10 23:00:46 Compile requests                      0
Mar 10 23:00:46 Compile requests executed             0
Mar 10 23:00:46 Cache hits                            0
Mar 10 23:00:46 Cache misses                          0
Mar 10 23:00:46 Cache timeouts                        0

See CircleCI build pytorch_linux_xenial_py3_clang5_asan_test2 (8/10)

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

Mar 10 22:10:21 RuntimeError: test_ops failed!
Mar 10 22:10:21   File "test_ops.py", line 10, in <module>
Mar 10 22:10:21     from torch.testing._internal.common_methods_invocations import \
Mar 10 22:10:21   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2460, in <module>
Mar 10 22:10:21     skipCUDAIfRocm
Mar 10 22:10:21 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 22:10:21 Traceback (most recent call last):
Mar 10 22:10:21   File "test/run_test.py", line 1073, in <module>
Mar 10 22:10:21     main()
Mar 10 22:10:21   File "test/run_test.py", line 1052, in main
Mar 10 22:10:21     raise RuntimeError(err_message)
Mar 10 22:10:21 RuntimeError: test_ops failed!
Mar 10 22:10:22 =================== sccache compilation log ===================
Mar 10 22:10:22 + cleanup
Mar 10 22:10:22 + retcode=1
Mar 10 22:10:22 + set +x
Mar 10 22:10:22 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 10 22:10:22 Compile requests                      28
Mar 10 22:10:22 Compile requests executed             26
Mar 10 22:10:22 Cache hits                             2
Mar 10 22:10:22 Cache hits (C/C++)                     2
Mar 10 22:10:22 Cache misses                          24

See CircleCI build pytorch_macos_10_13_py3_test (9/10)

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

Mar 10 21:26:24 RuntimeError: test_jit failed!
Mar 10 21:26:24   File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/jit_metaprogramming_utils.py", line 5, in <module>
Mar 10 21:26:24     from torch.testing._internal.common_methods_invocations import non_differentiable, create_input, \
Mar 10 21:26:24   File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2460, in <module>
Mar 10 21:26:24     skipCUDAIfRocm
Mar 10 21:26:24 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 21:26:24 Traceback (most recent call last):
Mar 10 21:26:24   File "test/run_test.py", line 1073, in <module>
Mar 10 21:26:24     main()
Mar 10 21:26:24   File "test/run_test.py", line 1052, in main
Mar 10 21:26:24     raise RuntimeError(err_message)
Mar 10 21:26:24 RuntimeError: test_jit failed!
Mar 10 21:26:24 + cleanup
Mar 10 21:26:24 + retcode=1
Mar 10 21:26:24 + set +x


Exited with code exit status 1

See CircleCI build pytorch_linux_xenial_cuda10_2_cudnn7_py3_gcc7_test2 (10/10)

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

Mar 10 23:05:47 RuntimeError: test_ops failed!
Mar 10 23:05:46   File "test_ops.py", line 10, in <module>
Mar 10 23:05:46     from torch.testing._internal.common_methods_invocations import \
Mar 10 23:05:46   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_methods_invocations.py", line 2460, in <module>
Mar 10 23:05:46     skipCUDAIfRocm
Mar 10 23:05:46 TypeError: __init__() got an unexpected keyword argument 'supports_tensor_out'
Mar 10 23:05:47 Traceback (most recent call last):
Mar 10 23:05:47   File "test/run_test.py", line 1073, in <module>
Mar 10 23:05:47     main()
Mar 10 23:05:47   File "test/run_test.py", line 1052, in main
Mar 10 23:05:47     raise RuntimeError(err_message)
Mar 10 23:05:47 RuntimeError: test_ops failed!
Mar 10 23:05:47 + cleanup
Mar 10 23:05:47 + retcode=1
Mar 10 23:05:47 + set +x
Mar 10 23:05:47 =================== sccache compilation log ===================
Mar 10 23:05:47 =========== If your build fails, please take a look at the log above for possible reasons ===========
Mar 10 23:05:47 Compile requests                     64
Mar 10 23:05:47 Compile requests executed            38
Mar 10 23:05:47 Cache hits                            2
Mar 10 23:05:47 Cache hits (C/C++)                    2
Mar 10 23:05:47 Cache misses                         36

🚧 1 ongoing upstream failure:

These were probably caused by upstream breakages that are not fixed yet.

🚧 2 fixed upstream failures:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

If your commit is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

ci.pytorch.org: 1 failed


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.

@jerryzh168 jerryzh168 requested review from supriyar and vkuzo March 3, 2021 21:44
Comment thread test/quantization/test_quantize_fx.py Outdated
if first_use:
module_path, _ = quantizer.node_name_to_scope[first_use.name]
else:
# TODO: it's not used, so actually we can skip quantization
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that the observer has no user? In that case why do we insert observer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, here it's because x.sigmiod_ is inplace operation, and it's included in the quantization patterns (maybe we should remove it), I also see this happen in pyper models, I'm not sure why that happens in pyper model.

… has no users"

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D26791724](https://our.internmc.facebook.com/intern/diff/D26791724)

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Mar 4, 2021
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 1d670fa
Pull Request resolved: #53210
def __init__(self):
super().__init__()

def forward(self, x):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I might be missing something, which value is not used and quantized?

def forward(self, x):
x = x + x
x.sigmoid_()
return x
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the returned value different from

x1 = x + x
x2 = torch.sigmoid(x1)
return x2

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the first x1 is returned with current implementation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, the example is not important here, it's for reproducing the case when observer has 0 uses. (which appears in pyper and I'm not sure why yet)

… has no users"

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D26791724](https://our.internmc.facebook.com/intern/diff/D26791724)

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

This pull request has been merged in d9fa957.

@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/567/head branch March 14, 2021 14:14
xsacha pushed a commit to xsacha/pytorch that referenced this pull request Mar 31, 2021
…rs (pytorch#53210)

Summary: Pull Request resolved: pytorch#53210

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26791724

fbshipit-source-id: b2a226a22d6aba86dd01cacbb56577048a289b3e
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…rs (pytorch#53210)

Summary: Pull Request resolved: pytorch#53210

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26791724

fbshipit-source-id: b2a226a22d6aba86dd01cacbb56577048a289b3e
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.

4 participants