File tree 1 file changed +4
-1
lines changed
pytorch_lightning/trainer
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 50
50
# pass in your own to override the default callback
51
51
trainer = Trainer(early_stop_callback=early_stop_callback)
52
52
53
+ # pass in min_epochs to enable the callback after min_epochs have run
54
+ trainer = Trainer(early_stop_callback=early_stop_callback, min_epochs=5)
55
+
53
56
# pass in None to disable it
54
57
trainer = Trainer(early_stop_callback=None)
55
58
@@ -339,7 +342,7 @@ def train(self):
339
342
self .reduce_lr_on_plateau_scheduler .step (val_loss , epoch = self .current_epoch )
340
343
341
344
# early stopping
342
- met_min_epochs = epoch > self .min_epochs
345
+ met_min_epochs = epoch >= self .min_epochs - 1
343
346
if self .enable_early_stop and (met_min_epochs or self .fast_dev_run ):
344
347
should_stop = self .early_stop_callback .on_epoch_end (epoch = epoch ,
345
348
logs = self .callback_metrics )
You can’t perform that action at this time.
0 commit comments