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

disable promote kernel for amp training #2798

Closed
wants to merge 3 commits into from

Conversation

zhangting2020
Copy link
Contributor

背景:过去框架AMP在O2模式下,当OP支持低精度就会选择低精度的kernel,但这样的策略出现精度问题的风险较高。为保障训练精度,框架在2.5版本对AMP 策略进行了调整,即在O2模式下,仅当Op所有输入为低精度时才会选择低精度kernel,否则则采用FP32 Kernel(即promote的策略),因此可能会引起部分模型出现性能下降。

目前可以通过给auto_cast设置use_promote=False参数来回退到旧版本的O2策略,为了减少对模型配置的修改,本PR给PaddleClas添加该参数的设置功能,当前模型库默认设置为use_promote=False,使用的是旧版本的O2策略,以解决性能下降问题。

PaddlePaddle框架动态图下默认的行为是use_promote=True,未来新增的模型如果出现精度问题,可以尝试给模型配置中增加设置去进行调试。

框架PR:PaddlePaddle/Paddle#53742

@paddle-bot
Copy link

paddle-bot bot commented May 15, 2023

Thanks for your contribution!

Copy link
Collaborator

@TingquanGao TingquanGao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@TingquanGao TingquanGao left a comment

Choose a reason for hiding this comment

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

LGTM

TingquanGao added a commit to TingquanGao/PaddleClas that referenced this pull request May 23, 2023
compatible with paddle 2.5 and older version.
ref: PaddlePaddle#2798
@TingquanGao TingquanGao mentioned this pull request May 23, 2023
@TingquanGao
Copy link
Collaborator

fix in #2814

TingquanGao added a commit that referenced this pull request May 25, 2023
compatible with paddle 2.5 and older version.
ref: #2798
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.

2 participants