mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

[Bug] Possibly false if-clause in dataset builder for distributed use

Open Maenansyn opened this issue 2 years ago • 0 comments

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmdetection

Environment

Reproduces the problem - code sample

Link to potential mixed up if-clause

if dist:
        # When model is :obj:`DistributedDataParallel`,
        # `batch_size` of :obj:`dataloader` is the
        # number of training samples on each GPU.
        batch_size = samples_per_gpu
        num_workers = workers_per_gpu
else:
        # When model is obj:`DataParallel`
        # the batch size is samples on all the GPUS
        batch_size = num_gpus * samples_per_gpu
        num_workers = num_gpus * workers_per_gpu

Reproduces the problem - command or script

not needed

Reproduces the problem - error message

not existing

Additional information

Shouldn't the parts be changed to:

if dist:
        # When model is :obj:`DistributedDataParallel`,
        # `batch_size` of :obj:`dataloader` is the
        # number of training samples on each GPU
        # multiplied by the number of used gpus.
        batch_size = num_gpus * samples_per_gpu
        num_workers = num_gpus * workers_per_gpu
else:
        # When model is obj:`DataParallel`
        # the batch size is samples on one GPU
        batch_size = samples_per_gpu
        num_workers = workers_per_gpu

I can create a PR for it, but first I wanted to let it be checked that it's actually mixed up.

Maenansyn avatar Dec 05 '22 10:12 Maenansyn