Skip to content

Conversation

titaiwangms
Copy link
Collaborator

@titaiwangms titaiwangms commented Mar 24, 2023

Stack from ghstack (oldest at bottom):

Fixes #97728
Fixes #98622
Fixes microsoft/onnxscript#393

Provide op_level_debug in exporter which creates randomnied torch.Tensor based on FakeTensorProp real shape as inputs of both torch ops and ONNX symbolic function. The PR leverages on Transformer class to create a new fx.Graph, but shares the same Module with the original one to save memory.

The test is different from op_correctness_test.py as op_level_debug generating real tensors based on the fake tensors in the model.

Limitation:

  1. Some of the trace_only function is not supported due to lack of param_schema which leads to arg/kwargs wronly split and ndarray wrapping. (WARNINGS in SARIF)
  2. The ops with dim/indices (INT64) is not supported that they need the information(shape) from other input args. (WARNINGS in SARIF)
  3. sym_size and built-in ops are not supported.
  4. op_level_debug only labels results in SARIF. It doesn't stop exporter.
  5. Introduce ONNX owning FakeTensorProp supports int/float/bool
  6. parametrized op_level_debug and dynamic_shapes into FX tests

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 24, 2023

🔗 Helpful Links

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

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

✅ No Failures

As of commit 8867c75:
💚 Looks good so far! There are no failures yet. 💚

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 Mar 24, 2023
titaiwangms added a commit that referenced this pull request Mar 24, 2023
ghstack-source-id: 6828e7b
Pull Request resolved: #97494
@titaiwangms titaiwangms marked this pull request as draft March 24, 2023 01:34
titaiwangms added a commit that referenced this pull request Mar 24, 2023
ghstack-source-id: 8563ade
Pull Request resolved: #97494
@titaiwangms titaiwangms added module: onnx Related to torch.onnx topic: bug fixes topic category labels Mar 24, 2023
titaiwangms added a commit that referenced this pull request Mar 27, 2023
ghstack-source-id: fcd3f8b
Pull Request resolved: #97494
titaiwangms added a commit that referenced this pull request Mar 28, 2023
ghstack-source-id: d839262
Pull Request resolved: #97494
@titaiwangms titaiwangms marked this pull request as ready for review March 28, 2023 20:44
Fixes #97728 
Fixes microsoft/onnxscript#393

Provide op_level_debug in exporter which creates randomnied torch.Tensor based on FakeTensorProp real shape as inputs of both torch ops and ONNX symbolic function. 

The test is different from [op_correctness_test.py](https://github.com/microsoft/onnx-script/blob/main/onnxscript/tests/function_libs/torch_aten/ops_correctness_test.py) as op_level_debug generating real tensors based on the fake tensors in the model.

Limitation:
1. trace_only onnxscript function is not supported due to lack of param_schema.
2. The ops with dim/indices (INT64) is not supported that they need the information(shape) from other input args.

[ghstack-poisoned]
titaiwangms added a commit that referenced this pull request Mar 28, 2023
ghstack-source-id: 1474e27
Pull Request resolved: #97494
@titaiwangms titaiwangms marked this pull request as draft March 28, 2023 23:05
Fixes #97728 
Fixes microsoft/onnxscript#393

Provide op_level_debug in exporter which creates randomnied torch.Tensor based on FakeTensorProp real shape as inputs of both torch ops and ONNX symbolic function. 

The test is different from [op_correctness_test.py](https://github.com/microsoft/onnx-script/blob/main/onnxscript/tests/function_libs/torch_aten/ops_correctness_test.py) as op_level_debug generating real tensors based on the fake tensors in the model.

Limitation:
1. trace_only onnxscript function is not supported due to lack of param_schema.
2. The ops with dim/indices (INT64) is not supported that they need the information(shape) from other input args.

[ghstack-poisoned]
@titaiwangms titaiwangms marked this pull request as ready for review March 29, 2023 17:32
Fixes #97728 
Fixes microsoft/onnxscript#393

Provide op_level_debug in exporter which creates randomnied torch.Tensor based on FakeTensorProp real shape as inputs of both torch ops and ONNX symbolic function. 

The test is different from [op_correctness_test.py](https://github.com/microsoft/onnx-script/blob/main/onnxscript/tests/function_libs/torch_aten/ops_correctness_test.py) as op_level_debug generating real tensors based on the fake tensors in the model.

Limitation:
1. trace_only onnxscript function is not supported due to lack of param_schema.
2. The ops with dim/indices (INT64) is not supported that they need the information(shape) from other input args.

[ghstack-poisoned]
titaiwangms added a commit that referenced this pull request Mar 29, 2023
ghstack-source-id: f0cd543
Pull Request resolved: #97494
@titaiwangms titaiwangms requested a review from justinchuby March 29, 2023 19:01
@titaiwangms
Copy link
Collaborator Author

Had CI fail on:
worker 'gw1' crashed while running 'test/onnx/test_fx_to_onnx_with_onnxruntime.py::TestFxToOnnxWithOnnxRuntime_op_level_debug_False_dynamic_shapes_True::test_flatten_dynamic_axes'

Not sure it's on the machine or the test...

Fixes #97728 
Fixes microsoft/onnxscript#393

Provide op_level_debug in exporter which creates randomnied torch.Tensor based on FakeTensorProp real shape as inputs of both torch ops and ONNX symbolic function. The PR leverages on Transformer class to create a new fx.Graph, but shares the same Module with the original one to save memory.

The test is different from [op_correctness_test.py](https://github.com/microsoft/onnx-script/blob/main/onnxscript/tests/function_libs/torch_aten/ops_correctness_test.py) as op_level_debug generating real tensors based on the fake tensors in the model.

Limitation:
1. Some of the trace_only function is not supported due to lack of param_schema which leads to arg/kwargs wronly split and ndarray wrapping. (WARNINGS in SARIF)
2. The ops with dim/indices (INT64) is not supported that they need the information(shape) from other input args.  (WARNINGS in SARIF)
3. sym_size and built-in ops are not supported. 
4. op_level_debug only labels results in SARIF. It doesn't stop exporter.
5. Introduce ONNX owning FakeTensorProp supports int/float/bool
6. parametrized op_level_debug and dynamic_shapes into FX tests

[ghstack-poisoned]
@justinchuby
Copy link
Collaborator

Most likely because of ORT. This may be useful: microsoft/onnxscript#602

@titaiwangms titaiwangms added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 7, 2023
DynamicSliceExportMod(),
(x,),
additional_test_inputs=[(y,)],
)

def test_mutation(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do me a favor and skip this one for dynamic too #98622 🤣

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm The one reported is actually not dynamic. I will skip the whole test in this PR, and put skip_ORT_version on it in the next PR.

Fixes #97728 
Fixes #98622 
Fixes microsoft/onnxscript#393

Provide op_level_debug in exporter which creates randomnied torch.Tensor based on FakeTensorProp real shape as inputs of both torch ops and ONNX symbolic function. The PR leverages on Transformer class to create a new fx.Graph, but shares the same Module with the original one to save memory.

The test is different from [op_correctness_test.py](https://github.com/microsoft/onnx-script/blob/main/onnxscript/tests/function_libs/torch_aten/ops_correctness_test.py) as op_level_debug generating real tensors based on the fake tensors in the model.

Limitation:
1. Some of the trace_only function is not supported due to lack of param_schema which leads to arg/kwargs wronly split and ndarray wrapping. (WARNINGS in SARIF)
2. The ops with dim/indices (INT64) is not supported that they need the information(shape) from other input args.  (WARNINGS in SARIF)
3. sym_size and built-in ops are not supported. 
4. op_level_debug only labels results in SARIF. It doesn't stop exporter.
5. Introduce ONNX owning FakeTensorProp supports int/float/bool
6. parametrized op_level_debug and dynamic_shapes into FX tests

[ghstack-poisoned]
Fixes #97728 
Fixes #98622 
Fixes microsoft/onnxscript#393

Provide op_level_debug in exporter which creates randomnied torch.Tensor based on FakeTensorProp real shape as inputs of both torch ops and ONNX symbolic function. The PR leverages on Transformer class to create a new fx.Graph, but shares the same Module with the original one to save memory.

The test is different from [op_correctness_test.py](https://github.com/microsoft/onnx-script/blob/main/onnxscript/tests/function_libs/torch_aten/ops_correctness_test.py) as op_level_debug generating real tensors based on the fake tensors in the model.

Limitation:
1. Some of the trace_only function is not supported due to lack of param_schema which leads to arg/kwargs wronly split and ndarray wrapping. (WARNINGS in SARIF)
2. The ops with dim/indices (INT64) is not supported that they need the information(shape) from other input args.  (WARNINGS in SARIF)
3. sym_size and built-in ops are not supported. 
4. op_level_debug only labels results in SARIF. It doesn't stop exporter.
5. Introduce ONNX owning FakeTensorProp supports int/float/bool
6. parametrized op_level_debug and dynamic_shapes into FX tests

[ghstack-poisoned]
@titaiwangms
Copy link
Collaborator Author