Spaces:
Running
on
Zero
Running
on
Zero
khang119966
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -101,7 +101,7 @@ def load_image(image_file, input_size=448, max_num=12):
|
|
101 |
|
102 |
model = AutoModel.from_pretrained(
|
103 |
"5CD-AI/Vintern-1B-v3_5",
|
104 |
-
torch_dtype=torch.
|
105 |
low_cpu_mem_usage=True,
|
106 |
trust_remote_code=True,
|
107 |
).eval().cuda()
|
@@ -122,12 +122,12 @@ We currently only support one image at the start of the context! Please start a
|
|
122 |
test_image = message["files"][0]["path"]
|
123 |
else:
|
124 |
test_image = message["files"][0]
|
125 |
-
pixel_values = load_image(test_image, max_num=6).cuda()
|
126 |
elif len(history) == 0 and len(message["files"]) == 0:
|
127 |
pixel_values = None
|
128 |
elif history[0][0][0] is not None and os.path.isfile(history[0][0][0]):
|
129 |
test_image = history[0][0][0]
|
130 |
-
pixel_values = load_image(test_image, max_num=6).cuda()
|
131 |
else:
|
132 |
pixel_values = None
|
133 |
|
|
|
101 |
|
102 |
model = AutoModel.from_pretrained(
|
103 |
"5CD-AI/Vintern-1B-v3_5",
|
104 |
+
torch_dtype=torch.bfloat16,
|
105 |
low_cpu_mem_usage=True,
|
106 |
trust_remote_code=True,
|
107 |
).eval().cuda()
|
|
|
122 |
test_image = message["files"][0]["path"]
|
123 |
else:
|
124 |
test_image = message["files"][0]
|
125 |
+
pixel_values = load_image(test_image, max_num=6).to(torch.bfloat16).cuda()
|
126 |
elif len(history) == 0 and len(message["files"]) == 0:
|
127 |
pixel_values = None
|
128 |
elif history[0][0][0] is not None and os.path.isfile(history[0][0][0]):
|
129 |
test_image = history[0][0][0]
|
130 |
+
pixel_values = load_image(test_image, max_num=6).to(torch.bfloat16).cuda()
|
131 |
else:
|
132 |
pixel_values = None
|
133 |
|