File size: 5,830 Bytes
10d53d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
"""
Take in a YAML, and output all other splits with this YAML
"""
import argparse
import os
import yaml
from tqdm import tqdm
SUBJECTS = {
"abstract_algebra": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"anatomy": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"astronomy": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"business_ethics": "ุนููู
ุฃุฎุฑู",
"clinical_knowledge": "ุนููู
ุฃุฎุฑู",
"college_biology": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"college_chemistry": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"college_computer_science": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"college_mathematics": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"college_medicine": "ุนููู
ุฃุฎุฑู",
"college_physics": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"computer_security": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"conceptual_physics": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"econometrics": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"electrical_engineering": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"elementary_mathematics": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"formal_logic": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"global_facts": "ุนููู
ุฃุฎุฑู",
"high_school_biology": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"high_school_chemistry": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"high_school_computer_science": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"high_school_european_history": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"high_school_geography": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"high_school_government_and_politics": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"high_school_macroeconomics": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"high_school_mathematics": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"high_school_microeconomics": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"high_school_physics": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"high_school_psychology": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"high_school_statistics": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"high_school_us_history": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"high_school_world_history": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"human_aging": "ุนููู
ุฃุฎุฑู",
"human_sexuality": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"international_law": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"jurisprudence": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"logical_fallacies": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"machine_learning": "ุฃูุนููู
ูุชูููุฉ ุงูู
ุนููู
ุงุช ู ุงูุฑูุงุถูุงุช",
"management": "ุนููู
ุฃุฎุฑู",
"marketing": "ุนููู
ุฃุฎุฑู",
"medical_genetics": "ุนููู
ุฃุฎุฑู",
"miscellaneous": "ุนููู
ุฃุฎุฑู",
"moral_disputes": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"moral_scenarios": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"nutrition": "ุนููู
ุฃุฎุฑู",
"philosophy": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"prehistory": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"professional_accounting": "ุนููู
ุฃุฎุฑู",
"professional_law": "ุงูุนููู
ุงูุงูุณุงููุฉ",
"professional_medicine": "ุนููู
ุฃุฎุฑู",
"professional_psychology": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"public_relations": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"security_studies": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"sociology": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"us_foreign_policy": "ุงูุนููู
ุงูุฅุฌุชู
ุงุนูุฉ",
"virology": "ุนููู
ุฃุฎุฑู",
"world_religions": "ุงูุนููู
ุงูุงูุณุงููุฉ",
}
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--base_yaml_path", required=True)
parser.add_argument("--save_prefix_path", default="ammlu")
parser.add_argument("--cot_prompt_path", default=None)
parser.add_argument("--task_prefix", default="")
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
# get filename of base_yaml so we can `"include": ` it in our other YAMLs.
base_yaml_name = os.path.split(args.base_yaml_path)[-1]
with open(args.base_yaml_path, encoding="utf-8") as f:
base_yaml = yaml.full_load(f)
if args.cot_prompt_path is not None:
import json
with open(args.cot_prompt_path, encoding="utf-8") as f:
cot_file = json.load(f)
for subject_eng, category in tqdm(SUBJECTS.items()):
if args.cot_prompt_path is not None:
description = cot_file[subject_eng]
else:
description = f"ูู
ุจุนู
ููุฉ ุงูุชูููู
ูู ู
ุฌุงู {category} \n\n"
yaml_dict = {
"include": base_yaml_name,
"task": f"ammlu_{args.task_prefix}_{subject_eng}"
if args.task_prefix != ""
else f"ammlu_{subject_eng}",
"dataset_name": subject_eng,
"description": description,
}
file_save_path = args.save_prefix_path + f"_{subject_eng}.yaml"
print(f"Saving yaml for subset {subject_eng} to {file_save_path}")
with open(file_save_path, "w", encoding="utf-8") as yaml_file:
yaml.dump(
yaml_dict,
yaml_file,
width=float("inf"),
allow_unicode=True,
default_style='"',
)
|