Skip to content
Snippets Groups Projects

Felix issue312 callback track epoch runtime

4 files
+ 32
14
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -12,7 +12,7 @@ import keras
@@ -12,7 +12,7 @@ import keras
import pandas as pd
import pandas as pd
import tensorflow as tf
import tensorflow as tf
from mlair.model_modules.keras_extensions import HistoryAdvanced, CallbackHandler
from mlair.model_modules.keras_extensions import HistoryAdvanced, EpoTimingCallback, CallbackHandler
from mlair.run_modules.run_environment import RunEnvironment
from mlair.run_modules.run_environment import RunEnvironment
from mlair.configuration import path_config
from mlair.configuration import path_config
@@ -119,11 +119,14 @@ class ModelSetup(RunEnvironment):
@@ -119,11 +119,14 @@ class ModelSetup(RunEnvironment):
"""
"""
lr = self.data_store.get_default("lr_decay", scope=self.scope, default=None)
lr = self.data_store.get_default("lr_decay", scope=self.scope, default=None)
hist = HistoryAdvanced()
hist = HistoryAdvanced()
 
epo_timing = EpoTimingCallback()
self.data_store.set("hist", hist, scope="model")
self.data_store.set("hist", hist, scope="model")
 
self.data_store.set("epo_timing", epo_timing, scope="model")
callbacks = CallbackHandler()
callbacks = CallbackHandler()
if lr is not None:
if lr is not None:
callbacks.add_callback(lr, self.callbacks_name % "lr", "lr")
callbacks.add_callback(lr, self.callbacks_name % "lr", "lr")
callbacks.add_callback(hist, self.callbacks_name % "hist", "hist")
callbacks.add_callback(hist, self.callbacks_name % "hist", "hist")
 
callbacks.add_callback(epo_timing, self.callbacks_name % "epo_timing", "epo_timing")
callbacks.create_model_checkpoint(filepath=self.checkpoint_name, verbose=1, monitor='val_loss',
callbacks.create_model_checkpoint(filepath=self.checkpoint_name, verbose=1, monitor='val_loss',
save_best_only=True, mode='auto')
save_best_only=True, mode='auto')
self.data_store.set("callbacks", callbacks, self.scope)
self.data_store.set("callbacks", callbacks, self.scope)
Loading