From 967e57f071ee2e1b917c3fdc063db57bff5edf2e Mon Sep 17 00:00:00 2001 From: William Falcon Date: Tue, 16 Jul 2019 10:00:03 -0400 Subject: [PATCH] early stop starts counting once min epochs met --- pytorch_lightning/models/trainer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index d9506cafd2..27fbf70447 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -566,9 +566,9 @@ class Trainer(TrainerIO): model.on_epoch_end() # early stopping - if self.enable_early_stop: + met_min_epochs = epoch_nb > self.min_nb_epochs + if self.enable_early_stop and met_min_epochs: should_stop = self.early_stop_callback.on_epoch_end(epoch=epoch_nb, logs=self.__tng_tqdm_dic) - met_min_epochs = epoch_nb > self.min_nb_epochs # stop training stop = should_stop and met_min_epochs