Changed order of `update_learning_rates()` and `run_training_teardown()`. (#1891)

This commit is contained in:
Kevin Trebing 2020-05-19 19:16:26 +02:00 committed by GitHub
parent 9b629637b8
commit 3459a54667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -347,13 +347,13 @@ class TrainerTrainLoopMixin(ABC):
# ----------------- # -----------------
self.run_training_epoch() self.run_training_epoch()
# update LR schedulers
self.update_learning_rates(interval='epoch')
if self.max_steps and self.max_steps == self.global_step: if self.max_steps and self.max_steps == self.global_step:
self.run_training_teardown() self.run_training_teardown()
return return
# update LR schedulers
self.update_learning_rates(interval='epoch')
# early stopping # early stopping
met_min_epochs = epoch >= self.min_epochs - 1 met_min_epochs = epoch >= self.min_epochs - 1
met_min_steps = self.global_step >= self.min_steps if self.min_steps else True met_min_steps = self.global_step >= self.min_steps if self.min_steps else True