"...composable_kernel.git" did not exist on "3a3136ced56adc2538e0997a6df3b0275edfebba"
Commit 81e42932 authored by Anthony DiPofi's avatar Anthony DiPofi
Browse files

change mathqa to use numeric answer strings instead of a,b,c,d,e as choices

parent c6c67272
from . common import HFTask from . common import HFTask
from lm_eval.base import mean, rf, MultipleChoiceTask from lm_eval.base import mean, rf, MultipleChoiceTask
import re
class MathQA(HFTask, MultipleChoiceTask): class MathQA(HFTask, MultipleChoiceTask):
DATASET_PATH = "math_qa" DATASET_PATH = "math_qa"
...@@ -17,10 +17,13 @@ class MathQA(HFTask, MultipleChoiceTask): ...@@ -17,10 +17,13 @@ class MathQA(HFTask, MultipleChoiceTask):
def _convert_standard(self, doc): def _convert_standard(self, doc):
answer_idx = ['a', 'b', 'c', 'd', 'e'].index(doc['correct'])
choices = [c[4:].rstrip(" ,") for c in re.findall(r"[abcd] \) .*?, |e .*?$", doc['options'])]
out_doc = { out_doc = {
"query": "Question: " + doc['Problem'] +" "+ doc["options"] + "\nAnswer:", "query": "Question: " + doc['Problem'] +"\nAnswer:",
"choices": ['a', 'b', 'c', 'd', 'e'], "choices": choices,
"gold": ['a', 'b', 'c', 'd', 'e'].index(doc['correct']), "gold": answer_idx,
} }
return out_doc return out_doc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment