-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[AutoParallel] GPT support shared parameters #10783
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
90db0e7
init shared parameters
waliwali777 18b121b
update shared_parameters
waliwali777 080e701
fix status
waliwali777 4b3b571
update shard param placements
waliwali777 e4f88f4
update shard param placements
waliwali777 49ba28c
fix lint
waliwali777 20c3b84
update loss base
waliwali777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2506,11 +2506,11 @@ function llm_gpt_dygraph_auto_bs8_fp32_DP2() { | |
| ips=-1 | ||
| mem=-1 | ||
| echo "result: loss=$loss ips=$ips mem=$mem loss_md5=$loss_md5" | ||
| loss_base=10.55853653 # output of dropout is different after supporting spmd | ||
| loss_base=10.55727577 # output of dropout is different after supporting spmd | ||
| ips_base=-1 | ||
| mem_base=-1 | ||
| if [ $IS_A100 -ne 0 ];then | ||
| loss_base=10.56019211 # after add dropout spmd | ||
| loss_base=10.56668472 # after add dropout spmd | ||
| fi | ||
| check_result $FUNCNAME ${loss_base} ${loss} ${ips_base} ${ips} ${mem_base} ${mem} | ||
| echo "=========== $FUNCNAME run end ===========" | ||
|
|
@@ -2578,11 +2578,11 @@ function llm_gpt_dygraph_auto_bs8_fp32_DP2-MP2() { | |
| ips=-1 | ||
| mem=-1 | ||
| echo "result: loss=$loss ips=$ips mem=$mem loss_md5=$loss_md5" | ||
| loss_base=10.5657959 # output of dropout is different after supporting spmd | ||
| loss_base=10.49585533 # output of dropout is different after supporting spmd | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 用了共享参数后,loss 差异这么大吗
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我这边是发现隐藏层层数较少时,共享参数 + 其他切分状态修改, loss 受影响比较大 |
||
| ips_base=-1 | ||
| mem_base=-1 | ||
| if [ $IS_A100 -ne 0 ];then | ||
| loss_base=10.5760107 # after add dropout spmd | ||
| loss_base=10.51038742 # after add dropout spmd | ||
| fi | ||
| check_result $FUNCNAME ${loss_base} ${loss} ${ips_base} ${ips} ${mem_base} ${mem} | ||
| echo "=========== $FUNCNAME run end ===========" | ||
|
|
@@ -2651,11 +2651,11 @@ function llm_gpt_dygraph_auto_bs8_fp32_DP2-MP2-PP2() { | |
| mem=-1 | ||
| echo "result: loss=$loss ips=$ips mem=$mem loss_md5=$loss_md5" | ||
| # loss_base=10.59993172 # note: need to debug | ||
| loss_base=10.57174778 # output of dropout is different after supporting spmd | ||
| loss_base=10.49603939 # output of dropout is different after supporting spmd | ||
| ips_base=-1 | ||
| mem_base=-1 | ||
| if [ $IS_A100 -ne 0 ];then | ||
| loss_base=10.57701015 # after add dropout spmd | ||
| loss_base=10.51580238 # after add dropout spmd | ||
| fi | ||
| check_result $FUNCNAME ${loss_base} ${loss} ${ips_base} ${ips} ${mem_base} ${mem} | ||
| echo "=========== $FUNCNAME run end ===========" | ||
|
|
@@ -2724,11 +2724,11 @@ function llm_gpt_dygraph_auto_bs8_fp16_DP2-MP2-PP2() { | |
| mem=-1 | ||
| echo "result: loss=$loss ips=$ips mem=$mem loss_md5=$loss_md5" | ||
| # loss_base=10.58456802 # note: need to debug | ||
| loss_base=10.57304478 | ||
| loss_base=10.49809837 | ||
| ips_base=-1 | ||
| mem_base=-1 | ||
| if [ $IS_A100 -ne 0 ];then | ||
| loss_base=10.57861042 # after add dropout spmd | ||
| loss_base=10.51762962 # after add dropout spmd | ||
| fi | ||
| check_result $FUNCNAME ${loss_base} ${loss} ${ips_base} ${ips} ${mem_base} ${mem} | ||
| echo "=========== $FUNCNAME run end ===========" | ||
|
|
||
Oops, something went wrong.
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.
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.
疑问:这里为什么要行切? embedding 算子是不支持行切的,所以实际上还是要 Allgather 的
如果要行切,是否能替换成 c_embedding
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.
因为 lmhead 层为了支持 parallel_cross_centropy,所以 weight 必须是 行切;因为共享参数需要切分状态是一致的,所以参数同步时会引入一些通信。
经过测试 lmhead weight 和 embedding weight 不同切分状态的组合,发现同为行切时,此时性能最佳;虽然embedding 计算时会引入 allgather,但该该通信总耗时是最少的
替换成 c_embedding 是可行的,可以之后 PR 中再支持