Skip to content

Commit cfd4324

Browse files
committed
Multi-GPU default to single device 0
1 parent 958ab92 commit cfd4324

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/torch_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def select_device(device='', batch_size=None):
7272

7373
cuda = not cpu and torch.cuda.is_available()
7474
if cuda:
75-
devices = device.split(',') if device else range(torch.cuda.device_count()) # i.e. 0,1,6,7
75+
devices = device.split(',') if device else '0' # range(torch.cuda.device_count()) # i.e. 0,1,6,7
7676
n = len(devices) # device count
7777
if n > 1 and batch_size: # check batch_size is divisible by device_count
7878
assert batch_size % n == 0, f'batch-size {batch_size} not multiple of GPU count {n}'

0 commit comments

Comments
 (0)