Commit 22822aae authored by lucas_miranda's avatar lucas_miranda
Browse files

Added CustomStopper class to, to start early stopping only after annealing is over

parent 5b343dc4
Pipeline #89029 failed with stage
in 120 minutes and 9 seconds
......@@ -23,6 +23,25 @@ import tensorflow as tf
hp = HyperParameters()
class CustomStopper(tf.keras.callbacks.EarlyStopping):
""" Custom callback for """
def __init__(self, start_epoch, *args, **kwargs):
super(CustomStopper, self).__init__(*args, **kwargs)
self.start_epoch = start_epoch
def get_config(self): # pragma: no cover
"""Updates callback metadata"""
config = super().get_config().copy()
config.update({"start_epoch": self.start_epoch})
return config
def on_epoch_end(self, epoch, logs=None):
if epoch > self.start_epoch:
super().on_epoch_end(epoch, logs)
def load_hparams(hparams):
"""Loads hyperparameters from a custom dictionary pickled on disc.
Thought to be used with the output of"""
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment