mshukor commited on
Commit
2dc23ea
1 Parent(s): 272337c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -44,6 +44,7 @@ yaml=YAML(typ='safe')
44
 
45
  use_cuda = torch.cuda.is_available()
46
  device = torch.device('cuda') if use_cuda else torch.device('cpu')
 
47
 
48
  ## Load model
49
 
@@ -133,7 +134,7 @@ def inference(image, audio, video, task_type, instruction):
133
 
134
 
135
 
136
- with torch.autocast(device_type='cuda', dtype=torch.float16, enabled=True):
137
 
138
  out = model(image=image, text=text_input, mode='generate', return_dict=True, max_length=max_length,
139
  do_sample=do_sample, num_beams=num_beams)
 
44
 
45
  use_cuda = torch.cuda.is_available()
46
  device = torch.device('cuda') if use_cuda else torch.device('cpu')
47
+ device_type = 'cuda' if use_cuda else 'cpu'
48
 
49
  ## Load model
50
 
 
134
 
135
 
136
 
137
+ with torch.autocast(device_type=device_type, enabled=True):
138
 
139
  out = model(image=image, text=text_input, mode='generate', return_dict=True, max_length=max_length,
140
  do_sample=do_sample, num_beams=num_beams)