Skip to content

Conversation

wangxiyuan
Copy link
Contributor

@wangxiyuan wangxiyuan commented Aug 15, 2023

The usage of some functions is deprecated. This PR drop them.

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 15, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/107208

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 6ca3724 with merge base aee5dec (image):

UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: onnx torch.onnx related changes that should show up in the release notes label Aug 15, 2023
@wangxiyuan wangxiyuan changed the title Drop deprecated _export usage [ONNX] Drop deprecated _export usage Aug 15, 2023
@wangxiyuan wangxiyuan requested a review from wschin as a code owner August 16, 2023 02:49
@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 17, 2023
Copy link
Collaborator

@thiagocrepaldi thiagocrepaldi left a comment

Choose a reason for hiding this comment

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

AFAIK torch.onnx._export is a private API, not a deprecated one.

The part that concerns me the most is that we probably don't want to add more options to the already cluttered torch.onnx.export public API.

If this PR can drop the use of _export in favor of export without adding new args to export, that would be a more reasonable change

@thiagocrepaldi thiagocrepaldi added the module: onnx Related to torch.onnx label Aug 28, 2023
@wangxiyuan
Copy link
Contributor Author

AFAIK torch.onnx._export is a private API, not a deprecated one.

The part that concerns me the most is that we probably don't want to add more options to the already cluttered torch.onnx.export public API.

If this PR can drop the use of _export in favor of export without adding new args to export, that would be a more reasonable change

Hi, Thiago, thank for your review. I change _export to export because that I saw a deprecation messaging with _export https://github.com/pytorch/pytorch/blob/main/torch/onnx/__init__.py#L135-L139 . If it's true, export should have the same input to replace _export.

@justinchuby
Copy link
Collaborator

Thanks for catching this. In tests, we should use utils._export instead. We should also remove the _export function in init.

@justinchuby justinchuby self-assigned this Sep 5, 2023
@wangxiyuan wangxiyuan force-pushed the onnx_use_export branch 2 times, most recently from 75278d2 to 8aa6250 Compare September 12, 2023 02:00
@wangxiyuan wangxiyuan changed the title [ONNX] Drop deprecated _export usage [ONNX] Remove deprecated functions Sep 12, 2023
@justinchuby
Copy link
Collaborator

The call to symbolic_helper._set_onnx_shape_inference(True) in File "onnx/test_pytorch_onnx_shape_inference.py", line 44, in setUp can be removed too

@justinchuby
Copy link
Collaborator

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased onnx_use_export onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout onnx_use_export && git pull --rebase)

@justinchuby
Copy link
Collaborator

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: pull / linux-focal-cuda12.1-py3.10-gcc9-sm86 / test (default, 4, 5, linux.g5.4xlarge.nvidia.gpu, unstable)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@kit1980
Copy link
Contributor

kit1980 commented Sep 14, 2023

I briefly looked and it looks like at least for cast_pytorch_to_onnx there are some Meta-internal usages.
High chance this will be reverted.

If it gets reverted, it's probably better to split this PR into several - one PR for one functions.
Because some internal usages may take time to resolve, splitting will allow merging the rest.

I'm also going to add check for this to https://github.com/pytorch/test-infra/tree/main/tools/torchfix

@thiagocrepaldi
Copy link
Collaborator

the fix will probably be replacing torch.onnx._export by torch.onnx.utils._export

@kit1980
Copy link
Contributor

kit1980 commented Sep 14, 2023

the fix will probably be replacing torch.onnx._export by torch.onnx.utils._export

I see cast_pytorch_to_onnx is used explicitly in the user-side code...

@justinchuby
Copy link
Collaborator

The best thing to do will be to copy the dictionary out. Could you share a list of affected variables?

@kit1980
Copy link
Contributor

kit1980 commented Sep 15, 2023

The best thing to do will be to copy the dictionary out. Could you share a list of affected variables?

Let's see if this gets reverted first. It's possible that the code is not really used.

