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

[cherry pick]set_state_dict not use state_dict hook (#43407) #43711

Merged

Conversation

zhangbo9674
Copy link
Contributor

@zhangbo9674 zhangbo9674 commented Jun 21, 2022

PR types

Bug fixes

PR changes

APIs

Describe

修复的问题:
在 amp-o2功能开发过程中,为了支持指定网络存储数据类型的功能,添加state_dict hook功能,但是在Layer的set_state_dict是通过state_dict获取网络参数并加载的,hook接口的存在导致 set_state_dict无法加载到原本网络参数。
本pr通过增加hook控制开关,在set_state_dict中禁用hook解决该问题。

详见pr43407

* set_state_dict not use state_dict hook

* add ut

* refine doc
@paddle-bot-old
Copy link

你的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.

@zhangbo9674 zhangbo9674 reopened this Jun 22, 2022
@lanxianghit lanxianghit merged commit 0fb6635 into PaddlePaddle:release/2.3 Jun 22, 2022
@zhangbo9674 zhangbo9674 deleted the cp/fix_amp_o2_state_dict branch March 2, 2023 03:00
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