Update agieval.py
Browse files- agieval.py +35 -1
agieval.py
CHANGED
|
@@ -61,6 +61,9 @@ _URLS = {
|
|
| 61 |
"logiqa_en": {
|
| 62 |
"test": HEAD+'logiqa-en.jsonl'
|
| 63 |
},
|
|
|
|
|
|
|
|
|
|
| 64 |
"aqua_rat": {
|
| 65 |
"test": HEAD+'aqua-rat.jsonl'
|
| 66 |
},
|
|
@@ -116,6 +119,11 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 116 |
version=VERSION,
|
| 117 |
description="",
|
| 118 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
datasets.BuilderConfig(
|
| 120 |
name="math_agieval",
|
| 121 |
version=VERSION,
|
|
@@ -163,6 +171,16 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 163 |
"solution": datasets.Value("string"),
|
| 164 |
}
|
| 165 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
elif self.config.name == "math_agieval":
|
| 167 |
features = datasets.Features(
|
| 168 |
{"question": datasets.Value("string"),
|
|
@@ -214,7 +232,7 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 214 |
# Mapping for column names in CSV to dataset names
|
| 215 |
names = {'aqua_rat': 'aqua-rat', 'sat_en': 'sat-en', 'sat_math': 'sat-math',
|
| 216 |
'lsat_ar': 'lsat-ar', 'lsat_lr': 'lsat-lr', 'lsat_rc': 'lsat-rc',
|
| 217 |
-
'logiqa_en': 'logiqa_en', 'math_agieval': 'math'}
|
| 218 |
|
| 219 |
if split == "few_shot":
|
| 220 |
# Load the data from the CSV
|
|
@@ -243,6 +261,14 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 243 |
"label": data["label"],
|
| 244 |
"solution": str(explanation_row),
|
| 245 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
elif self.config.name == "math_agieval":
|
| 247 |
if not data.get("level"):
|
| 248 |
data["level"] = data['other']['level']
|
|
@@ -293,6 +319,14 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 293 |
"label": data["label"],
|
| 294 |
"solution": data["label"],
|
| 295 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
elif self.config.name == "math_agieval":
|
| 297 |
if not data.get("level"):
|
| 298 |
data["level"] = data['other']['level']
|
|
|
|
| 61 |
"logiqa_en": {
|
| 62 |
"test": HEAD+'logiqa-en.jsonl'
|
| 63 |
},
|
| 64 |
+
"logiqa_zh": {
|
| 65 |
+
"test": HEAD+'logiqa-zh.jsonl'
|
| 66 |
+
},
|
| 67 |
"aqua_rat": {
|
| 68 |
"test": HEAD+'aqua-rat.jsonl'
|
| 69 |
},
|
|
|
|
| 119 |
version=VERSION,
|
| 120 |
description="",
|
| 121 |
),
|
| 122 |
+
datasets.BuilderConfig(
|
| 123 |
+
name="logiqa_zh",
|
| 124 |
+
version=VERSION,
|
| 125 |
+
description="",
|
| 126 |
+
),
|
| 127 |
datasets.BuilderConfig(
|
| 128 |
name="math_agieval",
|
| 129 |
version=VERSION,
|
|
|
|
| 171 |
"solution": datasets.Value("string"),
|
| 172 |
}
|
| 173 |
)
|
| 174 |
+
elif self.config.name == "logiqa_zh":
|
| 175 |
+
# remove solution from other
|
| 176 |
+
features = datasets.Features(
|
| 177 |
+
{"passage": datasets.Value("string"),
|
| 178 |
+
"question": datasets.Value("string"),
|
| 179 |
+
"options": datasets.features.Sequence(datasets.Value("string")),
|
| 180 |
+
"label": datasets.ClassLabel(num_classes=4, names=["A", "B", "C", "D"]),
|
| 181 |
+
"solution": datasets.Value("string"),
|
| 182 |
+
}
|
| 183 |
+
)
|
| 184 |
elif self.config.name == "math_agieval":
|
| 185 |
features = datasets.Features(
|
| 186 |
{"question": datasets.Value("string"),
|
|
|
|
| 232 |
# Mapping for column names in CSV to dataset names
|
| 233 |
names = {'aqua_rat': 'aqua-rat', 'sat_en': 'sat-en', 'sat_math': 'sat-math',
|
| 234 |
'lsat_ar': 'lsat-ar', 'lsat_lr': 'lsat-lr', 'lsat_rc': 'lsat-rc',
|
| 235 |
+
'logiqa_en': 'logiqa_en', 'logiqa_zh': 'logiqa_zh', 'math_agieval': 'math'}
|
| 236 |
|
| 237 |
if split == "few_shot":
|
| 238 |
# Load the data from the CSV
|
|
|
|
| 261 |
"label": data["label"],
|
| 262 |
"solution": str(explanation_row),
|
| 263 |
}
|
| 264 |
+
elif self.config.name == "logiqa_zh":
|
| 265 |
+
yield key, {
|
| 266 |
+
"passage": data["passage"],
|
| 267 |
+
"question": data["question"],
|
| 268 |
+
"options": data["options"],
|
| 269 |
+
"label": data["label"],
|
| 270 |
+
"solution": str(explanation_row),
|
| 271 |
+
}
|
| 272 |
elif self.config.name == "math_agieval":
|
| 273 |
if not data.get("level"):
|
| 274 |
data["level"] = data['other']['level']
|
|
|
|
| 319 |
"label": data["label"],
|
| 320 |
"solution": data["label"],
|
| 321 |
}
|
| 322 |
+
elif self.config.name == "logiqa_zh":
|
| 323 |
+
yield key, {
|
| 324 |
+
"passage": data["passage"],
|
| 325 |
+
"question": data["question"],
|
| 326 |
+
"options": data["options"],
|
| 327 |
+
"label": data["label"],
|
| 328 |
+
"solution": data["label"],
|
| 329 |
+
}
|
| 330 |
elif self.config.name == "math_agieval":
|
| 331 |
if not data.get("level"):
|
| 332 |
data["level"] = data['other']['level']
|