Skip to content

Commit

Permalink
Do not load tensorflow et al. in apply() until we really want ML
Browse files Browse the repository at this point in the history
  • Loading branch information
saganatt committed Oct 3, 2024
1 parent e994044 commit c9b2067
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions machine_learning_hep/processer.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,6 @@ def skim(self, file_index):
write_df(dfgensk, self.mptfiles_gensk[ipt][file_index])

def applymodel(self, file_index):
from machine_learning_hep.models import \
apply # pylint: disable=import-error, import-outside-toplevel
for ipt in range(self.p_nptbins):
if os.path.exists(self.mptfiles_recoskmldec[ipt][file_index]):
if os.stat(self.mptfiles_recoskmldec[ipt][file_index]).st_size != 0:
Expand All @@ -467,6 +465,8 @@ def applymodel(self, file_index):
if self.p_mask_values:
mask_df(dfrecosk, self.p_mask_values)
if self.doml is True:
from machine_learning_hep.models import \
apply # pylint: disable=import-error, import-outside-toplevel
if os.path.isfile(self.lpt_model[ipt]) is False:
print("Model file not present in bin %d" % ipt)
with openfile(self.lpt_model[ipt], 'rb') as mod_file:
Expand Down

0 comments on commit c9b2067

Please sign in to comment.