glenn-jocher commited on
Commit
441b47c
1 Parent(s): 15e8c4c

More informative `EarlyStopping()` message (#5303)

Browse files
Files changed (1) hide show
  1. utils/torch_utils.py +4 -1
utils/torch_utils.py CHANGED
@@ -299,7 +299,10 @@ class EarlyStopping:
299
  self.possible_stop = delta >= (self.patience - 1) # possible stop may occur next epoch
300
  stop = delta >= self.patience # stop training if patience exceeded
301
  if stop:
302
- LOGGER.info(f'EarlyStopping patience {self.patience} exceeded, stopping training.')
 
 
 
303
  return stop
304
 
305
 
 
299
  self.possible_stop = delta >= (self.patience - 1) # possible stop may occur next epoch
300
  stop = delta >= self.patience # stop training if patience exceeded
301
  if stop:
302
+ LOGGER.info(f'Stopping training early as no improvement observed in last {self.patience} epochs. '
303
+ f'Best results observed at epoch {self.best_epoch}, best model saved as best.pt.\n'
304
+ f'To update EarlyStopping(patience={self.patience}) pass a new patience value, '
305
+ f'i.e. `python train.py --patience 300` or use `--patience 0` to disable EarlyStopping.')
306
  return stop
307
 
308