deepspeedai / deepspeedai/DeepSpeed
zero3 training hangs with mixed multimodal dataset
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
zero3 qwen2-vl training hangs when with mixed multimodal dataset.
When different GPUs have different modalities of mini-batch, multimodal related variables have different shapes among GPUs.
For example, video related tensor video_grid_thw have values on GPU0, but is None on GPU1.
The training hangs when dealing with this variable.
The hanging DOES NOT occur when using zero-2.
Is it caused by variable comunication between GPUs in zero-3?
What's the right way to train mixed modality data with zero-3?
dataset: mixure of pure-text, image-text
model: qwen2-vl
training on: 8xA100
stage3 config:
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},
"zero_optimization": {
"stage": 3,
"overlap_comm": true,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"stage3_gather_16bit_weights_on_model_save": true
},
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"steps_per_print": 100,
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"wall_clock_breakdown": false
}
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 by reproducing mixed pure-text and image-text Qwen2-VL training on 8 A100 GPUs with the supplied ZeRO-3 configuration, then compare it with ZeRO-2. Inspect how the video_grid_thw value is handled when it is a tensor on one rank and None on another. Done means mixed-modality training completes without hanging under ZeRO-3.
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
- Mostly clear
- Newbie friendliness
- 35/100