added early epoch stopping hook

This commit is contained in:
William Falcon 2019-04-21 12:26:35 -04:00
parent 8eca3ffa41
commit 86261b7404
2 changed files with 7 additions and 0 deletions

View File

@ -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
# ---------------

View File

@ -18,3 +18,6 @@ class ModelHooks(torch.nn.Module):
def on_post_performance_check(self):
pass
def should_stop_epoch(self):
return False