Skip to content

Commit

Permalink
fix: fix early stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Jul 19, 2024
1 parent f841e70 commit c9e6eb5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/train_rnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ def __init__(self, *, min_epochs=0, **kwargs):
self.min_epochs = min_epochs

def on_epoch_end(self, epoch_number: int, logs: Dict):
if epoch_number < self.min_epochs:
return
super().on_epoch_end(epoch_number, logs)
# Un-stop (having updated best result anyway)
if epoch_number < self.min_epochs:
self.stopped_epoch = 0
self.model.stop_training = False


def run_cv(args, all_data, featdims, feat2id, label_counts, id2label):
Expand Down

0 comments on commit c9e6eb5

Please sign in to comment.