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

[ONNX] Update the sequence of initializers in exported graph so that it is as same as inputs. #49798

Merged
merged 15 commits into from
Jan 5, 2021

Conversation

fatcat-z
Copy link
Collaborator

In the process of export, initializers were saved in a C++ map container. Map will automatically sort the elements when an insertion happened. This causes initializers lose the insertion sequence which is supposed to be kept.

So update the backend code to create initializers following up on the inputs sequence in a final stage where initializers were not kept in a map container.

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

facebook-github-bot commented Dec 23, 2020

💊 CI failures summary and remediations

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


  • 2/2 failures introduced in this PR

🕵️ 2 new failures recognized by patterns

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

See CircleCI build pytorch_linux_backward_compatibility_check_test (1/2)

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

Jan 05 09:53:32 The PR is introducing backward incompatible changes to the operator library. Please contact PyTorch team to confirm whether this change is wanted or not.
Jan 05 09:53:32 processing existing schema:  alltoall(__torch__.torch.classes.dist_c10d.ProcessGroup _0, Tensor[] _1, Tensor[] _2) -> (__torch__.torch.classes.dist_c10d.Work _0)
Jan 05 09:53:32 processing existing schema:  send(__torch__.torch.classes.dist_c10d.ProcessGroup _0, Tensor[] _1, int _2, int _3) -> (__torch__.torch.classes.dist_c10d.Work _0)
Jan 05 09:53:32 processing existing schema:  recv(__torch__.torch.classes.dist_c10d.ProcessGroup _0, Tensor[] _1, int _2, int _3) -> (__torch__.torch.classes.dist_c10d.Work _0)
Jan 05 09:53:32 processing existing schema:  recv_anysource(__torch__.torch.classes.dist_c10d.ProcessGroup _0, Tensor[] _1, int _2) -> (__torch__.torch.classes.dist_c10d.Work _0)
Jan 05 09:53:32 processing existing schema:  barrier(__torch__.torch.classes.dist_c10d.ProcessGroup _0) -> (__torch__.torch.classes.dist_c10d.Work _0)
Jan 05 09:53:32 processing existing schema:  __init__(__torch__.torch.classes.dist_c10d.frontend _0) -> (None _0)
Jan 05 09:53:32 processing existing schema:  new_process_group_helper(__torch__.torch.classes.dist_c10d.frontend _0, int _1, int _2, int[] _3, str _4, __torch__.torch.classes.dist_c10d.Store _5, str? _6, int _7) -> (__torch__.torch.classes.dist_c10d.ProcessGroup _0)
Jan 05 09:53:32 processing existing schema:  get_process_group_by_name(__torch__.torch.classes.dist_c10d.frontend _0, str _1) -> (__torch__.torch.classes.dist_c10d.ProcessGroup _0)
Jan 05 09:53:32 processing existing schema:  get_name_of_process_group(__torch__.torch.classes.dist_c10d.frontend _0, __torch__.torch.classes.dist_c10d.ProcessGroup _1) -> (str _0)
Jan 05 09:53:32 processing existing schema:  __init__(__torch__.torch.classes.dist_rpc.WorkerInfo _0, str _1, int _2) -> (None _0)
Jan 05 09:53:32 The PR is introducing backward incompatible changes to the operator library. Please contact PyTorch team to confirm whether this change is wanted or not. 
Jan 05 09:53:32 
Jan 05 09:53:32 Broken ops: [
Jan 05 09:53:32 	aten::_test_ambiguous_defaults.a(Tensor dummy, int a=1, int b=1) -> (Tensor)
Jan 05 09:53:32 	aten::_test_ambiguous_defaults.b(Tensor dummy, int a=2, str b="2") -> (Tensor)
Jan 05 09:53:32 ]
Jan 05 09:53:32 =================== sccache compilation log ===================
Jan 05 09:53:32 + cleanup
Jan 05 09:53:32 + retcode=1
Jan 05 09:53:32 + set +x
Jan 05 09:53:32 =========== If your build fails, please take a look at the log above for possible reasons ===========

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

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

RuntimeError: test_nn failed!
  test_ReflectionPad2d (__main__.TestNN) ... ok (1.176s)
  test_ReflectionPad2d_alert_nondeterministic_cuda (__main__.TestNN) ... ok (0.011s)
  test_ReflectionPad2d_cuda (__main__.TestNN) ... ok (0.014s)
  test_ReplicationPad1d (__main__.TestNN) ... ok (0.069s)
  test_ReplicationPad1d_alert_nondeterministic_cuda (__main__.TestNN) ... ok (0.014s)
  test_ReplicationPad1d_cuda (__main__.TestNN) ... Traceback (most recent call last):
  File "run_test.py", line 910, in <module>
    main()
  File "run_test.py", line 889, in main
    raise RuntimeError(err_message)
RuntimeError: test_nn failed!

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


Exited with code exit status 1


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.

This comment has been revised 21 times.

@BowenBao
Copy link
Collaborator

BowenBao commented Jan 5, 2021

Thanks @fatcat-z, could you check the failed onnx_ort_test1/onnx_ort_test2 CI tests and fix if related?

@fatcat-z
Copy link
Collaborator Author

fatcat-z commented Jan 5, 2021

Thanks @fatcat-z, could you check the failed onnx_ort_test1/onnx_ort_test2 CI tests and fix if related?

It has been fixed by updating expect file.

@BowenBao BowenBao merged commit 97a8af1 into pytorch:onnx_ms_1 Jan 5, 2021
spandantiwari pushed a commit to spandantiwari/pytorch that referenced this pull request Jan 8, 2021
…it is as same as inputs. (pytorch#49798)

* [ONNX] Support onnx if/loop sequence output in opset 13 - (pytorch#49270)

* Symbolic function for torch.square (pytorch#49446)

* [ONNX] Support onnx if/loop sequence output in opset 13 - (pytorch#49270)

* Symbolic function for torch.square (pytorch#49446)

* Update code so that initializers' sequence is as same as inputs.

* Correct the format according to flake8.

* Correct the format by clang-format.

* Add a new test for script model.

* Update expect files for Test_Operators tests.

Co-authored-by: Bowen Bao <bowbao@microsoft.com>
Co-authored-by: David Fan <30608893+jiafatom@users.noreply.github.com>
facebook-github-bot pushed a commit that referenced this pull request Jan 13, 2021
Summary:
[ONNX] ONNX dev branch merge 01-06-2021
- [ONNX] Support onnx if/loop sequence output in opset 13 - (#49270)
- Symbolic function for torch.square (#49446)
- [ONNX] Add checks in ONNXSetDynamicInputShape (#49783) …
- [ONNX] Enable export af aten::__derive_index (#49514) …
- [ONNX] Update symbolic for unfold (#49378) …
- [ONNX] Update the sequence of initializers in exported graph so that it is as same as inputs. (#49798)
- [ONNX] Enable opset 13 ops (#49612) …
- [ONNX] Improve error message for supported model input types in ONNX export API. (#50119)
- [ONNX] Add a post-pass for If folding (#49410)

Pull Request resolved: #50163

Reviewed By: pbelevich

Differential Revision: D25821059

Pulled By: SplitInfinity

fbshipit-source-id: 9f511a93d9d5812d0ab0a49d61ed0fa5f8066948
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed oncall: jit Add this issue/PR to JIT oncall triage queue open source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants