Merge pull request #3278 from DanBmh/refactor_rlrop_cond

Refactor rlrop condition
This commit is contained in:
lissyx 2020-08-31 16:49:01 +02:00 committed by GitHub
commit ccb1a6b0d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -642,9 +642,11 @@ def train():
# Reduce learning rate on plateau # Reduce learning rate on plateau
# If the learning rate was reduced and there is still no improvement # If the learning rate was reduced and there is still no improvement
# wait FLAGS.plateau_epochs before the learning rate is reduced again # wait FLAGS.plateau_epochs before the learning rate is reduced again
if (FLAGS.reduce_lr_on_plateau and if (
epochs_without_improvement % FLAGS.plateau_epochs == 0 and epochs_without_improvement > 0): FLAGS.reduce_lr_on_plateau
and epochs_without_improvement > 0
and epochs_without_improvement % FLAGS.plateau_epochs == 0
):
# Reload checkpoint that we use the best_dev weights again # Reload checkpoint that we use the best_dev weights again
reload_best_checkpoint(session) reload_best_checkpoint(session)