@wangxiyuan wangxiyuan deleted the onnx_use_export branch September 18, 2023 01:14
clee2000 pushed a commit to clee2000/pytorch that referenced this pull request Sep 19, 2023
…move deprecated functions (pytorch#107208)" for test or build failures

Summary:
This diff is reverting D49346965
D49346965: [ONNX] Remove deprecated functions (pytorch#107208) by generatedunixname499836121 has been identified to be causing the following test or build failures:

Tests affected:
- [mobile-vision/mobile_cv/mobile_cv/arch/tests:fb_test_jit_backend - test_jit_hta (mobile_cv.arch.tests.fb.test_jit_backend.TestJitBackend)](https://www.internalfb.com/intern/test/844425028079287/)

Here's the Multisect link:
https://www.internalfb.com/multisect/3068610
Here are the tasks that are relevant to this breakage:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

If you believe this diff has been generated in error you may Commandeer and Abandon it.

Test Plan: NA

Reviewed By: amirshim

Differential Revision: D49351830
@kit1980
Copy link
Contributor

kit1980 commented Sep 19, 2023

@wangxiyuan For re-landing, let's split this PR into several - one for each removed API as I suggested before.
I'll work with you on landing those.

@facebook-github-bot
Copy link
Contributor

@pytorchbot revert -m="Diff reverted internally" -c="ghfirst"

This Pull Request has been reverted by a revert inside Meta. To re-land this change, please open another pull request, assign the same reviewers, fix the CI failures that caused the revert and make sure that the failing CI runs on the PR by applying the proper ciflow label (e.g., ciflow/trunk).)

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

@pytorchmergebot
Copy link
Collaborator

@wangxiyuan your PR has been successfully reverted.

pytorchmergebot added a commit that referenced this pull request Sep 19, 2023
This reverts commit 263ca7d.

Reverted #107208 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](#107208 (comment)))
@wangxiyuan
Copy link
Contributor Author

@wangxiyuan For re-landing, let's split this PR into several - one for each removed API as I suggested before. I'll work with you on landing those.

sure, feel free to work on it. Thanks.

@kit1980
Copy link
Contributor

kit1980 commented Sep 20, 2023

@wangxiyuan For re-landing, let's split this PR into several - one for each removed API as I suggested before. I'll work with you on landing those.

sure, feel free to work on it. Thanks.

To be clear, I'm suggesting you to create the PRs and I can help with landing by updating Meta-internal stuff.
If you're still interested of course.

@wangxiyuan
Copy link
Contributor Author

@wangxiyuan For re-landing, let's split this PR into several - one for each removed API as I suggested before. I'll work with you on landing those.

sure, feel free to work on it. Thanks.

To be clear, I'm suggesting you to create the PRs and I can help with landing by updating Meta-internal stuff. If you're still interested of course.

That fine, Let's remove the deprecated APIs one by one. I'll push them later

pytorchmergebot pushed a commit that referenced this pull request Sep 20, 2023
These three functions in symbolic_helper are depreacated and should be removed after pytorch 2.0.

The clean up job will be separated into several patches to ensure the safety. See: #107208

Pull Request resolved: #109681
Approved by: https://github.com/thiagocrepaldi
pytorchmergebot pushed a commit that referenced this pull request Sep 22, 2023
`_export` API was depreacated and should be removed after 2.0.

See: #107208

Pull Request resolved: #109763
Approved by: https://github.com/thiagocrepaldi
@kit1980
Copy link
Contributor

kit1980 commented Sep 26, 2023

@wangxiyuan Removal of _set_opset_version, _set_operator_export_type, and _set_onnx_shape_inference looks safe to me - maybe create a PR for those and we can quickly merge.

@wangxiyuan
Copy link
Contributor Author

wangxiyuan commented Sep 27, 2023

@wangxiyuan Removal of _set_opset_version, _set_operator_export_type, and _set_onnx_shape_inference looks safe to me - maybe create a PR for those and we can quickly merge.

It has been removed, sorry that I forgot to ping you there. I'll pay attention in the future.
#109681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: onnx Related to torch.onnx open source release notes: onnx torch.onnx related changes that should show up in the release notes Reverted triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants