seungheondoh commited on
Commit
1fe02e5
β€’
1 Parent(s): 59ef0c8
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -21,7 +21,8 @@ model = BartCaptionModel(max_length = 128)
21
  pretrained_object = torch.load('./transfer.pth', map_location='cpu')
22
  state_dict = pretrained_object['state_dict']
23
  model.load_state_dict(state_dict)
24
- torch.cuda.set_device(device)
 
25
  model = model.cuda(device)
26
  model.eval()
27
 
 
21
  pretrained_object = torch.load('./transfer.pth', map_location='cpu')
22
  state_dict = pretrained_object['state_dict']
23
  model.load_state_dict(state_dict)
24
+ if torch.cuda.is_available():
25
+ torch.cuda.set_device(device)
26
  model = model.cuda(device)
27
  model.eval()
28