mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-24 13:50:25 +08:00
Early stopping when validation is disabled (#1235)
* early stop fallback to train epoch * added test * fix imports * update docs * update changelog * fix typo
This commit is contained in:
@@ -4,8 +4,8 @@ Early stopping
|
||||
Default behavior
|
||||
----------------
|
||||
By default early stopping will be enabled if `'val_loss'`
|
||||
is found in `validation_epoch_end()` return dict. Otherwise
|
||||
training will proceed with early stopping disabled.
|
||||
is found in :meth:`~pytorch_lightning.core.lightning.LightningModule.validation_epoch_end`'s
|
||||
return dict. Otherwise training will proceed with early stopping disabled.
|
||||
|
||||
Enable Early Stopping
|
||||
---------------------
|
||||
@@ -30,9 +30,18 @@ There are two ways to enable early stopping.
|
||||
)
|
||||
trainer = Trainer(early_stop_callback=early_stop_callback)
|
||||
|
||||
In any case, the callback will fall back to the training metrics (returned in
|
||||
:meth:`~pytorch_lightning.core.lightning.LightningModule.training_step`,
|
||||
:meth:`~pytorch_lightning.core.lightning.LightningModule.training_step_end`)
|
||||
looking for a key to monitor if validation is disabled or
|
||||
:meth:`~pytorch_lightning.core.lightning.LightningModule.validation_epoch_end`
|
||||
is not defined.
|
||||
|
||||
|
||||
Disable Early Stopping
|
||||
----------------------
|
||||
To disable early stopping pass ``False`` to the `early_stop_callback`.
|
||||
To disable early stopping pass ``False`` to the
|
||||
:paramref:`~pytorch_lightning.trainer.trainer.Trainer.early_stop_callback`.
|
||||
Note that ``None`` will not disable early stopping but will lead to the
|
||||
default behaviour.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user