Skip to content

Commit dfe76cc

Browse files
committed
[tmva][sofie] Require onnx!=1.19.0 for tests
The Python package onnx 1.19.0 has a bug that makes this version unusable: onnx/onnx#7249 In that case, we have to disable the "TestSofieModels" and "TestRModelParserPyTorch" tests, which import onnx indirectly via `torch.onnx`. We should also consider to require `onnx!=1.19.1` in our `requirements.txt` in the future, so our users don't face similar trouble from exporting PyTorch models to onnx. But this should only be done once we are sure that it can also be installed on macOS without breaking something else. Closes #20571.
1 parent 1df6d55 commit dfe76cc

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

tmva/sofie/test/CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,20 @@ endif()
109109
ROOT_FIND_PYTHON_MODULE(torch)
110110
ROOT_FIND_PYTHON_MODULE(keras)
111111

112-
if (ROOT_TORCH_FOUND)
112+
113+
114+
# onnx 1.19.0 has a bug that makes this version unusable:
115+
# https://github.com/onnx/onnx/issues/7249
116+
# In that case, we have to disable the "TestSofieModels" and
117+
# "TestRModelParserPyTorch" tests, which import onnx indirectly via torch.onnx
118+
ROOT_FIND_PYTHON_MODULE(onnx)
119+
if (ROOT_ONNX_FOUND AND DEFINED ROOT_ONNX_VERSION)
120+
if(ROOT_ONNX_VERSION VERSION_EQUAL "1.19.0")
121+
set(broken_onnx TRUE)
122+
endif()
123+
endif()
124+
125+
if (ROOT_TORCH_FOUND AND NOT broken_onnx)
113126
configure_file(Conv1dModelGenerator.py Conv1dModelGenerator.py COPYONLY)
114127
configure_file(Conv2dModelGenerator.py Conv2dModelGenerator.py COPYONLY)
115128
configure_file(Conv3dModelGenerator.py Conv3dModelGenerator.py COPYONLY)
@@ -129,8 +142,8 @@ if (ROOT_TORCH_FOUND)
129142
endif()
130143
endif()
131144

132-
# Any reatures that link against libpython are disabled if built with tpython=OFF
133-
if (tpython AND ROOT_TORCH_FOUND AND BLAS_FOUND)
145+
# Any features that link against libpython are disabled if built with tpython=OFF
146+
if (tpython AND ROOT_TORCH_FOUND AND BLAS_FOUND AND NOT broken_onnx)
134147
configure_file(generatePyTorchModelClassification.py generatePyTorchModelClassification.py COPYONLY)
135148
configure_file(generatePyTorchModelMulticlass.py generatePyTorchModelMulticlass.py COPYONLY)
136149
configure_file(generatePyTorchModelRegression.py generatePyTorchModelRegression.py COPYONLY)
@@ -151,7 +164,7 @@ if (tpython AND ROOT_TORCH_FOUND AND BLAS_FOUND)
151164
endif()
152165

153166

154-
# Any reatures that link against libpython are disabled if built with tpython=OFF
167+
# Any features that link against libpython are disabled if built with tpython=OFF
155168
if (tpython AND ROOT_KERAS_FOUND AND BLAS_FOUND)
156169

157170
set(unsupported_keras_version "3.10.0")

0 commit comments

Comments
 (0)