Initial commit
Browse files- MiniLongBench.py +113 -0
- data/2wikimqa.jsonl +0 -0
- data/dureader.jsonl +0 -0
- data/gov_report.jsonl +0 -0
- data/hotpotqa.jsonl +0 -0
- data/lcc.jsonl +0 -0
- data/lsht.jsonl +0 -0
- data/multi_news.jsonl +0 -0
- data/multifieldqa_en.jsonl +0 -0
- data/multifieldqa_zh.jsonl +0 -0
- data/musique.jsonl +0 -0
- data/narrativeqa.jsonl +0 -0
- data/passage_count.jsonl +0 -0
- data/passage_retrieval_en.jsonl +0 -0
- data/passage_retrieval_zh.jsonl +0 -0
- data/qasper.jsonl +0 -0
- data/qmsum.jsonl +0 -0
- data/repobench-p.jsonl +0 -0
- data/samsum.jsonl +0 -0
- data/trec.jsonl +0 -0
- data/triviaqa.jsonl +0 -0
- data/vcsum.jsonl +0 -0
MiniLongBench.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
import datasets
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
_DESCRIPTION = """empty"""
|
| 8 |
+
|
| 9 |
+
_HOMEPAGE = "empty"
|
| 10 |
+
|
| 11 |
+
_URL = r"https://hf-mirror.com/datasets/linggm/MiniLongBench/resolve/main/data.zip"
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
task_list = [
|
| 15 |
+
"narrativeqa",
|
| 16 |
+
"qasper",
|
| 17 |
+
"multifieldqa_en",
|
| 18 |
+
"multifieldqa_zh",
|
| 19 |
+
"hotpotqa",
|
| 20 |
+
"2wikimqa",
|
| 21 |
+
"musique",
|
| 22 |
+
"dureader",
|
| 23 |
+
"gov_report",
|
| 24 |
+
"qmsum",
|
| 25 |
+
"multi_news",
|
| 26 |
+
"vcsum",
|
| 27 |
+
"trec",
|
| 28 |
+
"triviaqa",
|
| 29 |
+
"samsum",
|
| 30 |
+
"lsht",
|
| 31 |
+
"passage_count",
|
| 32 |
+
"passage_retrieval_en",
|
| 33 |
+
"passage_retrieval_zh",
|
| 34 |
+
"lcc",
|
| 35 |
+
"repobench-p",
|
| 36 |
+
"qasper_e",
|
| 37 |
+
"multifieldqa_en_e",
|
| 38 |
+
"hotpotqa_e",
|
| 39 |
+
"2wikimqa_e",
|
| 40 |
+
"gov_report_e",
|
| 41 |
+
"multi_news_e",
|
| 42 |
+
"trec_e",
|
| 43 |
+
"triviaqa_e",
|
| 44 |
+
"samsum_e",
|
| 45 |
+
"passage_count_e",
|
| 46 |
+
"passage_retrieval_en_e",
|
| 47 |
+
"lcc_e",
|
| 48 |
+
"repobench-p_e"
|
| 49 |
+
]
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class MiniLongBenchConfig(datasets.BuilderConfig):
|
| 53 |
+
def __init__(self, **kwargs):
|
| 54 |
+
super().__init__(version=datasets.Version("1.0.0"), **kwargs)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class MiniLongBench(datasets.GeneratorBasedBuilder):
|
| 58 |
+
BUILDER_CONFIGS = [
|
| 59 |
+
MiniLongBenchConfig(
|
| 60 |
+
name=task_name,
|
| 61 |
+
)
|
| 62 |
+
for task_name in task_list
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
def _info(self):
|
| 66 |
+
features = datasets.Features(
|
| 67 |
+
{
|
| 68 |
+
"input": datasets.Value("string"),
|
| 69 |
+
"context": datasets.Value("string"),
|
| 70 |
+
"answers": [datasets.Value("string")],
|
| 71 |
+
"length": datasets.Value("int32"),
|
| 72 |
+
"dataset": datasets.Value("string"),
|
| 73 |
+
"language": datasets.Value("string"),
|
| 74 |
+
"all_classes": [datasets.Value("string")],
|
| 75 |
+
"_id": datasets.Value("string"),
|
| 76 |
+
}
|
| 77 |
+
)
|
| 78 |
+
return datasets.DatasetInfo(
|
| 79 |
+
description=_DESCRIPTION,
|
| 80 |
+
features=features,
|
| 81 |
+
homepage=_HOMEPAGE,
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
def _split_generators(self, dl_manager):
|
| 85 |
+
#data_dir = dl_manager.download_and_extract(_URL)
|
| 86 |
+
data_dir = 'YOUR_LOCAL_DIR'
|
| 87 |
+
task_name = self.config.name
|
| 88 |
+
return [
|
| 89 |
+
datasets.SplitGenerator(
|
| 90 |
+
name=datasets.Split.TEST,
|
| 91 |
+
gen_kwargs={
|
| 92 |
+
"filepath": os.path.join(
|
| 93 |
+
data_dir, "data", f"{task_name}.jsonl"
|
| 94 |
+
),
|
| 95 |
+
},
|
| 96 |
+
)
|
| 97 |
+
]
|
| 98 |
+
|
| 99 |
+
def _generate_examples(self, filepath):
|
| 100 |
+
with open(filepath, encoding="utf-8") as f:
|
| 101 |
+
for idx, line in enumerate(f):
|
| 102 |
+
key = f"{self.config.name}-{idx}"
|
| 103 |
+
item = json.loads(line)
|
| 104 |
+
yield key, {
|
| 105 |
+
"input": item["input"],
|
| 106 |
+
"context": item["context"],
|
| 107 |
+
"answers": item["answers"],
|
| 108 |
+
"length": item["length"],
|
| 109 |
+
"dataset": item["dataset"],
|
| 110 |
+
"language": item["language"],
|
| 111 |
+
"_id": item["_id"],
|
| 112 |
+
"all_classes": item["all_classes"],
|
| 113 |
+
}
|
data/2wikimqa.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/dureader.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/gov_report.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/hotpotqa.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/lcc.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/lsht.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/multi_news.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/multifieldqa_en.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/multifieldqa_zh.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/musique.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/narrativeqa.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/passage_count.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/passage_retrieval_en.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/passage_retrieval_zh.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/qasper.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/qmsum.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/repobench-p.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/samsum.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/trec.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/triviaqa.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/vcsum.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|