Datasets:
Update wiki_dpr.py
Browse files- wiki_dpr.py +2 -19
wiki_dpr.py
CHANGED
|
@@ -32,11 +32,6 @@ The wikipedia articles were split into multiple, disjoint text blocks of 100 wor
|
|
| 32 |
|
| 33 |
_LICENSE = """DPR is CC-BY-NC 4.0 licensed."""
|
| 34 |
|
| 35 |
-
_DATA_URL = "https://dl.fbaipublicfiles.com/dpr/wikipedia_split/psgs_w100.tsv.gz"
|
| 36 |
-
|
| 37 |
-
_NQ_VECTORS_URL = "https://dl.fbaipublicfiles.com/dpr/data/wiki_encoded/single/nq/wiki_passages_{i}"
|
| 38 |
-
|
| 39 |
-
_MULTISET_VECTORS_URL = "https://dl.fbaipublicfiles.com/rag/rag_multiset_embeddings/wiki_passages_{i}"
|
| 40 |
|
| 41 |
_DATA_TO_NUM_SHARDS = {
|
| 42 |
"nq": 157,
|
|
@@ -135,6 +130,7 @@ class WikiDpr(datasets.ArrowBasedBuilder):
|
|
| 135 |
supervised_keys=None,
|
| 136 |
homepage="https://github.com/facebookresearch/DPR",
|
| 137 |
citation=_CITATION,
|
|
|
|
| 138 |
)
|
| 139 |
|
| 140 |
def _split_generators(self, dl_manager):
|
|
@@ -166,21 +162,8 @@ 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 |
-
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
|
|
|
|
| 32 |
|
| 33 |
_LICENSE = """DPR is CC-BY-NC 4.0 licensed."""
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
_DATA_TO_NUM_SHARDS = {
|
| 37 |
"nq": 157,
|
|
|
|
| 130 |
supervised_keys=None,
|
| 131 |
homepage="https://github.com/facebookresearch/DPR",
|
| 132 |
citation=_CITATION,
|
| 133 |
+
license=_LICENSE,
|
| 134 |
)
|
| 135 |
|
| 136 |
def _split_generators(self, dl_manager):
|
|
|
|
| 162 |
def _download_post_processing_resources(self, split, resource_name, dl_manager):
|
| 163 |
if resource_name == "embeddings_index":
|
| 164 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
downloaded_resources = dl_manager.download_and_extract(
|
| 166 |
+
{"embeddings_index": os.path.join("index", self.config.index_file.format(split=split))}
|
| 167 |
)
|
| 168 |
return downloaded_resources["embeddings_index"]
|
| 169 |
except (FileNotFoundError, ConnectionError): # index doesn't exist
|