Rename testing.py to logiqa2.py
Browse files- testing.py → logiqa2.py +20 -18
testing.py → logiqa2.py
RENAMED
|
@@ -58,8 +58,7 @@ _URLS = {
|
|
| 58 |
"logieval": {
|
| 59 |
"train": "https://raw.githubusercontent.com/csitfun/LogiEval/main/Data/logiqa_ood.jsonl",
|
| 60 |
"test": "https://raw.githubusercontent.com/csitfun/LogiEval/main/Data/logiqa.jsonl",
|
| 61 |
-
|
| 62 |
-
}
|
| 63 |
}
|
| 64 |
|
| 65 |
|
|
@@ -99,7 +98,7 @@ class LogiQA2(datasets.GeneratorBasedBuilder):
|
|
| 99 |
name="logieval",
|
| 100 |
version=VERSION,
|
| 101 |
description="Instruction based MRC task",
|
| 102 |
-
)
|
| 103 |
]
|
| 104 |
DEFAULT_CONFIG_NAME = "logiqa2"
|
| 105 |
|
|
@@ -132,9 +131,10 @@ class LogiQA2(datasets.GeneratorBasedBuilder):
|
|
| 132 |
"conclusion": datasets.Value("string"),
|
| 133 |
}
|
| 134 |
)
|
| 135 |
-
elif self.config.name
|
| 136 |
-
features = datasets.Features(
|
| 137 |
-
|
|
|
|
| 138 |
else:
|
| 139 |
features = datasets.Features(
|
| 140 |
{
|
|
@@ -164,7 +164,8 @@ class LogiQA2(datasets.GeneratorBasedBuilder):
|
|
| 164 |
if "validation" in _urls:
|
| 165 |
urls["validation"] = _urls["validation"]
|
| 166 |
data_dir = dl_manager.download_and_extract(urls)
|
| 167 |
-
splits = [
|
|
|
|
| 168 |
name=datasets.Split.TRAIN,
|
| 169 |
# These kwargs will be passed to _generate_examples
|
| 170 |
gen_kwargs={
|
|
@@ -179,14 +180,16 @@ class LogiQA2(datasets.GeneratorBasedBuilder):
|
|
| 179 |
),
|
| 180 |
]
|
| 181 |
if "validation" in _urls:
|
| 182 |
-
splits.append(
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
|
|
|
|
|
|
| 190 |
return splits
|
| 191 |
|
| 192 |
def _generate_examples(self, filepath, split):
|
|
@@ -212,10 +215,9 @@ class LogiQA2(datasets.GeneratorBasedBuilder):
|
|
| 212 |
"conclusion": data["conclusion"],
|
| 213 |
}
|
| 214 |
elif self.config.name == "logieval":
|
| 215 |
-
print(data)
|
| 216 |
yield key, {
|
| 217 |
-
|
| 218 |
-
|
| 219 |
}
|
| 220 |
else:
|
| 221 |
yield key, {
|
|
|
|
| 58 |
"logieval": {
|
| 59 |
"train": "https://raw.githubusercontent.com/csitfun/LogiEval/main/Data/logiqa_ood.jsonl",
|
| 60 |
"test": "https://raw.githubusercontent.com/csitfun/LogiEval/main/Data/logiqa.jsonl",
|
| 61 |
+
},
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
|
|
|
|
| 98 |
name="logieval",
|
| 99 |
version=VERSION,
|
| 100 |
description="Instruction based MRC task",
|
| 101 |
+
),
|
| 102 |
]
|
| 103 |
DEFAULT_CONFIG_NAME = "logiqa2"
|
| 104 |
|
|
|
|
| 131 |
"conclusion": datasets.Value("string"),
|
| 132 |
}
|
| 133 |
)
|
| 134 |
+
elif self.config.name in ("logiqa2_nli", "logieval"):
|
| 135 |
+
features = datasets.Features(
|
| 136 |
+
{"content": datasets.Value("string"), "ideal": datasets.Value("string")}
|
| 137 |
+
)
|
| 138 |
else:
|
| 139 |
features = datasets.Features(
|
| 140 |
{
|
|
|
|
| 164 |
if "validation" in _urls:
|
| 165 |
urls["validation"] = _urls["validation"]
|
| 166 |
data_dir = dl_manager.download_and_extract(urls)
|
| 167 |
+
splits = [
|
| 168 |
+
datasets.SplitGenerator(
|
| 169 |
name=datasets.Split.TRAIN,
|
| 170 |
# These kwargs will be passed to _generate_examples
|
| 171 |
gen_kwargs={
|
|
|
|
| 180 |
),
|
| 181 |
]
|
| 182 |
if "validation" in _urls:
|
| 183 |
+
splits.append(
|
| 184 |
+
datasets.SplitGenerator(
|
| 185 |
+
name=datasets.Split.VALIDATION,
|
| 186 |
+
# These kwargs will be passed to _generate_examples
|
| 187 |
+
gen_kwargs={
|
| 188 |
+
"filepath": data_dir["validation"],
|
| 189 |
+
"split": "validation",
|
| 190 |
+
},
|
| 191 |
+
)
|
| 192 |
+
)
|
| 193 |
return splits
|
| 194 |
|
| 195 |
def _generate_examples(self, filepath, split):
|
|
|
|
| 215 |
"conclusion": data["conclusion"],
|
| 216 |
}
|
| 217 |
elif self.config.name == "logieval":
|
|
|
|
| 218 |
yield key, {
|
| 219 |
+
"content": data["input"][1]["content"],
|
| 220 |
+
"ideal": data["ideal"],
|
| 221 |
}
|
| 222 |
else:
|
| 223 |
yield key, {
|