Spaces:
Runtime error
Runtime error
BUGFIX: half not available in cpu
Browse files
app.py
CHANGED
@@ -10,12 +10,12 @@ _MODEL_PATH = 'IDEA-CCNL/Taiyi-BLIP-750M-Chinese'
|
|
10 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
11 |
processor = BlipProcessor.from_pretrained(_MODEL_PATH, use_auth_token=HF_TOKEN)
|
12 |
model = BlipForConditionalGeneration.from_pretrained(
|
13 |
-
_MODEL_PATH, use_auth_token=HF_TOKEN).
|
14 |
|
15 |
|
16 |
def inference(raw_image, model_n, strategy):
|
17 |
if model_n == 'Image Captioning':
|
18 |
-
input = processor(raw_image, return_tensors="pt").to(device
|
19 |
with torch.no_grad():
|
20 |
if strategy == "Beam search":
|
21 |
config = GenerationConfig(
|
|
|
10 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
11 |
processor = BlipProcessor.from_pretrained(_MODEL_PATH, use_auth_token=HF_TOKEN)
|
12 |
model = BlipForConditionalGeneration.from_pretrained(
|
13 |
+
_MODEL_PATH, use_auth_token=HF_TOKEN).eval().to(device)
|
14 |
|
15 |
|
16 |
def inference(raw_image, model_n, strategy):
|
17 |
if model_n == 'Image Captioning':
|
18 |
+
input = processor(raw_image, return_tensors="pt").to(device)
|
19 |
with torch.no_grad():
|
20 |
if strategy == "Beam search":
|
21 |
config = GenerationConfig(
|