deepspeedai / deepspeedai/DeepSpeed

[BUG] Running DDP with transformers integrated deepspeed get a deadlock (long time no response) when training model.

Open
#4,933 0 comments 0 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
I am running LLaVA code for improvements, but I added a nn.Parameter into the model and set requires_grad is True. I got a long time no response from the terminal. After I debugged train.py, I found that it may get a deadlock when running this line. There is no any response, just stuck here. When I go deeper with this line, the program is doing all_reduce in this line

https://github.com/microsoft/DeepSpeed/blob/ee7db48373bffedba9e5f5b570b7e07202b7a875/deepspeed/runtime/zero/stage_1_and_2.py#L1972

When I set requires_grad is False, everything works fine.

Expected behavior
Run properly with nn.Parameter when requires_grad is True.

ds_report output

--------------------------------------------------
DeepSpeed C++/CUDA extension op report
--------------------------------------------------
NOTE: Ops not installed will be just-in-time (JIT) compiled at
      runtime if needed. Op compatibility means that your system
      meet the required dependencies to JIT install the op.
--------------------------------------------------
JIT compiled ops requires ninja
ninja .................. [OKAY]
--------------------------------------------------
op name ................ installed .. compatible
--------------------------------------------------
 [WARNING]  async_io requires the dev libaio .so object and headers but these were not found.
 [WARNING]  async_io: please install the libaio-dev package with apt
 [WARNING]  If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.
async_io ............... [NO] ....... [NO]
cpu_adagrad ............ [NO] ....... [OKAY]
cpu_adam ............... [NO] ....... [OKAY]
fused_adam ............. [NO] ....... [OKAY]
fused_lamb ............. [NO] ....... [OKAY]
quantizer .............. [NO] ....... [OKAY]
random_ltd ............. [NO] ....... [OKAY]
 [WARNING]  sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.0
 [WARNING]  using untested triton version (2.0.0), only 1.0.0 is known to be compatible
sparse_attn ............ [NO] ....... [NO]
spatial_inference ...... [NO] ....... [OKAY]
transformer ............ [NO] ....... [OKAY]
stochastic_transformer . [NO] ....... [OKAY]
transformer_inference .. [NO] ....... [OKAY]
--------------------------------------------------
DeepSpeed general environment info:
torch install path ............... ['/home/xiejunlin/miniconda3/envs/videollava/lib/python3.10/site-packages/torch']
torch version .................... 2.0.1
deepspeed install path ........... ['/home/xiejunlin/miniconda3/envs/videollava/lib/python3.10/site-packages/deepspeed']
deepspeed info ................... 0.9.5, unknown, unknown
torch cuda version ............... 11.8
torch hip version ................ None
nvcc version ..................... 11.5
deepspeed wheel compiled w. ...... torch 2.0, cuda 11.8

Screenshots
image
image
image
image

System info (please complete the following information):

  • OS: Ubuntu 20.04
  • GPU count and types: one machine with x8 A6000s each
  • Interconnects: NVLink
  • Python version: 3.10.2
  • torch: 2.0.1
  • transformers: 4.31.0

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 with the reported train.py path and inspect deepspeed/runtime/engine.py at line 2063 and deepspeed/runtime/zero/stage_1_and_2.py at line 1972. Reproduce the DDP and Transformers-integrated DeepSpeed run with the added nn.Parameter under both requires_grad settings, then determine what is needed for the all_reduce path to complete without a deadlock.

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
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.