AdrienB134 commited on
Commit
404e8d7
1 Parent(s): 515c759
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -20,7 +20,7 @@ from PIL import Image
20
  import torch
21
  import subprocess
22
  subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
23
-
24
 
25
 
26
 
@@ -119,7 +119,7 @@ def search(query: str, ds, images, k):
119
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
120
  if device != model.device:
121
  model.to(device)
122
-
123
  qs = []
124
  with torch.no_grad():
125
  batch_query = process_queries(processor, [query], mock_image)
@@ -135,6 +135,7 @@ def search(query: str, ds, images, k):
135
  results = []
136
  for idx in top_k_indices:
137
  results.append((images[idx])) #, f"Page {idx}"
 
138
  del model
139
  del processor
140
  print("done")
 
20
  import torch
21
  import subprocess
22
  subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
23
+ import time
24
 
25
 
26
 
 
119
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
120
  if device != model.device:
121
  model.to(device)
122
+ start = time.time()
123
  qs = []
124
  with torch.no_grad():
125
  batch_query = process_queries(processor, [query], mock_image)
 
135
  results = []
136
  for idx in top_k_indices:
137
  results.append((images[idx])) #, f"Page {idx}"
138
+ print(f"Temps: {time.time()- start} s")
139
  del model
140
  del processor
141
  print("done")