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

[AMP] Support overload of paddle.static.amp.decorate function. #52918

Merged
merged 6 commits into from Apr 18, 2023

Conversation

Xreki
Copy link
Contributor

@Xreki Xreki commented Apr 14, 2023

PR types

Others

PR changes

Others

Describe

老版本静态图AMP接口只支持FP16。为了兼容老版本,Paddle 2.5版本计划新增一个同名函数paddle.static.amp.decorate,通过dtype、level配置不同数据类型、不同级别AMP训练。(相关功能已经在#52694中实现,PR中暂时新增了一个amp_decorate接口。)

本PR参考文章为什么 Python 没有函数重载?如何用装饰器实现函数重载?,实现了专为decorate设计的overload功能,从而支持框架中同时存在2个paddle.static.amp.decorate函数,且能自动通过参数选择正确的版本。

flake会自动检查python是否定义了同名函数,故将该文件加入了ignore列表中。

@paddle-bot
Copy link

paddle-bot bot commented Apr 14, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@Xreki Xreki changed the title Implement a common AmpTestBase. [AMP] Support overload of paddle.static.amp.decorate. Apr 17, 2023
@Xreki Xreki changed the title [AMP] Support overload of paddle.static.amp.decorate. [AMP] Support overload of paddle.static.amp.decorate function. Apr 17, 2023
Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

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

LGTM for skipIf

@Xreki Xreki merged commit 79a01d6 into PaddlePaddle:develop Apr 18, 2023
23 of 24 checks passed
@Xreki Xreki deleted the amp/unify_apis branch April 18, 2023 01:02
jjyaoao pushed a commit to jjyaoao/Paddle that referenced this pull request Apr 19, 2023
…ePaddle#52918)

* Implement a common AmpTestBase.

* Support overload of decorate.

* Change the ignore list of flake and fix an error.
lijialin03 pushed a commit to lijialin03/Paddle that referenced this pull request Apr 25, 2023
…ePaddle#52918)

* Implement a common AmpTestBase.

* Support overload of decorate.

* Change the ignore list of flake and fix an error.
zhangting2020 pushed a commit to zhangting2020/Paddle that referenced this pull request Apr 28, 2023
…ePaddle#52918)

* Implement a common AmpTestBase.

* Support overload of decorate.

* Change the ignore list of flake and fix an error.
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

3 participants