You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
你的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.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
Performance optimization
PR changes
Others
Description
静态图模式下分析得,_remove_var 中 sync_with_cpp 消耗了大量的时间,耗时图如下所示:
经过分析可得,_remove_var 中每次删除var都会进行同步,这是没有必要的,我们只需要在全部的var删除之后做一次同步即可。经模型验证,该优化不会影响模型精度,模型精度可与优化前对齐。
本地测试优化后模型实际Run之前的耗时,优化幅度达 1.37 倍。测试环境:本地四卡 1080Ti机器,PaddleNLP Llama2 7b模型, 静态图模式(hack config: config.num_hidden_layers = 12)
优化前后 cprofiler 结果如下,
<-- !!!
指向的是被优化的项:优化后的耗时可视化如下:
脚本启动命令: