From dbc3fd5eb49f3ba726e64c56f03dab56f08f23be Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Tue, 30 Jun 2020 14:33:12 +0800 Subject: [PATCH] fix LinearLrWarmup bug; test=develop (#24913) --- python/paddle/fluid/dygraph/learning_rate_scheduler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/dygraph/learning_rate_scheduler.py b/python/paddle/fluid/dygraph/learning_rate_scheduler.py index f7ca63d220..3969cf4f95 100644 --- a/python/paddle/fluid/dygraph/learning_rate_scheduler.py +++ b/python/paddle/fluid/dygraph/learning_rate_scheduler.py @@ -664,6 +664,7 @@ class LinearLrWarmup(LearningRateDecay): format(learning_rate)) self.learning_rate = learning_rate self.warmup_steps = warmup_steps + self.start_lr = start_lr assert end_lr > start_lr, "end_lr {} must be greater than start_lr {}".format( end_lr, start_lr) self.lr_ratio_before_warmup = ( @@ -676,7 +677,7 @@ class LinearLrWarmup(LearningRateDecay): from .. import layers if self.step_num < self.warmup_steps: - return self.lr_ratio_before_warmup * self.step_num + return self.lr_ratio_before_warmup * self.step_num + self.start_lr else: return base_lr -- GitLab