Abinaya Mahendiran
commited on
Commit
·
3d3697e
1
Parent(s):
aaf25fc
Updated data loader script
Browse files- squad_v2.py +28 -9
squad_v2.py
CHANGED
|
@@ -28,9 +28,23 @@ _DESCRIPTION = """\
|
|
| 28 |
"""
|
| 29 |
|
| 30 |
_URLS = {
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
|
|
@@ -50,9 +64,13 @@ class SquadV2(datasets.GeneratorBasedBuilder):
|
|
| 50 |
"""TODO(squad_v2): Short description of my dataset."""
|
| 51 |
|
| 52 |
# TODO(squad_v2): Set up version.
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
def _info(self):
|
| 58 |
# TODO(squad_v2): Specifies the datasets.DatasetInfo object
|
|
@@ -82,6 +100,7 @@ class SquadV2(datasets.GeneratorBasedBuilder):
|
|
| 82 |
supervised_keys=None,
|
| 83 |
# Homepage of the dataset for documentation
|
| 84 |
homepage="https://rajpurkar.github.io/SQuAD-explorer/",
|
|
|
|
| 85 |
citation=_CITATION,
|
| 86 |
)
|
| 87 |
|
|
@@ -97,21 +116,21 @@ class SquadV2(datasets.GeneratorBasedBuilder):
|
|
| 97 |
datasets.SplitGenerator(
|
| 98 |
name=datasets.Split.TRAIN,
|
| 99 |
gen_kwargs={
|
| 100 |
-
"filepath": downloaded_files["train"],
|
| 101 |
"split": "train",
|
| 102 |
},
|
| 103 |
),
|
| 104 |
datasets.SplitGenerator(
|
| 105 |
name=datasets.Split.VALIDATION,
|
| 106 |
gen_kwargs={
|
| 107 |
-
"filepath": downloaded_files["validation"],
|
| 108 |
"split": "validation",
|
| 109 |
},
|
| 110 |
),
|
| 111 |
datasets.SplitGenerator(
|
| 112 |
name=datasets.Split.TEST,
|
| 113 |
gen_kwargs={
|
| 114 |
-
"filepath": downloaded_files["test"],
|
| 115 |
"split": "test",
|
| 116 |
},
|
| 117 |
),
|
|
|
|
| 28 |
"""
|
| 29 |
|
| 30 |
_URLS = {
|
| 31 |
+
"challenge_sets": {
|
| 32 |
+
"source_data_split": {
|
| 33 |
+
"train": "./challenge_sets/source_data_split/train.json",
|
| 34 |
+
"test": "./challenge_sets/source_data_split/test.json",
|
| 35 |
+
"validation": "./challenge_sets/source_data_split/validation.json",
|
| 36 |
+
},
|
| 37 |
+
"question_type_split": {
|
| 38 |
+
"train": "./challenge_sets/question_type_split/challenge_question_filter_train.json",
|
| 39 |
+
"test": "./challenge_sets/question_type_split/challenge_question_filter_test.json",
|
| 40 |
+
"validation": "./challenge_sets/question_type_split/challenge_question_filter_validation.json",
|
| 41 |
+
},
|
| 42 |
+
"answerable_question_split": {
|
| 43 |
+
"train": "./challenge_sets/answerable_question_split/challenge_answer_filter_train.json",
|
| 44 |
+
"test": "./challenge_sets/answerable_question_split/challenge_answer_filter_test.json",
|
| 45 |
+
"validation": "./challenge_sets/answerable_question_split/challenge_answer_filter_validation.json",
|
| 46 |
+
},
|
| 47 |
+
}
|
| 48 |
}
|
| 49 |
|
| 50 |
|
|
|
|
| 64 |
"""TODO(squad_v2): Short description of my dataset."""
|
| 65 |
|
| 66 |
# TODO(squad_v2): Set up version.
|
| 67 |
+
VERSION_1 = datasets.Version("1.0.0")
|
| 68 |
+
|
| 69 |
+
BUILDER_CONFIGS = [
|
| 70 |
+
SquadV2Config(name="challenge_sets", version=VERSION_1, description="SQuAD2.0 challenge set version"),
|
| 71 |
+
]
|
| 72 |
+
|
| 73 |
+
DEFAULT_CONFIG_NAME = "challenge_sets"
|
| 74 |
|
| 75 |
def _info(self):
|
| 76 |
# TODO(squad_v2): Specifies the datasets.DatasetInfo object
|
|
|
|
| 100 |
supervised_keys=None,
|
| 101 |
# Homepage of the dataset for documentation
|
| 102 |
homepage="https://rajpurkar.github.io/SQuAD-explorer/",
|
| 103 |
+
license="CC BY-SA 4.0",
|
| 104 |
citation=_CITATION,
|
| 105 |
)
|
| 106 |
|
|
|
|
| 116 |
datasets.SplitGenerator(
|
| 117 |
name=datasets.Split.TRAIN,
|
| 118 |
gen_kwargs={
|
| 119 |
+
"filepath": downloaded_files["source_data_split"]["train"],
|
| 120 |
"split": "train",
|
| 121 |
},
|
| 122 |
),
|
| 123 |
datasets.SplitGenerator(
|
| 124 |
name=datasets.Split.VALIDATION,
|
| 125 |
gen_kwargs={
|
| 126 |
+
"filepath": downloaded_files["source_data_split"]["validation"],
|
| 127 |
"split": "validation",
|
| 128 |
},
|
| 129 |
),
|
| 130 |
datasets.SplitGenerator(
|
| 131 |
name=datasets.Split.TEST,
|
| 132 |
gen_kwargs={
|
| 133 |
+
"filepath": downloaded_files["source_data_split"]["test"],
|
| 134 |
"split": "test",
|
| 135 |
},
|
| 136 |
),
|