Spaces:
Runtime error
Runtime error
Commit
Β·
bd0bd80
1
Parent(s):
b6a0b2f
Add trust_remote_code=True to support Qwen-VL
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ from PIL import Image
|
|
| 4 |
import torch
|
| 5 |
|
| 6 |
model_id = "Qwen/Qwen-VL"
|
| 7 |
-
processor = AutoProcessor.from_pretrained(model_id)
|
| 8 |
-
model = AutoModelForVision2Seq.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
| 9 |
|
| 10 |
def answer_question(image, question):
|
| 11 |
inputs = processor(images=image, text=question, return_tensors="pt").to("cuda")
|
|
|
|
| 4 |
import torch
|
| 5 |
|
| 6 |
model_id = "Qwen/Qwen-VL"
|
| 7 |
+
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
| 8 |
+
model = AutoModelForVision2Seq.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto", trust_remote_code=True)
|
| 9 |
|
| 10 |
def answer_question(image, question):
|
| 11 |
inputs = processor(images=image, text=question, return_tensors="pt").to("cuda")
|