Skip to content

Commit 7f77fa0

Browse files
committed
[tmva][sofie] Make SOFIE Keras tutorials dependent on Keras version
The same was already done for the Keras unit tests when PyMVA and SOFIE were disentangled, but the same thing also has to be done for the tutorials.
1 parent 1d9d73c commit 7f77fa0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tutorials/CMakeLists.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)