iree-org / iree-test-suites

Test suites for IREE and related projects
Apache License 2.0
2 stars 6 forks source link

Use new `--opset-version` arg on `iree-import-onnx`. #42

Closed ScottTodd closed 6 days ago

ScottTodd commented 1 week ago

This switches the onnx_ops/import_onnx_tests.py script from running the ONNX version converter itself to passing the new --opset-version flag to iree-import-onnx.

Note that the code in IREE does not wrap version converter in try: except as we did here, so 11 test cases are now failing to import. These test cases were all failing to compile at some point anyways, so I'll just consider them broken test cases.

Sample error logs from the import failures:

Import of test_adagrad_multiple failed!
iree-import-onnx stdout:
# (printf debugging lines here)
# args.opset_version:  17
# raw_model.opset_import[0].version:  1
# trying to convert

iree-import-onnx stderr:
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\dev\projects\iree-test-suites\onnx_ops\.venv\Scripts\iree-import-onnx.exe\__main__.py", line 7, in <module>
  File "D:\dev\projects\iree-build\compiler\bindings\python\iree\compiler\tools\import_onnx\__main__.py", line 182, in _cli_main
    sys.exit(main(parse_arguments()))
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\dev\projects\iree-build\compiler\bindings\python\iree\compiler\tools\import_onnx\__main__.py", line 28, in main
    model_proto = load_onnx_model(args)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "D:\dev\projects\iree-build\compiler\bindings\python\iree\compiler\tools\import_onnx\__main__.py", line 80, in load_onnx_model
    raw_model = onnx.version_converter.convert_version(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\dev\projects\iree-test-suites\onnx_ops\.venv\Lib\site-packages\onnx\version_converter.py", line 38, in convert_version
    converted_model_str = C.convert_version(model_str, target_version)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: D:\a\onnx\onnx\onnx\onnx/version_converter/convert.h:90: assertInVersionRange: Assertion `version >= version_range.first && version <= version_range.second` failed: Warning: invalid version (must be between 1 and 22)

Error importing test_adagrad_multiple:   test_adagrad_multiple import failed

(Possibly some upstream bug with opset version 1 and the version converter, idk)

ScottTodd commented 6 days ago

Rebased after merging https://github.com/iree-org/iree-test-suites/pull/41. The two commits that were unique to this PR are unchanged.