deepspeedai / deepspeedai/DeepSpeed

[BUG] Training batch size is not consistent with train_batch_size

Open
#6,657 1 comment 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
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.