Update agieval.py
Browse files- agieval.py +11 -11
agieval.py
CHANGED
|
@@ -51,10 +51,10 @@ all_lst = english_qa_datasets + chinese_qa_datasets + english_cloze_datasets + c
|
|
| 51 |
t = ['sat-en', 'aqua-rat']
|
| 52 |
|
| 53 |
_URLS = {
|
| 54 |
-
"
|
| 55 |
"test": HEAD+'sat-en.jsonl',
|
| 56 |
},
|
| 57 |
-
"
|
| 58 |
'few_shot': {
|
| 59 |
'few_shot':'https://raw.githubusercontent.com/microsoft/AGIEval/main/data/few_shot_prompts.csv'
|
| 60 |
}
|
|
@@ -113,12 +113,12 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 113 |
|
| 114 |
BUILDER_CONFIGS = [
|
| 115 |
datasets.BuilderConfig(
|
| 116 |
-
name="
|
| 117 |
version=VERSION,
|
| 118 |
description="",
|
| 119 |
),
|
| 120 |
datasets.BuilderConfig(
|
| 121 |
-
name="
|
| 122 |
version=VERSION,
|
| 123 |
description="",
|
| 124 |
),
|
|
@@ -148,11 +148,11 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 148 |
# description="",
|
| 149 |
# ),
|
| 150 |
]
|
| 151 |
-
DEFAULT_CONFIG_NAME = "
|
| 152 |
|
| 153 |
def _info(self):
|
| 154 |
|
| 155 |
-
if self.config.name == "
|
| 156 |
features = datasets.Features(
|
| 157 |
{
|
| 158 |
"question": datasets.Value("string"),
|
|
@@ -161,7 +161,7 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 161 |
"solution": datasets.Value("string"),
|
| 162 |
}
|
| 163 |
)
|
| 164 |
-
elif self.config.name == "
|
| 165 |
features = datasets.Features(
|
| 166 |
{"passage": datasets.Value("string"),
|
| 167 |
"question": datasets.Value("string"),
|
|
@@ -238,7 +238,7 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 238 |
|
| 239 |
def _generate_examples(self, filepath, split):
|
| 240 |
# Mapping for column names in CSV to dataset names
|
| 241 |
-
names = {'
|
| 242 |
'lsat_ar': 'lsat-ar', 'lsat_lr': 'lsat-lr', 'lsat_rc': 'lsat-rc',
|
| 243 |
'logiqa': 'logiqa-en', 'math_agieval': 'math'}
|
| 244 |
|
|
@@ -254,7 +254,7 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 254 |
try:
|
| 255 |
data = ast.literal_eval(samples[names[self.config.name]][key])
|
| 256 |
explanation_row = explanations[names[self.config.name]][key]
|
| 257 |
-
if self.config.name in ["
|
| 258 |
yield key, {
|
| 259 |
"question": data["question"],
|
| 260 |
"options": data["options"],
|
|
@@ -282,7 +282,7 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 282 |
"solution": str(explanation_row),
|
| 283 |
}
|
| 284 |
|
| 285 |
-
elif self.config.name == "
|
| 286 |
yield key, {
|
| 287 |
"passage": data["passage"],
|
| 288 |
"question": data["question"],
|
|
@@ -304,7 +304,7 @@ class AgiEval(datasets.GeneratorBasedBuilder):
|
|
| 304 |
for key, row in enumerate(f):
|
| 305 |
data = json.loads(row)
|
| 306 |
|
| 307 |
-
if self.config.name in ["
|
| 308 |
yield key, {
|
| 309 |
"question": data["question"],
|
| 310 |
"options": data["options"],
|
|
|
|
| 51 |
t = ['sat-en', 'aqua-rat']
|
| 52 |
|
| 53 |
_URLS = {
|
| 54 |
+
"sat-en": {
|
| 55 |
"test": HEAD+'sat-en.jsonl',
|
| 56 |
},
|
| 57 |
+
"aqua-rat": {"test": HEAD+'aqua-rat.jsonl'},
|
| 58 |
'few_shot': {
|
| 59 |
'few_shot':'https://raw.githubusercontent.com/microsoft/AGIEval/main/data/few_shot_prompts.csv'
|
| 60 |
}
|
|
|
|
| 113 |
|
| 114 |
BUILDER_CONFIGS = [
|
| 115 |
datasets.BuilderConfig(
|
| 116 |
+
name="aqua-rat",
|
| 117 |
version=VERSION,
|
| 118 |
description="",
|
| 119 |
),
|
| 120 |
datasets.BuilderConfig(
|
| 121 |
+
name="sat-en",
|
| 122 |
version=VERSION,
|
| 123 |
description="",
|
| 124 |
),
|
|
|
|
| 148 |
# description="",
|
| 149 |
# ),
|
| 150 |
]
|
| 151 |
+
DEFAULT_CONFIG_NAME = "aqua-rat"
|
| 152 |
|
| 153 |
def _info(self):
|
| 154 |
|
| 155 |
+
if self.config.name == "aqua-rat":
|
| 156 |
features = datasets.Features(
|
| 157 |
{
|
| 158 |
"question": datasets.Value("string"),
|
|
|
|
| 161 |
"solution": datasets.Value("string"),
|
| 162 |
}
|
| 163 |
)
|
| 164 |
+
elif self.config.name == "sat-en":
|
| 165 |
features = datasets.Features(
|
| 166 |
{"passage": datasets.Value("string"),
|
| 167 |
"question": datasets.Value("string"),
|
|
|
|
| 238 |
|
| 239 |
def _generate_examples(self, filepath, split):
|
| 240 |
# Mapping for column names in CSV to dataset names
|
| 241 |
+
names = {'aqua-rat': 'aqua-rat', 'sat-en': 'sat-en', 'sat_math': 'sat-math',
|
| 242 |
'lsat_ar': 'lsat-ar', 'lsat_lr': 'lsat-lr', 'lsat_rc': 'lsat-rc',
|
| 243 |
'logiqa': 'logiqa-en', 'math_agieval': 'math'}
|
| 244 |
|
|
|
|
| 254 |
try:
|
| 255 |
data = ast.literal_eval(samples[names[self.config.name]][key])
|
| 256 |
explanation_row = explanations[names[self.config.name]][key]
|
| 257 |
+
if self.config.name in ["aqua-rat", "sat_math"]:
|
| 258 |
yield key, {
|
| 259 |
"question": data["question"],
|
| 260 |
"options": data["options"],
|
|
|
|
| 282 |
"solution": str(explanation_row),
|
| 283 |
}
|
| 284 |
|
| 285 |
+
elif self.config.name == "sat-en":
|
| 286 |
yield key, {
|
| 287 |
"passage": data["passage"],
|
| 288 |
"question": data["question"],
|
|
|
|
| 304 |
for key, row in enumerate(f):
|
| 305 |
data = json.loads(row)
|
| 306 |
|
| 307 |
+
if self.config.name in ["aqua-rat","sat_math"]:
|
| 308 |
yield key, {
|
| 309 |
"question": data["question"],
|
| 310 |
"options": data["options"],
|