Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyschoelkopf authored Feb 22, 2024
1 parent 4e43d16 commit 9c4030b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lm_eval/tasks/mgsm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def gen_lang_yamls(output_dir: str, overwrite: bool, mode: str) -> None:

yaml_template = "cot_yaml"
filter_list = {}
DELIMITER = None
if mode == "direct":
ANSWER = LANGUAGES[lang]["DIRECT"]
REGEX = None
Expand All @@ -138,6 +139,7 @@ def gen_lang_yamls(output_dir: str, overwrite: bool, mode: str) -> None:
REGEX = LANGUAGES[lang]["REGEX"]
task_name = f"mgsm_native_cot_{lang}"
filter_list = add_regex_pattern(REGEX)
DELIMITER = "" if lang in ["zh", "ja"]
elif mode == "en-cot":
ANSWER = LANGUAGES["en"]["ANSWER"]
REGEX = LANGUAGES["en"]["REGEX"]
Expand Down Expand Up @@ -165,6 +167,7 @@ def gen_lang_yamls(output_dir: str, overwrite: bool, mode: str) -> None:
f"""{{{{answer_number|string}}}}"""
f"""{{% endif %}}""",
**filter_list,
**({"target_delimiter": DELIMITER} if DELIMITER else {}),
},
f,
allow_unicode=True,
Expand Down

0 comments on commit 9c4030b

Please sign in to comment.