Skip to content

Commit 85d7378

Browse files
nickdrhodesalexmirrington
authored andcommitted
hotfix for non-CUDA compatbility
1 parent f08787d commit 85d7378

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

code/algorithm/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ def main(config):
2424
cuda = torch.cuda.is_available()
2525
device = torch.device('cuda' if cuda else 'cpu')
2626
print(f'torch: {torch.__version__}')
27-
print(f'{device}: {torch.cuda.get_device_name(device)}')
27+
if cuda:
28+
print(f'{device}: {torch.cuda.get_device_name(device)}')
29+
else:
30+
print('Using CPU')
2831
print(colored('Preprocessing...', color='cyan', attrs=['bold', ]))
2932

3033
train_val_data = ImageCaptionDataset(config.data_dir, 'train')

0 commit comments

Comments
 (0)