From 28426874abf593fa7e0d3949c27ce9a957bd1fd7 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 22 Oct 2021 20:02:19 +0200 Subject: [PATCH] More informative `EarlyStopping()` message (#5303) --- utils/torch_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/torch_utils.py b/utils/torch_utils.py index 352ecf572c9f..d1c48f73ea72 100644 --- a/utils/torch_utils.py +++ b/utils/torch_utils.py @@ -299,7 +299,10 @@ def __call__(self, epoch, fitness): self.possible_stop = delta >= (self.patience - 1) # possible stop may occur next epoch stop = delta >= self.patience # stop training if patience exceeded if stop: - LOGGER.info(f'EarlyStopping patience {self.patience} exceeded, stopping training.') + LOGGER.info(f'Stopping training early as no improvement observed in last {self.patience} epochs. ' + f'Best results observed at epoch {self.best_epoch}, best model saved as best.pt.\n' + f'To update EarlyStopping(patience={self.patience}) pass a new patience value, ' + f'i.e. `python train.py --patience 300` or use `--patience 0` to disable EarlyStopping.') return stop