Skip to content

Commit 3786b25

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 865a697 commit 3786b25

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tmva/sofie/test/CMakeLists.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,28 @@ endif()
107107

108108
# Look for needed Python modules
109109
ROOT_FIND_PYTHON_MODULE(torch)
110-
if (ROOT_TORCH_FOUND)
110+
111+
# onnx 1.19.0 has a bug that makes this version unusable:
112+
113+
114+
# https://github.com/onnx/onnx/issues/7249
115+
116+
117+
# In that case, we have to disable the "TestSofieModels" and
118+
119+
120+
# "TestRModelParserPyTorch" tests, which import onnx indirectly via torch.onnx
121+
122+
123+
ROOT_FIND_PYTHON_MODULE(onnx)
124+
if (ROOT_ONNX_FOUND AND DEFINED ROOT_ONNX_VERSION)
125+
if(ROOT_ONNX_VERSION VERSION_EQUAL "1.19.0")
126+
message(WARNING "Found broken onnx version ${ROOT_ONNX_VERSION} (see https://github.com/onnx/onnx/issues/7249). Some TMVA SOFIE tests will be disabled.")
127+
set(broken_onnx TRUE)
128+
endif()
129+
endif()
130+
131+
if (ROOT_TORCH_FOUND AND ROOT_ONNX_FOUND AND NOT broken_onnx)
111132
configure_file(Conv1dModelGenerator.py Conv1dModelGenerator.py COPYONLY)
112133
configure_file(Conv2dModelGenerator.py Conv2dModelGenerator.py COPYONLY)
113134
configure_file(Conv3dModelGenerator.py Conv3dModelGenerator.py COPYONLY)

0 commit comments

Comments
 (0)