Add Naive Training Moe Example Code on Single GPU or Multi GPUs#10
Closed
xhx1022 wants to merge 2 commits intointelligent-machine-learning:mainfrom
xhx1022:moe
Closed
Add Naive Training Moe Example Code on Single GPU or Multi GPUs#10xhx1022 wants to merge 2 commits intointelligent-machine-learning:mainfrom xhx1022:moe
xhx1022 wants to merge 2 commits intointelligent-machine-learning:mainfrom
xhx1022:moe
Conversation
skydoorkai
reviewed
Aug 7, 2025
Collaborator
skydoorkai
left a comment
There was a problem hiding this comment.
Is this example running with 4 GPUs?
Then the title Single-GPU Training is not correct.
skydoorkai
reviewed
Aug 7, 2025
| @@ -0,0 +1,17 @@ | |||
| __version__ = "1.0.0" | |||
Collaborator
There was a problem hiding this comment.
There are dualpipe codes, no need to be included.
In the README.md, explain how to clone the dualpipe codes, setup PYTHONPATH.
skydoorkai
reviewed
Aug 7, 2025
|
|
||
| def apply_load_balancing_loss(self, router_probs, tokens_per_expert): | ||
| if self.moe_aux_loss_coeff > 0 and self.training: | ||
| # 计算每个专家的负载 |
Collaborator
There was a problem hiding this comment.
Use English for comments.
skydoorkai
reviewed
Aug 7, 2025
| self.moe_z_loss_coeff = z_loss_coeff | ||
| self.initializer_range = 0.02 | ||
|
|
||
| class MoEAuxLossAutoScaler(torch.autograd.Function): |
Collaborator
There was a problem hiding this comment.
If these MOE model definition codes are copied/modified from other repo's codes, add comments stating the original code source.
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
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.
Added a new training example function demonstrating how to train the MoE model on a single GPU or multi GPUS using dummy data. #9