-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Extend _TestONNXRuntime to reuses all tests for new model format #112289
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
Extend _TestONNXRuntime to reuses all tests for new model format #112289
Conversation
_TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/112289
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c758014 with merge base a9134fa ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
_TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` ghstack-source-id: 73f4094 Pull Request resolved: #112289
…rmat" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…rmat" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…rmat" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…rmat" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…rtedProgram and remove None from input" This PR introduces the ability to produce GraphModules with Core ATen IR only through decompositions. It also removes `None` from user inputs as ONNX does not supports them Tests for these features will be executed when #112289 is merged, but for reference, they are as below: ```python def test_log_sigmoid(self): # This produces op as `torch.ops.aten.log_sigmoid_forward`, instead of the more # conventional `torch.ops.aten.log_sigmoid`. class Model(torch.nn.Module): def __init__(self): super().__init__() self.m = torch.nn.LogSigmoid() def forward(self, x): return self.m(x) input = torch.randn(2) self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime( Model(), (input,), model_type=self.model_type ) def test_none_input(self): class NoneInputModel(torch.nn.Module): def forward( self, x: torch.Tensor, y: Optional[torch.Tensor], z: torch.Tensor ): if y is None: return x + z return x + y + z self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime( NoneInputModel(), (torch.randn(1, 2), None, torch.randn(1, 2)), model_type=self.model_type, ) ``` [ghstack-poisoned]
…remove None from input" This PR introduces the ability to produce GraphModules with Core ATen IR only through decompositions. It also removes `None` from user inputs as ONNX does not supports them Tests for these features will be executed when #112289 is merged, but for reference, they are as below: ```python def test_log_sigmoid(self): # This produces op as `torch.ops.aten.log_sigmoid_forward`, instead of the more # conventional `torch.ops.aten.log_sigmoid`. class Model(torch.nn.Module): def __init__(self): super().__init__() self.m = torch.nn.LogSigmoid() def forward(self, x): return self.m(x) input = torch.randn(2) self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime( Model(), (input,), model_type=self.model_type ) def test_none_input(self): class NoneInputModel(torch.nn.Module): def forward( self, x: torch.Tensor, y: Optional[torch.Tensor], z: torch.Tensor ): if y is None: return x + z return x + y + z self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime( NoneInputModel(), (torch.randn(1, 2), None, torch.randn(1, 2)), model_type=self.model_type, ) ``` [ghstack-poisoned]
…rmat" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…format" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…format" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…format" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…format" _TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model input of type torch.export.ExportedProgram. This PR adds a terrible flag that must be specified by all self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime calls to force the model conversion to torch.export.ExportedProgram before runnning tests. This is not ideal, just a quick hack, though Ideally, we should be able to _TestONNXRuntime, inheriting all the parameterized classes and be able to overload run_test_with_fx_to_onnx_exporter_and_onnx_runtime or similar. run_test_with_fx_to_onnx_exporter_and_onnx_runtime could also be moved out of the class A quick PoC shows the idea of writing on BaseTestCase and reusing through different test suits: ```python import unittest class _FXtoONNXRuntimeBasic: def __init__(self, input): self.input = input def get_result(self): return self.input+1 class _FXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBasic): def get_result(self): return self.input*10 class _FXtoONNXRuntimeBaseTess(unittest.TestCase): def check(self, input, expected_output): obj = self.class_under_test(input) actual_output = obj.get_result() self.assertEqual(actual_output, expected_output) def check_all(self): for value in self.values: self.check(value[0], value[1]) class TestFXtoONNXRuntimeBasic(_FXtoONNXRuntimeBaseTess): values = ((1, 2), (3, 4)) class_under_test = _FXtoONNXRuntimeBasic def test_it(self): print("TestFXtoONNXRuntimeBasic.test_it") self.check_all() class TestFXtoONNXRuntimeExportedProgram(_FXtoONNXRuntimeBaseTess): values = ((1, 10), (2, 20)) class_under_test = _FXtoONNXRuntimeExportedProgram def test_it(self): print("TestFXtoONNXRuntimeExportedProgram.test_it") self.check_all() ``` [ghstack-poisoned]
…format" `_TestONNXRuntime` has infra to test models which are either Callable or a `torch.nn.Module`. After #111497, we want to re-run all those tests for model of type `torch.export.ExportedProgram`. This PR adds to `self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime` the capability of detect the model type to be tested and export the incoming `torch.nn.Module` model to `torch.export.ExportedProgram` before running ONNX export tests. [ghstack-poisoned]
…format" `_TestONNXRuntime` has infra to test models which are either Callable or a `torch.nn.Module`. After #111497, we want to re-run all those tests for model of type `torch.export.ExportedProgram`. This PR adds to `self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime` the capability of detect the model type to be tested and export the incoming `torch.nn.Module` model to `torch.export.ExportedProgram` before running ONNX export tests. [ghstack-poisoned]
…format" `_TestONNXRuntime` has infra to test models which are either Callable or a `torch.nn.Module`. After #111497, we want to re-run all those tests for model of type `torch.export.ExportedProgram`. This PR adds to `self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime` the capability of detect the model type to be tested and export the incoming `torch.nn.Module` model to `torch.export.ExportedProgram` before running ONNX export tests. [ghstack-poisoned]
_TestONNXRuntime has infra to test models which are either Callable or a torch.nn.Module. After #111497, we want to re-run all those tests for model of type torch.export.ExportedProgram. This PR adds self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime the capability of detect the model type to be tested and export the incoming torch.nn.Module model to torch.export.ExportedProgram before runnning ONNX export tests. ghstack-source-id: 0b7173a Pull Request resolved: #112289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking if I am going to create a new test file for #113705. Why don't we move ExportedProgram tests there. test_fx_to_onnx_onnxruntime.py seems pretty heavy loaded and complicated with all the parameters and fake_mode. We can separate them and when it's clear that which API we are going with, we integrate them at that time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, can land once the skip vs xfail conversation is resolved.
The idea is to not have tests that exclusive to
Although not in this PR, |
…format" `_TestONNXRuntime` has infra to test models which are either Callable or a `torch.nn.Module`. After #111497, we want to re-run all those tests for model of type `torch.export.ExportedProgram`. This PR adds to `self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime` the capability of detect the model type to be tested and export the incoming `torch.nn.Module` model to `torch.export.ExportedProgram` before running ONNX export tests. [ghstack-poisoned]
…format" `_TestONNXRuntime` has infra to test models which are either Callable or a `torch.nn.Module`. After #111497, we want to re-run all those tests for model of type `torch.export.ExportedProgram`. This PR adds to `self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime` the capability of detect the model type to be tested and export the incoming `torch.nn.Module` model to `torch.export.ExportedProgram` before running ONNX export tests. [ghstack-poisoned]
…format" `_TestONNXRuntime` has infra to test models which are either Callable or a `torch.nn.Module`. After #111497, we want to re-run all those tests for model of type `torch.export.ExportedProgram`. This PR adds to `self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime` the capability of detect the model type to be tested and export the incoming `torch.nn.Module` model to `torch.export.ExportedProgram` before running ONNX export tests. [ghstack-poisoned]
…format" `_TestONNXRuntime` has infra to test models which are either Callable or a `torch.nn.Module`. After #111497, we want to re-run all those tests for model of type `torch.export.ExportedProgram`. This PR adds to `self.run_test_with_fx_to_onnx_exporter_and_onnx_runtime` the capability of detect the model type to be tested and export the incoming `torch.nn.Module` model to `torch.export.ExportedProgram` before running ONNX export tests. [ghstack-poisoned]
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
_TestONNXRuntimehas infra to test models which are either Callable or atorch.nn.Module.After #111497, we want to re-run all those tests for model of type
torch.export.ExportedProgram.This PR adds to
self.run_test_with_fx_to_onnx_exporter_and_onnx_runtimethe capability of detect the model type to be tested and export the incomingtorch.nn.Modulemodel totorch.export.ExportedProgrambefore running ONNX export tests.