-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Add DistributedOptimizer and support ZeRO-1 #98
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
Merged
Conversation
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
be321ca to
4afb235
Compare
df89009 to
837b825
Compare
kilinchange
requested changes
Jan 27, 2026
Collaborator
|
把 ddp 相关的文件在 parallel 里单独放一个 ddp 文件夹吧。 |
Contributor
Author
kilinchange
approved these changes
Jan 29, 2026
Contributor
Author
Contributor
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.






通过
--use_distributed_optimizer来开启基于分布式优化器的 ZeRO-1 优化。Stage 1 的优化对 SGD 没有效果,但是依然在 GPT-2 训练脚本中加了相关 option,为的是之后 stage 2/3 的扩展。实现细节:
--use_distributed_optimizer时则走原先的逻辑;models->Parameters()的构造 function 方法,DistributedOptimizer 在构造时会接受这个 function,并在其构造函数内部创建 base_optimizer;详细实现流程可以参考叙述:https://gxtctab8no8.feishu.cn/wiki/XQbGwXSsZi3MutkZuhXcKWsinnY#share-QU0fdM1cYoT06vxmwMbcnLJUn1b
两个比较重要的细节: