Skip to content

Commit

Permalink
[Fix] Fix bugs about cfg.gpu_ids in distributed training (#745)
Browse files Browse the repository at this point in the history
Co-authored-by: Yucheng Zhao <v-yuczhao@microsoft.com>
  • Loading branch information
yuzhms and Yucheng Zhao committed Oct 21, 2022
1 parent e3b492c commit 2c7a8af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/train.py
Expand Up @@ -10,7 +10,7 @@
import torch
import torch.distributed as dist
from mmcv import Config, DictAction
from mmcv.runner import init_dist
from mmcv.runner import get_dist_info, init_dist
from mmdet.apis import set_random_seed

from mmtrack import __version__
Expand Down Expand Up @@ -135,6 +135,9 @@ def main():
else:
distributed = True
init_dist(args.launcher, **cfg.dist_params)
# gpu_ids is used to calculate iter when resuming checkpoint,
_, world_size = get_dist_info()
cfg.gpu_ids = range(world_size)

# create work_dir
mmcv.mkdir_or_exist(osp.abspath(cfg.work_dir))
Expand Down

0 comments on commit 2c7a8af

Please sign in to comment.