-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
set_state_dict not use state_dict hook #43407
set_state_dict not use state_dict hook #43407
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请注意同时修改中英文文档
* set_state_dict not use state_dict hook * add ut * refine doc
* set_state_dict not use state_dict hook * add ut * refine doc
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解决该问题。
具体改动:
为Layer 的 state_dict 接口增加一个bool参数:use_hook,默认为True,set_state_dict中有调用state_dict接口,use_hook为False
用法上为用户提供了是否使用hook的控制接口,默认使用,用户无需显示声明。
api文档:pr