From 7bb4e0c92619b39ff207acdeb7e368299dbea131 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 22 Sep 2023 15:52:17 +0200 Subject: [PATCH 1/4] Upgrade CI to test against onnxruntime 1.16.0 Signed-off-by: Xavier Dupre --- .azure-pipelines/linux-conda-CI.yml | 33 ++++++++++++++++++++--------- .azure-pipelines/win32-conda-CI.yml | 29 ++++++++++++++++--------- skl2onnx/__init__.py | 4 ++-- skl2onnx/common/_topology.py | 1 + tests/test_utils/__init__.py | 2 ++ 5 files changed, 47 insertions(+), 22 deletions(-) diff --git a/.azure-pipelines/linux-conda-CI.yml b/.azure-pipelines/linux-conda-CI.yml index b3648c173..e6c4b3aee 100644 --- a/.azure-pipelines/linux-conda-CI.yml +++ b/.azure-pipelines/linux-conda-CI.yml @@ -14,19 +14,32 @@ jobs: strategy: matrix: - Py311-Onnx140-Rt151-Skl130: + Py311-Onnx141-Rt160-Skl130: do.bench: '0' python.version: '3.11' # onnxruntime cannot support python 3.11 yet numpy.version: '>=1.21.1' scipy.version: '>=1.7.0' onnx.version: 'onnx==1.14.1' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.15.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.16.0' sklearn.version: '>=1.3.0' lgbm.version: '' onnxcc.version: '>=1.8.1' # git run.example: '1' + Py311-Onnx140-Rt151-Skl130: + do.bench: '0' + python.version: '3.11' # onnxruntime cannot support python 3.11 yet + numpy.version: '>=1.21.1' + scipy.version: '>=1.7.0' + onnx.version: 'onnx==1.14.0' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' + onnx.target_opset: '' + onnxrt.version: 'onnxruntime==1.15.1' + sklearn.version: '>=1.3.0' + lgbm.version: '' + onnxcc.version: '>=1.8.1' # git + run.example: '0' + Py310-Onnx140-Rt140-Skl122: do.bench: '0' python.version: '3.10' # onnxruntime cannot support python 3.11 yet @@ -34,7 +47,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.14.1' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.14.0' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.14.0' sklearn.version: '==1.2.2' lgbm.version: '' onnxcc.version: '>=1.8.1' # git @@ -47,7 +60,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.13.0' #'-i https://test.pypi.org/simple/ onnx==1.13.0rc1' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.14.0' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.14.0' sklearn.version: '==1.2.1' lgbm.version: '' onnxcc.version: '>=1.8.1' # git @@ -60,7 +73,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.13.0' #'-i https://test.pypi.org/simple/ onnx==1.13.0rc1' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.13.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.13.1' sklearn.version: '==1.2.0' lgbm.version: '' onnxcc.version: '>=1.8.1' # git @@ -73,7 +86,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.12.0' #'-i https://test.pypi.org/simple/ onnx==1.12.0rc4' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.13.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.13.1' sklearn.version: '==1.2.0' lgbm.version: '' onnxcc.version: '>=1.8.1' # git @@ -85,7 +98,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.12.0' #'-i https://test.pypi.org/simple/ onnx==1.12.0rc4' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.12.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.12.1' sklearn.version: '==1.1.3' lgbm.version: '' onnxcc.version: '>=1.8.1' # git @@ -97,7 +110,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.12.0' #'-i https://test.pypi.org/simple/ onnx==1.12.0rc4' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.11.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.11.1' sklearn.version: '==1.1.3' lgbm.version: '' onnxcc.version: '>=1.8.1' # git @@ -109,7 +122,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.11.0' # '-i https://test.pypi.org/simple/ onnx==1.11.0rc2' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.11.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.11.1' sklearn.version: '==1.1.3' lgbm.version: '' onnxcc.version: '>=1.8.1' # git @@ -121,7 +134,7 @@ jobs: scipy.version: '>=1.7.0' onnx.version: 'onnx==1.11.0' # '-i https://test.pypi.org/simple/ onnx==1.11.0rc2' onnx.target_opset: '' - onnxrt.version: 'onnxruntime==1.11.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.11.1' sklearn.version: '==1.0.2' lgbm.version: '' onnxcc.version: '>=1.8.1' # git diff --git a/.azure-pipelines/win32-conda-CI.yml b/.azure-pipelines/win32-conda-CI.yml index 54947b056..469378133 100644 --- a/.azure-pipelines/win32-conda-CI.yml +++ b/.azure-pipelines/win32-conda-CI.yml @@ -13,13 +13,22 @@ jobs: vmImage: 'windows-latest' strategy: matrix: - Py310-Onnx140-Rt151-Skl130: + Py310-Onnx141-Rt160-Skl130: python.version: '3.11' # onnxruntime cannot support python 3.11 yet onnx.version: 'onnx==1.14.1' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.15.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.16.0' + onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git + sklearn.version: '>=1.3.0' + Py310-Onnx140-Rt151-Skl130: + python.version: '3.11' # onnxruntime cannot support python 3.11 yet + onnx.version: 'onnx==1.14.0' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' + onnx.target_opset: '' + numpy.version: 'numpy>=1.22.3' + scipy.version: 'scipy' + onnxrt.version: 'onnxruntime==1.15.1' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '>=1.3.0' Py310-Onnx140-Rt140-Skl122: @@ -28,7 +37,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.14.0' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.14.0' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.2.2' Py310-Onnx130-Rt140-Skl121: @@ -37,7 +46,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.14.0' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.14.0' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.2.2' Py310-Onnx130-Rt131-Skl120: @@ -46,7 +55,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.13.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.13.1' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.2.0' Py310-Onnx120-Rt131-Skl120: @@ -55,7 +64,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.13.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.13.1' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.2.0' Py310-Onnx120-Rt120-Skl11: @@ -64,7 +73,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.12.0' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.12.0' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.1.3' Py39-Onnx120-Rt1111-Skl11: @@ -73,7 +82,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.11.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.11.1' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.1.3' Py39-Onnx1110-Rt1111-Skl11: @@ -82,7 +91,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy>=1.22.3' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.11.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.11.1' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.1.3' Py39-Onnx1110-Rt1111-Skl10: @@ -91,7 +100,7 @@ jobs: onnx.target_opset: '' numpy.version: 'numpy==1.23.5' scipy.version: 'scipy' - onnxrt.version: 'onnxruntime==1.11.1' # -i https://test.pypi.org/simple/ ort-nightly==1.11.0.dev20220311003 + onnxrt.version: 'onnxruntime==1.11.1' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git sklearn.version: '==1.0.2' Py39-Onnx1110-Rt1100-Skl10: diff --git a/skl2onnx/__init__.py b/skl2onnx/__init__.py index 73210f047..8e73eed22 100644 --- a/skl2onnx/__init__.py +++ b/skl2onnx/__init__.py @@ -3,13 +3,13 @@ """ Main entry point to the converter from the *scikit-learn* to *onnx*. """ -__version__ = "1.16.0" +__version__ = "1.16.1" __author__ = "Microsoft" __producer__ = "skl2onnx" __producer_version__ = __version__ __domain__ = "ai.onnx" __model_version__ = 0 -__max_supported_opset__ = 18 # Converters are tested up to this version. +__max_supported_opset__ = 19 # Converters are tested up to this version. from .convert import convert_sklearn, to_onnx, wrap_as_onnx_mixin # noqa diff --git a/skl2onnx/common/_topology.py b/skl2onnx/common/_topology.py index 0a20c916b..23c3c1274 100644 --- a/skl2onnx/common/_topology.py +++ b/skl2onnx/common/_topology.py @@ -62,6 +62,7 @@ def _default_OPSET_TO_IR_VERSION(): 17: 8, 18: 8, 19: 9, + 20: 9, } diff --git a/tests/test_utils/__init__.py b/tests/test_utils/__init__.py index 51665b005..6bc2a07e9 100644 --- a/tests/test_utils/__init__.py +++ b/tests/test_utils/__init__.py @@ -84,6 +84,8 @@ def max_onnxruntime_opset(): `_. """ vi = pv.Version(ort_version.split("+")[0]) + if vi >= pv.Version("1.16.0"): + return 19 if vi >= pv.Version("1.14.0"): return 18 if vi >= pv.Version("1.12.0"): From 5cd718b74828793463f91f9af58575ce1ae88cd4 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Mon, 2 Oct 2023 12:33:08 +0200 Subject: [PATCH 2/4] fix adaboost converter for scikit-learn==1.3.1 Signed-off-by: Xavier Dupre --- .azure-pipelines/linux-conda-CI.yml | 6 ++-- .azure-pipelines/win32-conda-CI.yml | 6 ++-- skl2onnx/operator_converters/ada_boost.py | 38 ++++++++++++++++++----- tests/test_sklearn_adaboost_converter.py | 2 +- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/.azure-pipelines/linux-conda-CI.yml b/.azure-pipelines/linux-conda-CI.yml index e6c4b3aee..a0402d1f2 100644 --- a/.azure-pipelines/linux-conda-CI.yml +++ b/.azure-pipelines/linux-conda-CI.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - Py311-Onnx141-Rt160-Skl130: + Py311-Onnx141-Rt160-Skl131: do.bench: '0' python.version: '3.11' # onnxruntime cannot support python 3.11 yet numpy.version: '>=1.21.1' @@ -22,7 +22,7 @@ jobs: onnx.version: 'onnx==1.14.1' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' onnx.target_opset: '' onnxrt.version: 'onnxruntime==1.16.0' - sklearn.version: '>=1.3.0' + sklearn.version: '>=1.3.1' lgbm.version: '' onnxcc.version: '>=1.8.1' # git run.example: '1' @@ -35,7 +35,7 @@ jobs: onnx.version: 'onnx==1.14.0' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' onnx.target_opset: '' onnxrt.version: 'onnxruntime==1.15.1' - sklearn.version: '>=1.3.0' + sklearn.version: '==1.3.0' lgbm.version: '' onnxcc.version: '>=1.8.1' # git run.example: '0' diff --git a/.azure-pipelines/win32-conda-CI.yml b/.azure-pipelines/win32-conda-CI.yml index 469378133..dcd453192 100644 --- a/.azure-pipelines/win32-conda-CI.yml +++ b/.azure-pipelines/win32-conda-CI.yml @@ -13,7 +13,7 @@ jobs: vmImage: 'windows-latest' strategy: matrix: - Py310-Onnx141-Rt160-Skl130: + Py310-Onnx141-Rt160-Skl131: python.version: '3.11' # onnxruntime cannot support python 3.11 yet onnx.version: 'onnx==1.14.1' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' onnx.target_opset: '' @@ -21,7 +21,7 @@ jobs: scipy.version: 'scipy' onnxrt.version: 'onnxruntime==1.16.0' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git - sklearn.version: '>=1.3.0' + sklearn.version: '>=1.3.1' Py310-Onnx140-Rt151-Skl130: python.version: '3.11' # onnxruntime cannot support python 3.11 yet onnx.version: 'onnx==1.14.0' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' @@ -30,7 +30,7 @@ jobs: scipy.version: 'scipy' onnxrt.version: 'onnxruntime==1.15.1' onnxcc.version: 'onnxconverter-common>=1.8.1' # git+https://github.com/microsoft/onnxconverter-common.git - sklearn.version: '>=1.3.0' + sklearn.version: '==1.3.0' Py310-Onnx140-Rt140-Skl122: python.version: '3.10' # onnxruntime cannot support python 3.11 yet onnx.version: 'onnx==1.14.1' # '-i https://test.pypi.org/simple/ onnx==1.14.0rc3' diff --git a/skl2onnx/operator_converters/ada_boost.py b/skl2onnx/operator_converters/ada_boost.py index 3e883043f..e2e194ddf 100644 --- a/skl2onnx/operator_converters/ada_boost.py +++ b/skl2onnx/operator_converters/ada_boost.py @@ -31,16 +31,30 @@ from .._supported_operators import sklearn_operator_name_map -def _scikit_learn_before_022(): +def _scikit_learn_before_any(any_version: str) -> bool: if ".dev" in __version__: - return pv.Version(__version__.split(".dev")[0]) < pv.Version("0.22") + return pv.Version(__version__.split(".dev")[0]) < pv.Version(any_version) if ".post" in __version__: - return pv.Version(__version__.split(".post")[0]) < pv.Version("0.22") - return pv.Version(__version__) < pv.Version("0.22") + return pv.Version(__version__.split(".post")[0]) < pv.Version(any_version) + return pv.Version(__version__) < pv.Version(any_version) + + +def _scikit_learn_before_022() -> bool: + return _scikit_learn_before_any("0.22") + + +def _scikit_learn_before_131(): + return _scikit_learn_before_any("1.3.1") def _samme_proba( - scope, container, proba_name, weight, zero_name, classes_ind_name, one_name + scope, + container, + proba_name, + weight, + zero_name_or_symmetric, + classes_ind_name, + one_name, ): weight_name = scope.get_unique_variable_name("weight") container.add_initializer(weight_name, onnx_proto.TensorProto.FLOAT, [], [weight]) @@ -64,7 +78,7 @@ def _samme_proba( max_proba_name = scope.get_unique_variable_name("probsmax") container.add_node( "Where", - [equal_name, one_name, zero_name], + [equal_name, one_name, zero_name_or_symmetric], max_proba_name, name=scope.get_unique_operator_name("Where"), ) @@ -394,6 +408,7 @@ def convert_sklearn_ada_boost_classifier( zero_name = None one_name = None classes_ind_name = None + symmetric_weight = None proto_dtype = guess_proto_type(operator.inputs[0].type) proba_type = operator.inputs[0].type.__class__ @@ -487,12 +502,21 @@ def convert_sklearn_ada_boost_classifier( ), ) + if not _scikit_learn_before_131() and symmetric_weight is None: + symmetric_weight = scope.get_unique_variable_name( + "symmetrix_weight" + ) + container.add_initializer( + symmetric_weight, proto_dtype, [1], [-1 / (len(classes) - 1)] + ) + cur_proba_name = _samme_proba( scope, container, proba_name.onnx_name, op.estimator_weights_[i_est], - zero_name, + # See https://github.com/scikit-learn/scikit-learn/pull/26521 + zero_name if _scikit_learn_before_131() else symmetric_weight, classes_ind_name, one_name, ) diff --git a/tests/test_sklearn_adaboost_converter.py b/tests/test_sklearn_adaboost_converter.py index 678bcd2c9..25c3db967 100644 --- a/tests/test_sklearn_adaboost_converter.py +++ b/tests/test_sklearn_adaboost_converter.py @@ -368,5 +368,5 @@ def test_ada_boost_regressor_bool(self): if __name__ == "__main__": - # TestSklearnAdaBoostModels().test_ada_boost_classifier_lr() + TestSklearnAdaBoostModels().test_ada_boost_classifier_samme() unittest.main(verbosity=2) From 18ba7c870b7541419373e0308af2bd8d52c9ad14 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Mon, 2 Oct 2023 13:39:56 +0200 Subject: [PATCH 3/4] fix example Signed-off-by: Xavier Dupre --- docs/tutorial/plot_wext_pyod_forest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/plot_wext_pyod_forest.py b/docs/tutorial/plot_wext_pyod_forest.py index 0e84b9e57..fbfbb89fe 100644 --- a/docs/tutorial/plot_wext_pyod_forest.py +++ b/docs/tutorial/plot_wext_pyod_forest.py @@ -206,7 +206,7 @@ def pyod_iforest_converter(scope, operator, container): expected_labels = model1.predict(data) expected_proba = model1.predict_proba(data) - sess = InferenceSession(onx.SerializeToString()) + sess = InferenceSession(onx.SerializeToString(), providers=["CPUExecutionProvider"]) res = sess.run(None, {"float_input": data}) onx_labels = res[0] From 35959b26411f904a05813cea434d394c56cfe5a4 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Mon, 2 Oct 2023 15:56:22 +0200 Subject: [PATCH 4/4] fix unit tests Signed-off-by: Xavier Dupre --- tests/test_sklearn_one_hot_encoder_converter.py | 6 +++++- tests/test_sklearn_pipeline.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_sklearn_one_hot_encoder_converter.py b/tests/test_sklearn_one_hot_encoder_converter.py index 62e4f8dd2..c348073d0 100644 --- a/tests/test_sklearn_one_hot_encoder_converter.py +++ b/tests/test_sklearn_one_hot_encoder_converter.py @@ -424,7 +424,11 @@ def test_shape_inference(self): ("cat_2", Int64TensorType([None, 1])), ] - model_onnx = convert_sklearn(model, initial_types=initial_type) + model_onnx = convert_sklearn( + model, initial_types=initial_type, target_opset=TARGET_OPSET + ) + if TARGET_OPSET < 19: + model_onnx.ir_version = 8 feeds = dict( [ diff --git a/tests/test_sklearn_pipeline.py b/tests/test_sklearn_pipeline.py index 6c4747696..d1e95fa61 100644 --- a/tests/test_sklearn_pipeline.py +++ b/tests/test_sklearn_pipeline.py @@ -1387,7 +1387,7 @@ def test_feature_vectorizer_double(self): X_train, X_test, y_train, y_test = train_test_split(X, y) regr = Pipeline([("std", StandardScaler()), ("reg", LinearRegression())]) regr = regr.fit(X_train, y_train) - onnx_model = to_onnx(regr, X=X_train) + onnx_model = to_onnx(regr, X=X_train, target_opset=TARGET_OPSET) sess = InferenceSession( onnx_model.SerializeToString(), providers=["CPUExecutionProvider"]