Skip to content

Commit 24321af

Browse files
committed
[tmva][sofie] Remove the graph_nets-based GNN support
The SOFIE GNN classes could only be filled by parsing models built with DeepMind graph_nets and dm-sonnet, whose last releases date from 2020: they cannot be installed together with current Python and TensorFlow versions anymore (the corresponding Python test had already silently disappeared from CI, since it is gated on the availability of those modules), and the parser relied on private implementation details of both packages. Equivalent graph-network models defined with PyTorch can be deployed through the SOFIE ONNX parser, whose operator support covers the graph-network building blocks; the migrated TMVA_SOFIE_GNN tutorials demonstrate that workflow and produce inference results identical to this implementation. Removed: - RModel_GNN, RModel_GraphIndependent and the RFunction classes (RFunction_MLP, RFunction_Sum, RFunction_Mean), together with their GNN_Init/GraphIndependent_Init input structs and the EmitGNN / EmitGraphIndependent tests - the GNN parts of RModel_Base (Options::kGNN / kGNNComponent, the GraphType/FunctionTarget/FunctionReducer/FunctionRelation enums and the RModel_GNNBase class) and the corresponding code paths and the weight-file read position in RModel::Generate - the GNN_Data struct with its Copy/Concatenate helpers in SOFIE_common and its emission in the generated-code helpers - the ParseFromMemory Python interface (_gnn.py pythonization) and its test - the dm-sonnet and graph_nets entries in requirements.txt 🤖 Done with the help of AI
1 parent 692a1ed commit 24321af

31 files changed

Lines changed: 25 additions & 2211 deletions

‎README/ReleaseNotes/v642/index.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ The following people have contributed to this new version:
6262
These parsers relied on private implementation details of Keras and PyTorch, which change faster than is appropriate for ROOT's stability standards.
6363
Users are encouraged to export their models to ONNX and use the retained ONNX parser instead.
6464
* **PyMVA**, the TMVA interface to Python machine-learning libraries (the `PyKeras`, `PyTorch`, `PyRandomForest`, `PyGTB` and `PyAdaBoost` methods), and the corresponding `tmva-pymva` build option are deprecated and will be removed in ROOT 6.44. Like the SOFIE Keras and PyTorch parsers, PyMVA relies on implementation details of the underlying Python libraries that change faster than is appropriate for ROOT's stability standards. Users are encouraged to train and evaluate their models directly with the Python machine-learning libraries, which integrate well with ROOT via the `ROOT::Experimental::ML::DataLoader`. For high-performance inference in C++, models can be exported to ONNX and evaluated with SOFIE (see `RSofieReader`).
65+
* The graph_nets-based SOFIE GNN support (`TMVA::Experimental::SOFIE::RModel_GNN`, `RModel_GraphIndependent`, the `RFunction` classes and the corresponding `ParseFromMemory` Python functions) is removed.
66+
It could only parse models built with DeepMind's *graph_nets* and *dm-sonnet* Python packages, which have been unmaintained since 2020 and can no longer be installed alongside current Python and TensorFlow versions; the parser also relied on private implementation details of those packages.
67+
The same graph-network models (following the formalism of Battaglia et al., [arXiv:1806.01261](https://arxiv.org/abs/1806.01261)) can be defined in PyTorch and deployed through the retained SOFIE ONNX parser, whose operator support (`Gather`, `ScatterElements` with add reduction, `ReduceSum`, `LayerNormalization`, ...) covers the graph-network building blocks, including graphs with a variable number of nodes and edges.
68+
The `TMVA_SOFIE_GNN` tutorials have been migrated to this workflow and produce inference results identical to the removed implementation.
6569
* The ROOT IO capability for the `TMVA::Experimental::RBDT` class has been removed, along with the `TMVA.Experimental.SaveXGBoost` Python function. Experimental classes should not be persistified since their on-disk layout is not guaranteed to be stable. An `RBDT` is now built directly from an XGBoost model in its native JSON serialization with the new `TMVA::Experimental::RBDT::LoadXGBoost(jsonPath)`, which works both from C++ and Python. To convert a trained model, save it first with XGBoost's `Booster.save_model("model.json")` and then load it with `LoadXGBoost`.
6670
* The **JsMVA** feature for interactive TMVA training in Jupyter notebooks is now removed. It was not functional for years and was therefore already excluded from ROOT 6.38. This also removes the `TMVA::IPythonInteractive` class and the related interactive-training interfaces from the TMVA method and fitter classes, such as `MethodBase::ExitFromTraining()` or `FitterBase::SetIPythonInteractive()`.
6771
* The **RooStats::DebuggingSampler** and **RooStats::DebuggingTestStat** classes are removed. They were mock implementations of the `TestStatSampler` and `TestStatistic` interfaces that returned uniform random numbers independent of the data, only meant for debugging the RooStats framework itself during its initial development.

‎bindings/pyroot/pythonizations/python/CMakeLists.txt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ if(tmva)
5858
ROOT/_pythonization/_tmva/__init__.py
5959
ROOT/_pythonization/_tmva/_rbdt.py
6060
ROOT/_pythonization/_tmva/_rtensor.py
61-
ROOT/_pythonization/_tmva/_utils.py
62-
ROOT/_pythonization/_tmva/_gnn.py)
61+
ROOT/_pythonization/_tmva/_utils.py)
6362
endif()
6463

6564
set(py_sources

‎bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
################################################################################
1212

1313
from .. import pythonization
14-
from . import _gnn, _rbdt # noqa: F401 # imported so @pythonization functions are found recursively
14+
from . import _rbdt # noqa: F401 # imported so @pythonization functions are found recursively
1515
from ._crossvalidation import CrossValidation
1616
from ._dataloader import DataLoader
1717
from ._factory import Factory

‎bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/_gnn.py‎

Lines changed: 0 additions & 351 deletions
This file was deleted.

‎bindings/pyroot/pythonizations/test/CMakeLists.txt‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,6 @@ if (dataframe)
108108
ROOT_ADD_PYUNITTEST(pyroot_pyz_rdataframe_misc rdataframe_misc.py PYTHON_DEPS numpy)
109109
endif()
110110

111-
# SOFIE-GNN pythonizations
112-
if (tmva)
113-
ROOT_FIND_PYTHON_MODULE(sonnet)
114-
ROOT_FIND_PYTHON_MODULE(graph_nets)
115-
if (ROOT_SONNET_FOUND AND ROOT_GRAPH_NETS_FOUND)
116-
ROOT_ADD_PYUNITTEST(pyroot_pyz_sofie_gnn sofie_gnn.py PYTHON_DEPS numpy sonnet graph_nets)
117-
endif()
118-
endif()
119-
120111
# RTensor pythonizations
121112
if (tmva AND dataframe)
122113
ROOT_ADD_PYUNITTEST(pyroot_pyz_rtensor rtensor.py PYTHON_DEPS numpy)

0 commit comments

Comments
 (0)