Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
6ecf558
1
Parent(s):
cbd245b
fix
Browse files
app.py
CHANGED
|
@@ -85,7 +85,7 @@ def search_queries(dataset_name, q_reps, depth=1000):
|
|
| 85 |
raise ValueError(f"No FAISS index found for dataset {dataset_name}")
|
| 86 |
|
| 87 |
# Ensure q_reps is a 2D numpy array of the correct type
|
| 88 |
-
q_reps = np.ascontiguousarray(q_reps.astype('
|
| 89 |
|
| 90 |
# Perform the search
|
| 91 |
all_scores, all_indices = faiss_index.search(q_reps, depth)
|
|
@@ -130,7 +130,7 @@ def encode_queries(dataset_name, postfix):
|
|
| 130 |
input_texts = [f"query: {query.strip()} {postfix}".strip() for query in queries[dataset_name]]
|
| 131 |
|
| 132 |
encoded_embeds = []
|
| 133 |
-
batch_size =
|
| 134 |
|
| 135 |
for start_idx in tqdm.tqdm(range(0, len(input_texts), batch_size), desc="Encoding queries"):
|
| 136 |
batch_input_texts = input_texts[start_idx: start_idx + batch_size]
|
|
|
|
| 85 |
raise ValueError(f"No FAISS index found for dataset {dataset_name}")
|
| 86 |
|
| 87 |
# Ensure q_reps is a 2D numpy array of the correct type
|
| 88 |
+
q_reps = np.ascontiguousarray(q_reps.astype('float16'))
|
| 89 |
|
| 90 |
# Perform the search
|
| 91 |
all_scores, all_indices = faiss_index.search(q_reps, depth)
|
|
|
|
| 130 |
input_texts = [f"query: {query.strip()} {postfix}".strip() for query in queries[dataset_name]]
|
| 131 |
|
| 132 |
encoded_embeds = []
|
| 133 |
+
batch_size = 32
|
| 134 |
|
| 135 |
for start_idx in tqdm.tqdm(range(0, len(input_texts), batch_size), desc="Encoding queries"):
|
| 136 |
batch_input_texts = input_texts[start_idx: start_idx + batch_size]
|