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

improve amp training #10119

Merged
merged 1 commit into from
Jun 8, 2023
Merged

Conversation

zhangting2020
Copy link
Contributor

背景:ch_PP-OCRv2_det 模型在amp fp16训练中,O1、O2都会出现nan,原因是模型中卷积层的数值范围极大,超出了fp16的表示范围,并不适合这种训练方式。我们尝试了amp bf16 训练,发现无需任何额外配置,模型未出现nan,精度和相同配置下的fp32训练可以对齐。

PR:为套件添加amp_dtype的选项,默认为float16,给ch_PP-OCRv2_det 模型配置为bfloat16

@paddle-bot
Copy link

paddle-bot bot commented Jun 8, 2023

Thanks for your contribution!

Copy link
Collaborator

@andyjiang1116 andyjiang1116 left a comment

Choose a reason for hiding this comment

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

LGTM

@andyjiang1116 andyjiang1116 merged commit 6949448 into PaddlePaddle:dygraph Jun 8, 2023
2 checks passed
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.

None yet

2 participants