From 754ecf03d20f90038d60342f81fc92750f4eec86 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 30 Nov 2025 13:59:39 +0100 Subject: [PATCH 1/2] [tmva][sofie] Don't run Keras tests if `keras>=3.5` This is a followup to 10f28b62f64e, where I used a random keras version in a check in order to make the CI configuration at the time pass. In fact, `keras=>3.5` also didn't work, as we see now after updating the macOS runners from Keras 2 to Keras 3. It could actually turn out that `keras>=3` is not supported at all, so we should be prepared to lower the maximum supported Keras version even further. But for now we don't know, as no platform has `keras>=3.0&&keras<3.5` installed. --- tmva/sofie/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmva/sofie/test/CMakeLists.txt b/tmva/sofie/test/CMakeLists.txt index 50915da185643..87f1ef0a2cedf 100644 --- a/tmva/sofie/test/CMakeLists.txt +++ b/tmva/sofie/test/CMakeLists.txt @@ -154,7 +154,7 @@ endif() # Any reatures 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) From c6c851a640e017aac81f6b7e8dc4e2eb780c6c0f Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 30 Nov 2025 11:27:20 +0100 Subject: [PATCH 2/2] [tmva][sofie] Require `onnx!=1.19.0` for tests The Python package 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`. 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. --- tmva/sofie/test/CMakeLists.txt | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tmva/sofie/test/CMakeLists.txt b/tmva/sofie/test/CMakeLists.txt index 87f1ef0a2cedf..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,7 +165,7 @@ 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.5.0")