3232from lighteval .tasks .requests import Doc
3333
3434
35- MATH_QUERY_TEMPLATE = """
36- Solve the following problem. The final line of your response MUST be of the following format:
37- "ANSWER: $ANSWER" (without quotes) where $ANSWER is the final answer. Think step by step before answering.
35+ MATH_QUERY_TEMPLATES = {
36+ "fi" : """
37+ Ratkaise seuraava tehtävä. Vastauksesi viimeisen rivin TÄYTYY olla seuraavassa muodossa:
38+ "ANSWER: $ANSWER" (ilman lainausmerkkejä), jossa $ANSWER on lopullinen vastaus. Ajattele vaiheittain ennen vastaamista.
3839
3940{prompt}
40- """ .strip ()
41+ """ .strip (),
42+ }
4143
4244
4345def _get_scorer_model ():
@@ -58,14 +60,19 @@ def _get_scorer_model():
5860 return None
5961
6062
61- def mmath500_prompt (line , task_name : str = None ):
62- query = MATH_QUERY_TEMPLATE .format (prompt = line ["problem" ])
63- return Doc (
64- task_name = task_name ,
65- query = query ,
66- choices = [f"ANSWER: { line ['answer' ]} " ],
67- gold_index = 0 ,
68- )
63+ def _mmath500_prompt_fn (lang : str ):
64+ template = MATH_QUERY_TEMPLATES [lang ]
65+
66+ def mmath500_prompt (line , task_name : str = None ):
67+ query = template .format (prompt = line ["problem" ])
68+ return Doc (
69+ task_name = task_name ,
70+ query = query ,
71+ choices = [f"ANSWER: { line ['answer' ]} " ],
72+ gold_index = 0 ,
73+ )
74+
75+ return mmath500_prompt
6976
7077
7178def record_to_sample (record ):
@@ -76,7 +83,7 @@ def record_to_sample(record):
7683
7784mmath500_fi = LightevalTaskConfig (
7885 name = "mmath500:fi" ,
79- prompt_function = mmath500_prompt ,
86+ prompt_function = _mmath500_prompt_fn ( "fi" ) ,
8087 hf_repo = "LumiOpen/MATH-500_mt" ,
8188 hf_subset = "default" ,
8289 hf_avail_splits = ["fi" ],
@@ -89,7 +96,7 @@ def record_to_sample(record):
8996 ],
9097 version = 1 ,
9198 sample_fields = record_to_sample ,
92- solver = [prompt_template (MATH_QUERY_TEMPLATE ), generate (cache = True )],
99+ solver = [prompt_template (MATH_QUERY_TEMPLATES [ "fi" ] ), generate (cache = True )],
93100 scorer = model_graded_fact (model = _get_scorer_model ()),
94101)
95102
0 commit comments