@@ -345,13 +345,28 @@ else()
345345 ROOT_FIND_PYTHON_MODULE(keras)
346346 ROOT_FIND_PYTHON_MODULE(sonnet)
347347 ROOT_FIND_PYTHON_MODULE(graph_nets)
348+
349+ # Check if we support the installed Keras version. Otherwise, veto SOFIE
350+ # Keras tutorials. This mirrors the logic in tmva/sofie/test/CMakeLists.txt.
351+ # TODO: make sure we also support the newest Keras
352+ set (unsupported_keras_version "3.5.0" )
353+ if (NOT DEFINED ROOT_KERAS_VERSION)
354+ message (WARNING "Keras found, but version unknown — cannot verify compatibility." )
355+ elseif (NOT ROOT_KERAS_VERSION VERSION_LESS ${unsupported_keras_version} )
356+ message (WARNING "Keras version ${ROOT_KERAS_VERSION} is too new for the SOFIE Keras parser (only supports < ${unsupported_keras_version} ). Corresponding tutorials will not be tested." )
357+ set (keras_unsupported TRUE )
358+ endif ()
359+
348360 if (NOT BLAS_FOUND)
349361 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_GNN_Application.C)
350362 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_RDataFrame.C)
351363 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_RSofieReader.C)
352364 endif ()
353- if (NOT tmva-sofie OR NOT ROOT_KERAS_FOUND)
365+ if (NOT tmva-sofie OR NOT ROOT_KERAS_FOUND OR keras_unsupported )
354366 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_Keras.C)
367+ list (APPEND tmva_veto machine_learning/TMVA_SOFIE_Models.py)
368+ endif ()
369+ if (NOT tmva-sofie OR NOT ROOT_KERAS_FOUND OR keras_unsupported)
355370 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_Keras_HiggsModel.C)
356371 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_RDataFrame.C)
357372 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_RDataFrame_JIT.C)
@@ -362,7 +377,6 @@ else()
362377 endif ()
363378 if (NOT tmva-sofie)
364379 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_RDataFrame.py)
365- list (APPEND tmva_veto machine_learning/TMVA_SOFIE_Models.py)
366380 list (APPEND tmva_veto machine_learning/TMVA_SOFIE_Inference.py)
367381 endif ()
368382 #veto this tutorial since it is added directly
0 commit comments