Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,10 +10,12 @@ from tqdm import tqdm
|
|
10 |
|
11 |
from colpali_engine.models import ColQwen2, ColQwen2Processor
|
12 |
|
|
|
|
|
13 |
model = ColQwen2.from_pretrained(
|
14 |
"manu/colqwen2-v1.0-alpha",
|
15 |
torch_dtype=torch.bfloat16,
|
16 |
-
device_map=
|
17 |
# attn_implementation="flash_attention_2", # should work on A100
|
18 |
).eval()
|
19 |
processor = ColQwen2Processor.from_pretrained("manu/colqwen2-v1.0-alpha")
|
|
|
10 |
|
11 |
from colpali_engine.models import ColQwen2, ColQwen2Processor
|
12 |
|
13 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
14 |
+
|
15 |
model = ColQwen2.from_pretrained(
|
16 |
"manu/colqwen2-v1.0-alpha",
|
17 |
torch_dtype=torch.bfloat16,
|
18 |
+
device_map=device, # or "mps" if on Apple Silicon
|
19 |
# attn_implementation="flash_attention_2", # should work on A100
|
20 |
).eval()
|
21 |
processor = ColQwen2Processor.from_pretrained("manu/colqwen2-v1.0-alpha")
|