Adam Ouazzani commited on
Commit ·
a64ba1b
1
Parent(s): 83d2443
Remove old dataset loader script
Browse files- MNLP_M3_rag_documents.py +0 -33
MNLP_M3_rag_documents.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import datasets
|
| 3 |
-
|
| 4 |
-
class MNLP_M2_rag_documents(datasets.GeneratorBasedBuilder):
|
| 5 |
-
def _info(self):
|
| 6 |
-
return datasets.DatasetInfo(
|
| 7 |
-
features=datasets.Features({
|
| 8 |
-
"title": datasets.Value("string"),
|
| 9 |
-
"text": datasets.Value("string"),
|
| 10 |
-
"source": datasets.Value("string"),
|
| 11 |
-
}),
|
| 12 |
-
description="RAG documents for MNLP",
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
def _split_generators(self, dl_manager):
|
| 16 |
-
data_path = dl_manager.download_and_extract("wiki_rag_subset.jsonl")
|
| 17 |
-
return [
|
| 18 |
-
datasets.SplitGenerator(
|
| 19 |
-
name=datasets.Split.TRAIN,
|
| 20 |
-
gen_kwargs={"filepath": data_path},
|
| 21 |
-
)
|
| 22 |
-
]
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
def _generate_examples(self, filepath):
|
| 26 |
-
with open(filepath, encoding="utf-8") as f:
|
| 27 |
-
for i, line in enumerate(f):
|
| 28 |
-
data = json.loads(line)
|
| 29 |
-
yield i, {
|
| 30 |
-
"title": data.get("title", ""),
|
| 31 |
-
"text": data.get("text", ""),
|
| 32 |
-
"source": data.get("source", "wikipedia"),
|
| 33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|