Datasets:
mariosasko
commited on
Nit
Browse files- wiki_dpr.py +17 -11
wiki_dpr.py
CHANGED
@@ -166,17 +166,23 @@ class WikiDpr(datasets.ArrowBasedBuilder):
|
|
166 |
def _download_post_processing_resources(self, split, resource_name, dl_manager):
|
167 |
if resource_name == "embeddings_index":
|
168 |
try:
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
{"
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
except (FileNotFoundError, ConnectionError): # index doesn't exist
|
181 |
pass
|
182 |
|
|
|
166 |
def _download_post_processing_resources(self, split, resource_name, dl_manager):
|
167 |
if resource_name == "embeddings_index":
|
168 |
try:
|
169 |
+
embeddings_name = self.config.embeddings_name
|
170 |
+
if self.config.dummy:
|
171 |
+
embeddings_name = "dummy." + embeddings_name
|
172 |
+
index_file = os.path.join(
|
173 |
+
"data",
|
174 |
+
self.config.wiki_split,
|
175 |
+
self.config.embeddings_name,
|
176 |
+
(
|
177 |
+
"HNSW128_SQ8-IP-{split}.faiss"
|
178 |
+
if self.config.index_name == "exaxt"
|
179 |
+
else "IVF4096_HNSW128_PQ128-IP-{split}.faiss"
|
180 |
+
).format(split=split)
|
181 |
+
)
|
182 |
+
downloaded_resources = dl_manager.download_and_extract(
|
183 |
+
{"embeddings_index": index_file}
|
184 |
+
)
|
185 |
+
return downloaded_resources["embeddings_index"]
|
186 |
except (FileNotFoundError, ConnectionError): # index doesn't exist
|
187 |
pass
|
188 |
|