Unverified Commit 0b45cc71 authored by Weihao XUAN's avatar Weihao XUAN Committed by GitHub
Browse files

Update MMLU-ProX task (#3174)

* update MMLU_ProX

* update MMLU_ProX

* cleanup code by pre-commit
parent 05b37f20
description: 'Dưới đây câu hỏi trắc nghiệm về Toán học (kèm đáp án). Vui lòng suy
nghĩ từng bước, sau đó kết thúc câu trả lời của bạn bằng "Câu trả lời (X)", trong
đó X chữ cái của lựa chọn đúng.
'
include: _vi_template_yaml
task: mmlu_prox_vi_math
task_alias: math
process_docs: !function utils.process_math
description: 'Dưới đây câu hỏi trắc nghiệm về Khác (kèm đáp án). Vui lòng suy nghĩ
từng bước, sau đó kết thúc câu trả lời của bạn bằng "Câu trả lời (X)", trong
đó X chữ cái của lựa chọn đúng.
'
include: _vi_template_yaml
task: mmlu_prox_vi_other
task_alias: other
process_docs: !function utils.process_other
description: 'Dưới đây câu hỏi trắc nghiệm về Triết học (kèm đáp án). Vui lòng
suy nghĩ từng bước, sau đó kết thúc câu trả lời của bạn bằng "Câu trả lời (X)",
trong đó X chữ cái của lựa chọn đúng.
'
include: _vi_template_yaml
task: mmlu_prox_vi_philosophy
task_alias: philosophy
process_docs: !function utils.process_philosophy
description: 'Dưới đây câu hỏi trắc nghiệm về Vật học (kèm đáp án). Vui lòng
suy nghĩ từng bước, sau đó kết thúc câu trả lời của bạn bằng "Câu trả lời (X)",
trong đó X chữ cái của lựa chọn đúng.
'
include: _vi_template_yaml
task: mmlu_prox_vi_physics
task_alias: physics
process_docs: !function utils.process_physics
description: 'Dưới đây câu hỏi trắc nghiệm về Tâm học (kèm đáp án). Vui lòng
suy nghĩ từng bước, sau đó kết thúc câu trả lời của bạn bằng "Câu trả lời (X)",
trong đó X chữ cái của lựa chọn đúng.
'
include: _vi_template_yaml
task: mmlu_prox_vi_psychology
task_alias: psychology
process_docs: !function utils.process_psychology
from functools import partial
from os.path import basename, dirname
from lm_eval.tasks.mmlu_prox.lang_libs import LANG_LIBS
lang_abbr = basename(dirname(__file__))
lang_dict = LANG_LIBS[lang_abbr]
choices = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
]
max_opt_num = 10
def format_cot_example(example, including_answer=True):
prompt = f"{lang_dict[0]}\n"
question = example["question"]
prompt += question + "\n"
prompt += f"{lang_dict[1]}\n"
for i in range(max_opt_num):
opt = example[f"option_{i}"]
if opt is not None:
prompt += "{}. {}\n".format(choices[i], opt)
if including_answer:
cot_content = example["cot_content"].replace(lang_dict[4], lang_dict[2])
prompt += cot_content + "\n\n"
else:
prompt += lang_dict[2]
return prompt
doc_to_text = partial(format_cot_example, including_answer=False)
fewshot_to_text = partial(format_cot_example, including_answer=True)
def process_docs(dataset, subject):
return dataset.filter(lambda x: x["category"] == subject)
process_biology = partial(process_docs, subject="biology")
process_business = partial(process_docs, subject="business")
process_chemistry = partial(process_docs, subject="chemistry")
process_computer_science = partial(process_docs, subject="computer science")
process_economics = partial(process_docs, subject="economics")
process_engineering = partial(process_docs, subject="engineering")
process_health = partial(process_docs, subject="health")
process_history = partial(process_docs, subject="history")
process_law = partial(process_docs, subject="law")
process_math = partial(process_docs, subject="math")
process_other = partial(process_docs, subject="other")
process_philosophy = partial(process_docs, subject="philosophy")
process_physics = partial(process_docs, subject="physics")
process_psychology = partial(process_docs, subject="psychology")
group: mmlu_prox_lite_wo
task:
- mmlu_prox_lite_wo_biology
- mmlu_prox_lite_wo_business
- mmlu_prox_lite_wo_chemistry
- mmlu_prox_lite_wo_computer_science
- mmlu_prox_lite_wo_economics
- mmlu_prox_lite_wo_engineering
- mmlu_prox_lite_wo_health
- mmlu_prox_lite_wo_history
- mmlu_prox_lite_wo_law
- mmlu_prox_lite_wo_math
- mmlu_prox_lite_wo_other
- mmlu_prox_lite_wo_philosophy
- mmlu_prox_lite_wo_physics
- mmlu_prox_lite_wo_psychology
aggregate_metric_list:
- aggregation: mean
metric: exact_match
weight_by_size: true
filter_list: custom-extract
metadata:
version: 0.0
group: mmlu_prox_wo
task:
- mmlu_prox_wo_biology
- mmlu_prox_wo_business
- mmlu_prox_wo_chemistry
- mmlu_prox_wo_computer_science
- mmlu_prox_wo_economics
- mmlu_prox_wo_engineering
- mmlu_prox_wo_health
- mmlu_prox_wo_history
- mmlu_prox_wo_law
- mmlu_prox_wo_math
- mmlu_prox_wo_other
- mmlu_prox_wo_philosophy
- mmlu_prox_wo_physics
- mmlu_prox_wo_psychology
aggregate_metric_list:
- aggregation: mean
metric: exact_match
weight_by_size: true
filter_list: custom-extract
metadata:
version: 0.0
dataset_path: li-lab/MMLU-ProX-Lite
dataset_name: wo
test_split: test
fewshot_split: validation
fewshot_config:
sampler: first_n
doc_to_text: !function utils.fewshot_to_text
doc_to_target: ""
output_type: generate_until
doc_to_text: !function utils.doc_to_text
doc_to_target: answer
filter_list:
- name: "custom-extract"
filter:
- function: "regex"
regex_pattern: 'Tontu bi mooy \(?([ABCDEFGHIJ])\)?'
- function: "take_first"
generation_kwargs:
until:
- "</s>"
- "Q:"
- "Laaj:"
- "<|im_end|>"
do_sample: false
temperature: 0.0
max_gen_toks: 2048
num_fewshot: 5
metric_list:
- metric: exact_match
aggregation: mean
higher_is_better: true
ignore_case: true
ignore_punctuation: true
metadata:
version: 0.0
dataset_path: li-lab/MMLU-ProX
dataset_name: wo
test_split: test
fewshot_split: validation
fewshot_config:
sampler: first_n
doc_to_text: !function utils.fewshot_to_text
doc_to_target: ""
output_type: generate_until
doc_to_text: !function utils.doc_to_text
doc_to_target: answer
filter_list:
- name: "custom-extract"
filter:
- function: "regex"
regex_pattern: 'Tontu bi mooy \(?([ABCDEFGHIJ])\)?'
- function: "take_first"
generation_kwargs:
until:
- "</s>"
- "Q:"
- "Laaj:"
- "<|im_end|>"
do_sample: false
temperature: 0.0
max_gen_toks: 2048
num_fewshot: 5
metric_list:
- metric: exact_match
aggregation: mean
higher_is_better: true
ignore_case: true
ignore_punctuation: true
metadata:
version: 0.0
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax biologi.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_biology
task_alias: biology
process_docs: !function utils.process_biology
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax njëriñ.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_business
task_alias: business
process_docs: !function utils.process_business
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax simi.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_chemistry
task_alias: chemistry
process_docs: !function utils.process_chemistry
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax xam-xam
ordinatëer. Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)"
fu X di araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_computer_science
task_alias: computer_science
process_docs: !function utils.process_computer_science
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax ekonomi.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_economics
task_alias: economics
process_docs: !function utils.process_economics
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax injenyëer.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_engineering
task_alias: engineering
process_docs: !function utils.process_engineering
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax wergui
yaramu. Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)"
fu X di araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_health
task_alias: health
process_docs: !function utils.process_health
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax taariix.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_history
task_alias: history
process_docs: !function utils.process_history
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax yoon.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_law
task_alias: law
process_docs: !function utils.process_law
description: 'Li ci topp ay laaj yu am tànneef la (ak tontu) ci mbir mi ñuy wax matematig.
Xalaatal ci dooley dooley te nga jeexal sa tontu ak "Tontu bi mooy (X)" fu X di
araf bi jëkk ci tontu bi.
'
include: _wo_lite_template_yaml
task: mmlu_prox_lite_wo_math
task_alias: math
process_docs: !function utils.process_math
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