mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-07 17:00:22 +08:00
added early epoch stopping hook
This commit is contained in:
@@ -266,6 +266,10 @@ class Trainer(TrainerIO):
|
||||
if met_batch_limit:
|
||||
break
|
||||
|
||||
# give model a chance to end epoch early
|
||||
if self.model.should_stop_epoch():
|
||||
break
|
||||
|
||||
# ---------------
|
||||
# RUN TRAIN STEP
|
||||
# ---------------
|
||||
|
||||
@@ -18,3 +18,6 @@ class ModelHooks(torch.nn.Module):
|
||||
|
||||
def on_post_performance_check(self):
|
||||
pass
|
||||
|
||||
def should_stop_epoch(self):
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user