deepspeedai / deepspeedai/DeepSpeed
[BUG] Training batch size is not consistent with train_batch_size
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
For multi-GPU training, the number of batches per epoch does not reduce by the same factor as the number of GPUs.
To Reproduce
For the configuration below, when using a dataset with 1 million samples and 4 GPUs, the number of batches (as obtained from the training dataloader length) is 62,500 (=1M/16) instead of 250,000 (=1M/4).
"train_batch_size": 4, "train_micro_batch_size_per_gpu": 1, "gradient_accumulation_steps": 1,
Expected behavior
The number of batches for a multi-GPU setting should be (training data size )/ num_gpus, but it is not
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 the training dataloader and the batch-size calculation using the reported configuration: train_batch_size=4, train_micro_batch_size_per_gpu=1, and gradient_accumulation_steps=1. Reproduce the dataloader length with 1 million samples and 4 GPUs, then trace why it yields 1M/16 instead of 1M/4; done means the multi-GPU batch count matches the expected division by the number of GPUs.
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
- 30/100