Skip to content

Commit

Permalink
reduc tf logging when doing hyper search
Browse files Browse the repository at this point in the history
  • Loading branch information
ppdebreuck committed Nov 13, 2021
1 parent 82e83f9 commit 6a5b139
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modnet/hyper_opt/fit_genetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ def function_fitness(
"""

from modnet.matbench.benchmark import matbench_kfold_splits
import os

os.environ[
"TF_CPP_MIN_LOG_LEVEL"
] = "2" # many models will be fitted => reduce output

num_nested_folds = 5
if nested:
Expand Down Expand Up @@ -381,6 +386,8 @@ def function_fitness(
pool.close()
pool.join()

os.environ["TF_CPP_MIN_LOG_LEVEL"] = "0" # reset

return val_loss_per_individual, np.array(models), np.array(individuals)

def run(
Expand Down
7 changes: 7 additions & 0 deletions modnet/models/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ def fit_preset(
"""

from modnet.matbench.benchmark import matbench_kfold_splits
import os

os.environ[
"TF_CPP_MIN_LOG_LEVEL"
] = "2" # many models will be fitted => reduce output

if callbacks is None:
es = tf.keras.callbacks.EarlyStopping(
Expand Down Expand Up @@ -403,6 +408,8 @@ def fit_preset(
final_models += models[idx][i].model
self.__init__(modnet_models=final_models)

os.environ["TF_CPP_MIN_LOG_LEVEL"] = "0" # reset

return models, val_losses, best_learning_curve, learning_curves, best_preset

def _make_picklable(self):
Expand Down
7 changes: 7 additions & 0 deletions modnet/models/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@ def fit_preset(
"""

from modnet.matbench.benchmark import matbench_kfold_splits
import os

os.environ[
"TF_CPP_MIN_LOG_LEVEL"
] = "2" # many models will be fitted => reduce output

if callbacks is None:
es = tf.keras.callbacks.EarlyStopping(
Expand Down Expand Up @@ -559,6 +564,8 @@ def fit_preset(
self.model = best_model.model
self._scaler = best_model._scaler

os.environ["TF_CPP_MIN_LOG_LEVEL"] = "0" # reset

return models, val_losses, best_learning_curve, learning_curves, best_preset

def predict(self, test_data: MODData, return_prob=False) -> pd.DataFrame:
Expand Down

0 comments on commit 6a5b139

Please sign in to comment.