Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinearWarmup.get_lr should not increase epoch of built-in LRScheduler #31843

Merged
merged 1 commit into from
Mar 25, 2021

Conversation

zhwesky2010
Copy link
Contributor

@zhwesky2010 zhwesky2010 commented Mar 24, 2021

PR types

Bug fixes

PR changes

APIs

Describe

在LinearWarmup中,调用get_lr函数会触发LinearWarmup中内置LRScheduler的step()函数,导致新增epoch。修改为:get_lr时仅计算对应学习率,不新增epoch。

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@zhwesky2010 zhwesky2010 changed the title LRScheduler.get_lr should not update lr in LinearWarmup LinearWarmup.get_lr should not increase epoch of built-in LRScheduler Mar 24, 2021
natural_lr_warmup = paddle.optimizer.lr.LinearWarmup(
learning_rate=natural_lr, warmup_steps=10, start_lr=0.0, end_lr=0.1)
for idx in range(30):
print(natural_lr_warmup.get_lr())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print是不是需要删掉?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhwesky2010 zhwesky2010 merged commit 511e204 into PaddlePaddle:develop Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants