Skip to content

Commit 1d9d73c

Browse files
committed
[tmva][sofie] Don't call PyMVA init functions in SOFIE tutorials
There is no need for that, and they are not available if ROOT was built with `tmva-pymva=OFF`.
1 parent c8ae723 commit 1d9d73c

File tree

6 files changed

+2
-13
lines changed

6 files changed

+2
-13
lines changed

tutorials/machine_learning/TMVA_SOFIE_Inference.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
import numpy as np
1919

2020

21-
ROOT.TMVA.PyMethodBase.PyInitialize()
22-
23-
2421
# check if the input file exists
2522
modelFile = "Higgs_trained_model.h5"
2623
if (ROOT.gSystem.AccessPathName(modelFile)) :

tutorials/machine_learning/TMVA_SOFIE_Keras.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ model.save('KerasModel.h5')\n";
4040
void TMVA_SOFIE_Keras(const char * modelFile = nullptr, bool printModelInfo = true){
4141

4242
//Running the Python script to generate Keras .h5 file
43-
TMVA::PyMethodBase::PyInitialize();
4443

4544
if (modelFile == nullptr) {
4645
TMacro m;
4746
m.AddLine(pythonSrc);
4847
m.SaveSource("make_keras_model.py");
49-
gSystem->Exec(TMVA::Python_Executable() + " make_keras_model.py");
48+
gSystem->Exec("python3 make_keras_model.py");
5049
modelFile = "KerasModel.h5";
5150
}
5251

tutorials/machine_learning/TMVA_SOFIE_Models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
import ROOT
1717
from os.path import exists
1818

19-
ROOT.TMVA.PyMethodBase.PyInitialize()
20-
2119

2220
## generate and train Keras models with different architectures
2321

tutorials/machine_learning/TMVA_SOFIE_PyTorch.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ torch.jit.save(m,'PyTorchModel.pt')\n";
4242
void TMVA_SOFIE_PyTorch(){
4343

4444
//Running the Python script to generate PyTorch .pt file
45-
TMVA::PyMethodBase::PyInitialize();
4645

4746
TMacro m;
4847
m.AddLine(pythonSrc);
4948
m.SaveSource("make_pytorch_model.py");
50-
gSystem->Exec(TMVA::Python_Executable() + " make_pytorch_model.py");
49+
gSystem->Exec("python3 make_pytorch_model.py");
5150

5251
//Parsing a PyTorch model requires the shape and data-type of input tensor
5352
//Data-type of input tensor defaults to Float if not specified

tutorials/machine_learning/TMVA_SOFIE_RDataFrame.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import ROOT
1414
from os.path import exists
1515

16-
ROOT.TMVA.PyMethodBase.PyInitialize()
17-
1816

1917
# check if the input file exists
2018
modelFile = "Higgs_trained_model.h5"

tutorials/machine_learning/TMVA_SOFIE_RDataFrame_JIT.C

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ void CompileModelForRDF(const std::string & headerModelFile, unsigned int ninput
4040

4141
void TMVA_SOFIE_RDataFrame_JIT(std::string modelFile = "Higgs_trained_model.h5"){
4242

43-
TMVA::PyMethodBase::PyInitialize();
44-
4543
// check if the input file exists
4644
if (gSystem->AccessPathName(modelFile.c_str())) {
4745
Info("TMVA_SOFIE_RDataFrame","You need to run TMVA_Higgs_Classification.C to generate the Keras trained model");

0 commit comments

Comments
 (0)