deepspeedai / deepspeedai/DeepSpeed

[BUG]deepspeed zero3 gets error in dist.get_rank() in multiple node and multiple gpu

Open
#4,931 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug training
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Describe the bug
deepspeed zero3 gets error in dist.get_rank() in multiple node and multiple gpu
it is perfectly fine when setting to stage 2

transformers: v.4.36.0
accelerate: v.0.26.0
deepspeed: v.0.12.6

To Reproduce
my configuration is
"zero_optimization": {
"stage": 3,
"offload_param": {
"device": "cpu",
"pin_memory": false
},
"offload_optimizer": {
"device": "cpu",
"pin_memory": true
},
"overlap_comm": true,
"contiguous_gradients": true,
"sub_group_size": 1e8,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e8,
"stage3_max_reuse_distance": 1e8,
"stage3_gather_16bit_weights_on_model_save": true
},
"gradient_clipping": "auto",
"steps_per_print": 2000,
"train_batch_size": "auto",
"wall_clock_breakdown": false,
"train_micro_batch_size_per_gpu": 1,
"gradient_accumulation_steps": 1

Steps to reproduce the behavior:

  1. run the mixtral moe 8*7b full model with torchrun
  2. it directly go to the function /home/tiger/.local/lib/python3.9/site-packages/deepspeed/runtime/config.py
    try:
    self.global_rank = dist.get_rank()
    if mpu is None:
    self.world_size = dist.get_world_size()
    else:
    self.world_size = mpu.get_data_parallel_world_size()
    except:
    self.global_rank = 0
    self.world_size = 1
  3. remove the try except, the dist.get_rank() reports error. The same code is fine when stage is set to 2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at deepspeed/runtime/config.py and inspect the shown dist.get_rank() call in the configuration initialization path. Reproduce the Mixtral MoE 8x7B multi-node, multi-GPU run with torchrun using the supplied ZeRO-3 settings, and capture the actual exception before comparing it with ZeRO-2. Done means the ZeRO-3 failure is explained and the reproduction no longer fails under the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.