deepspeedai / deepspeedai/DeepSpeed
[BUG] DeepSpeed Cuda OOM on SwinUNETR from MONAI
@tjruwase is already working on this.
Since Mar 4, 2023.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
Describe the bug
I'm trying to run training of SwinUNETR model on a multi-GPU node (4xV00 - 16GB VRAM) with effective batch size per GPU of 1 and sample size 96x96x96. However, even after many tweak in DS config I'm still getting CUDA OOM error.
To Reproduce
Steps to reproduce the behavior:
- Clone 'MONAI SwinUNETR'
- Use deepspeed init with following configuration:
{
"train_micro_batch_size_per_gpu": 1,
"steps_per_print": 1,
"fp16": {
"enabled": true },
"optimizer": {
"type": "Adam",
"params": {
"lr": 0.001,
"betas": [
0.8,
0.999 ],
"eps": 1e-8,
"weight_decay": 3e-7 }
},
"scheduler": {
"type": "WarmupLR",
"params": {
"warmup_min_lr": 0,
"warmup_max_lr": 0.001,
"warmup_num_steps": 100 }
},
"wall_clock_breakdown": false,
"zero_optimization": {
"stage": 3,
"offload_optimizer": {
"device": "cpu" },
"offload_param": {
"device": "cpu" },
"contiguous_gradients": true,
"overlap_comm": false,
"allgather_bucket_size": 5e5,
"reduce_bucket_size": 5e5 },
"zero_allow_untested_optimizer": false,
"activation_checkpointing": {
"partition_activations": true,
"cpu_checkpointing": false,
"contiguous_memory_optimization": false,
"number_checkpoints": null,
"synchronize_checkpoint_boundary": false,
"profile": false }
}
- Get OOM error
Expected behavior
Training proceeds without OOM error
System info (please complete the following information):
- OS: Ubuntu 20.04
- GPU 4xV100 - 16GB VRAM
- Python version: 3.8
Launcher context
AML pipeline with PyTorch distribution:
distribution:
type: pytorch
Docker context
mcr.microsoft.com/azureml/openmpi4.1.0-cuda11.6-cudnn8-ubuntu20.04
Additional context
- Am I missing any further optimizations I can do?
- Is it possible to make train_batch_sizesmaller than #GPUs such that the GPUs can then share memory
- How to effectively enable model parallel in DeepSpeed it that is even possible
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.
Assessment
This issue has not been assessed yet.