Skip to content
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

Support Union[NoneType, T] as input type #51606

Closed
wants to merge 1 commit into from

Conversation

nikithamalgifb
Copy link
Contributor

ghstack-source-id: 32db9661ce0f9441ef7061285bc24967c2808ea6
Pull Request resolved: #51605

Fixes #51582

Summary:

In Python 3.9+ Union[T, NoneType] and Union[NoneType, T] as OptionalType.

Test:

python test/test_jit.py -v TestJit.test_union_to_optional

@facebook-github-bot facebook-github-bot added cla signed oncall: jit Add this issue/PR to JIT oncall triage queue labels Feb 3, 2021
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Feb 3, 2021

💊 CI failures summary and remediations

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


  • 6/6 failures possibly* introduced in this PR
    • 1/6 non-CircleCI failure(s)

🕵️ 4 new failures recognized by patterns

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

See CircleCI build pytorch_linux_bionic_py3_8_gcc9_coverage_test2 (1/4)

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

Feb 03 17:51:29 RuntimeError: test_mkldnn failed!
Feb 03 17:51:28 
Feb 03 17:51:28 FAILED (errors=1)
Feb 03 17:51:28 
Feb 03 17:51:28 Generating XML reports...
Feb 03 17:51:28 Generated XML report: test-reports/dist-gloo/TEST-TestMkldnn-20210203174601.xml
Feb 03 17:51:29 Traceback (most recent call last):
Feb 03 17:51:29   File "test/run_test.py", line 925, in <module>
Feb 03 17:51:29     main()
Feb 03 17:51:29   File "test/run_test.py", line 904, in main
Feb 03 17:51:29     raise RuntimeError(err_message)
Feb 03 17:51:29 RuntimeError: test_mkldnn failed!
Feb 03 17:51:29 
Feb 03 17:51:29 real	43m2.145s
Feb 03 17:51:29 user	66m24.456s
Feb 03 17:51:29 sys	4m42.425s
Feb 03 17:51:29 + cleanup
Feb 03 17:51:29 + retcode=1
Feb 03 17:51:29 + set +x
Feb 03 17:51:29 =================== sccache compilation log ===================
Feb 03 17:51:29 =========== If your build fails, please take a look at the log above for possible reasons ===========
Feb 03 17:51:29 Compile requests                      0

See CircleCI build pytorch_macos_10_13_py3_test (2/4)

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

Feb 03 17:28:15 RuntimeError: test_mkldnn failed!
Feb 03 17:28:15 
Feb 03 17:28:15 FAILED (errors=1, skipped=2)
Feb 03 17:28:15 
Feb 03 17:28:15 Generating XML reports...
Feb 03 17:28:15 Generated XML report: test-reports/dist-gloo/TEST-TestMkldnn-20210203172752.xml
Feb 03 17:28:15 Traceback (most recent call last):
Feb 03 17:28:15   File "test/run_test.py", line 925, in <module>
Feb 03 17:28:15     main()
Feb 03 17:28:15   File "test/run_test.py", line 904, in main
Feb 03 17:28:15     raise RuntimeError(err_message)
Feb 03 17:28:15 RuntimeError: test_mkldnn failed!
Feb 03 17:28:15 + cleanup
Feb 03 17:28:15 + retcode=1
Feb 03 17:28:15 + set +x


Exited with code exit status 1

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

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

RuntimeError: test_mkldnn failed!

FAILED (errors=1, skipped=2)

Generating XML reports...
Generated XML report: test-reports\dist-gloo\TEST-TestMkldnn-20210203175534.xml
Traceback (most recent call last):
  File "run_test.py", line 925, in <module>
    main()
  File "run_test.py", line 904, in main
    raise RuntimeError(err_message)
RuntimeError: test_mkldnn 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_6_clang9_test (4/4)

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

Feb 03 17:30:21 [E request_callback_no_python.cpp:653] Received error while processing request type 258: RuntimeError: Can not pickle torch.futures.Future
Feb 03 17:30:21 At:
Feb 03 17:30:21   /opt/conda/lib/python3.6/site-packages/torch/distributed/rpc/internal.py(120): serialize
Feb 03 17:30:21   /opt/conda/lib/python3.6/site-packages/torch/distributed/rpc/internal.py(172): serialize
Feb 03 17:30:21 
Feb 03 17:30:21 [E request_callback_no_python.cpp:653] Received error while processing request type 258: RuntimeError: Can not pickle torch.futures.Future
Feb 03 17:30:21 
Feb 03 17:30:21 At:
Feb 03 17:30:21   /opt/conda/lib/python3.6/site-packages/torch/distributed/rpc/internal.py(120): serialize
Feb 03 17:30:21   /opt/conda/lib/python3.6/site-packages/torch/distributed/rpc/internal.py(172): serialize
Feb 03 17:30:21 
Feb 03 17:30:21 [E request_callback_no_python.cpp:653] Received error while processing request type 258: RuntimeError: Can not pickle torch.futures.Future
Feb 03 17:30:21 
Feb 03 17:30:21 At:
Feb 03 17:30:21   /opt/conda/lib/python3.6/site-packages/torch/distributed/rpc/internal.py(120): serialize
Feb 03 17:30:21   /opt/conda/lib/python3.6/site-packages/torch/distributed/rpc/internal.py(172): serialize
Feb 03 17:30:21 
Feb 03 17:30:21 ok (1.841s)
Feb 03 17:30:23   test_return_future_remote (__main__.ProcessGroupRpcTestWithSpawn) ... RPC was initialized with the PROCESS_GROUP backend which is deprecated and slated to be removed and superseded by the TENSORPIPE backend. It is recommended to migrate to the TENSORPIPE backend.
Feb 03 17:30:23 RPC was initialized with the PROCESS_GROUP backend which is deprecated and slated to be removed and superseded by the TENSORPIPE backend. It is recommended to migrate to the TENSORPIPE backend.
Feb 03 17:30:23 RPC was initialized with the PROCESS_GROUP backend which is deprecated and slated to be removed and superseded by the TENSORPIPE backend. It is recommended to migrate to the TENSORPIPE backend.
Feb 03 17:30:23 RPC was initialized with the PROCESS_GROUP backend which is deprecated and slated to be removed and superseded by the TENSORPIPE backend. It is recommended to migrate to the TENSORPIPE backend.

1 failure not recognized by patterns:

Job Step Action
CircleCI pytorch_linux_xenial_cuda10_2_cudnn7_py3_gcc7_test2 Run tests 🔁 rerun

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.

ghstack-source-id: 6cde5155c57cde7645c230b7fce2e37b2d1ddd85
Pull Request resolved: #51605
} else if (!first_none && second_none) {
return OptionalType::create(first_type);
} else {
throw ErrorReport(subscript.range()) << err;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be clear, Union[None, None] would trigger this line and error out, is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. That should be handled during the regular Union.

return u
else:
return 0
scripted = torch.jit.script(test1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional:

Use self.checkScript

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was told self.checkScript is the old way in one of my earlier PR's.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, didn't know about that. What's wrong with it and what's the alternative?

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@nikithamalgifb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@nikithamalgifb merged this pull request in ecf8166.

@facebook-github-bot facebook-github-bot deleted the gh/nikithamalgifb/4/orig branch February 7, 2021 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed Merged oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JIT] Support Union[NoneType, T] as input type
3 participants