diff --git a/tmva/sofie/test/CMakeLists.txt b/tmva/sofie/test/CMakeLists.txt index 50915da185643..fc72127c14d84 100644 --- a/tmva/sofie/test/CMakeLists.txt +++ b/tmva/sofie/test/CMakeLists.txt @@ -109,7 +109,21 @@ endif() ROOT_FIND_PYTHON_MODULE(torch) ROOT_FIND_PYTHON_MODULE(keras) -if (ROOT_TORCH_FOUND) + + +# onnx 1.19.0 has a bug that makes this version unusable: +# https://github.com/onnx/onnx/issues/7249 +# In that case, we have to disable the "TestSofieModels" and +# "TestRModelParserPyTorch" tests, which import onnx indirectly via torch.onnx +ROOT_FIND_PYTHON_MODULE(onnx) +if (ROOT_ONNX_FOUND AND DEFINED ROOT_ONNX_VERSION) + if(ROOT_ONNX_VERSION VERSION_EQUAL "1.19.0") + message(WARNING "Found broken onnx version ${ROOT_ONNX_VERSION} (see https://github.com/onnx/onnx/issues/7249). Some TMVA SOFIE tests will be disabled.") + set(broken_onnx TRUE) + endif() +endif() + +if (ROOT_TORCH_FOUND AND ROOT_ONNX_FOUND AND NOT broken_onnx) configure_file(Conv1dModelGenerator.py Conv1dModelGenerator.py COPYONLY) configure_file(Conv2dModelGenerator.py Conv2dModelGenerator.py COPYONLY) configure_file(Conv3dModelGenerator.py Conv3dModelGenerator.py COPYONLY) @@ -129,8 +143,8 @@ if (ROOT_TORCH_FOUND) endif() endif() -# Any reatures that link against libpython are disabled if built with tpython=OFF -if (tpython AND ROOT_TORCH_FOUND AND BLAS_FOUND) +# Any features that link against libpython are disabled if built with tpython=OFF +if (tpython AND ROOT_TORCH_FOUND AND ROOT_ONNX_FOUND AND BLAS_FOUND AND NOT broken_onnx) configure_file(generatePyTorchModelClassification.py generatePyTorchModelClassification.py COPYONLY) configure_file(generatePyTorchModelMulticlass.py generatePyTorchModelMulticlass.py COPYONLY) configure_file(generatePyTorchModelRegression.py generatePyTorchModelRegression.py COPYONLY) @@ -151,10 +165,10 @@ if (tpython AND ROOT_TORCH_FOUND AND BLAS_FOUND) endif() -# Any reatures that link against libpython are disabled if built with tpython=OFF +# Any features that link against libpython are disabled if built with tpython=OFF if (tpython AND ROOT_KERAS_FOUND AND BLAS_FOUND) - set(unsupported_keras_version "3.10.0") + set(unsupported_keras_version "3.5.0") # TODO: make sure we also support the newest Keras if (NOT DEFINED ROOT_KERAS_VERSION)