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

修改COPY-FROM No.4 optimizer #6005

Merged
merged 1 commit into from
Jul 19, 2023
Merged

修改COPY-FROM No.4 optimizer #6005

merged 1 commit into from
Jul 19, 2023

Conversation

jjyaoao
Copy link
Contributor

@jjyaoao jjyaoao commented Jul 7, 2023

@paddle-bot
Copy link

paddle-bot bot commented Jul 7, 2023

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6005.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

out.backward()
adam.step()
adam.clear_grad()
COPY-FROM: paddle.optimizer.Adam:code-example1
Copy link
Collaborator

Choose a reason for hiding this comment

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

需要在adam源码文件的代码片段中同步加上 :name: code-example1 :name: code-example2 ,否则无法展示
image

sgd.clear_gradients()
scheduler.step() # If you update learning rate each step
# scheduler.step() # If you update learning rate each epoch
COPY-FROM: paddle.optimizer.lr.StepLR
Copy link
Collaborator

Choose a reason for hiding this comment

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

StepLR是啥...初步看了下,LRScheduler下的step方法,在英文源码中没有代码片段,如果想要copy from,首先得在源码中增加相关代码

out.backward()
rmsprop.step()
rmsprop.clear_grad()
COPY-FROM: paddle.optimizer.RMSProp.minimize

clear_gradients()
Copy link
Collaborator

Choose a reason for hiding this comment

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

没有 clear_gradients()方法,应该是 clear_grad(set_to_zero=True)

Suggested change
clear_gradients()
clear_grad(set_to_zero=True)

out.backward()
rmsprop.step()
rmsprop.clear_gradients()
COPY-FROM: paddle.optimizer.RMSProp.clear_gradients
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
COPY-FROM: paddle.optimizer.RMSProp.clear_gradients
COPY-FROM: paddle.optimizer.RMSProp.clear_grad

Copy link
Collaborator

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit b492e36 into PaddlePaddle:develop Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants