deepspeedai / deepspeedai/DeepSpeed
[BUG] pipeline parallelism+fp16+moe isn't working
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
Describe the bug
My model use deepspeed PipelineModule(num_stages=4) split into 4 parts, and my deepspeed.moe.layer.MoE is only set in the pipeline stage1 layer. When my model train_batch, the program will get stuck, the specific issue occurs in FP16_Optimizer step.
Here is our deepspeed config
{
"train_batch_size": 4,
"train_micro_batch_size_per_gpu" 1,
"fp16": {
"enabled": true,
"auto_cast": true
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": 0.001,
"betas": [
0.9,
0.95
],
"weight_decay": 0.05
}
},
"zero_optimization": {
"stage": 0
}
}
Source code with issues
my pipeline_parallel_world_size is 4, the code will enter the following branch, but my moe layer only is set in pipeline stage1, then all_reduce will make program stuck. If I delete this code, it will run successfully.
I don't know why all_reduce needs to be done here, it doesn't seem meaningful
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with deepspeed/runtime/utils.py around lines 892-893 and trace the FP16_Optimizer step reached by train_batch. Reproduce the configuration with PipelineModule(num_stages=4), FP16, and MoE only in pipeline stage 1, then inspect the all_reduce participation across stages. Done means the hang is explained and the behavior is corrected or clearly documented with a validating reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100