Skip to content

Commit

Permalink
Fixed issue with single gpu not having world_size
Browse files Browse the repository at this point in the history
  • Loading branch information
NanoCode012 committed Jul 14, 2020
1 parent 6364892 commit 787582f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ def train(hyp, tb_writer, opt, device):
opt.img_size.extend([opt.img_size[-1]] * (2 - len(opt.img_size))) # extend to 2 sizes (train, test)
device = torch_utils.select_device(opt.device, apex=mixed_precision, batch_size=opt.batch_size)
opt.total_batch_size = opt.batch_size
opt.world_size = 1
if device.type == 'cpu':
mixed_precision = False
opt.world_size = 1
elif opt.local_rank != -1:
# DDP mode
assert torch.cuda.device_count() > opt.local_rank
Expand Down

0 comments on commit 787582f

Please sign in to comment.