Update app.py
Browse files
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=
|
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)
|