hantech commited on
Commit
ce1baf7
·
verified ·
1 Parent(s): 3e3cc20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
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="cuda:0", # or "mps" if on Apple Silicon
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")