Commit c1e63555 authored by Yu Shi Jie's avatar Yu Shi Jie
Browse files

Merge branch 'upstream' into 'mmlu-pro'

add tokenizer logs info (#1731)

See merge request shijie.yu/lm-evaluation-harness!4
parents e361687c 42dc2448
group:
- mmlu
- afrimmlu_translate
task: null
dataset_path: masakhane/afrimmlu-translate-test
dataset_name: null
output_type: multiple_choice
test_split: test
doc_to_text: !function utils.doc_to_text
doc_to_target: "{{['A', 'B', 'C', 'D'].index(answer)}}"
doc_to_choice: !function utils.doc_to_choice
should_decontaminate: true
doc_to_decontamination_query: "Question: {{question}}\nAnswer:"
metric_list:
- metric: f1
aggregation: !function utils.weighted_f1_score
# aggregation: mean
average: weighted
hf_evaluate: true
higher_is_better: True
ignore_case: true
ignore_punctuation: true
regexes_to_ignore:
- ","
- "\\$"
- metric: acc
aggregation: mean
higher_is_better: true
ignore_case: true
ignore_punctuation: true
regexes_to_ignore:
- ","
- "\\$"
metadata:
version: 1.0
dataset_name: amh
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_amh
dataset_name: eng
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_eng
dataset_name: ewe
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_ewe
dataset_name: fra
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_fra
dataset_name: hau
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_hau
dataset_name: ibo
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_ibo
dataset_name: kin
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_kin
dataset_name: lin
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_lin
dataset_name: lug
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_lug
dataset_name: orm
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_orm
dataset_name: sna
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_sna
dataset_name: sot
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_sot
dataset_name: swa
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_swa
dataset_name: twi
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_twi
dataset_name: wol
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_wol
dataset_name: xho
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_xho
dataset_name: yor
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_yor
dataset_name: zul
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_zul
from sklearn.metrics import f1_score
def doc_to_choice(doc):
choices = eval(doc["choices"])
return choices
def doc_to_text(doc):
output = """You are a highly knowledgeable and intelligent artificial intelligence
model answers multiple-choice questions about '{subject}'
Question: '''{question}'''
Choices:
A: ''{choice1}'''
B: ''{choice2}'''
C: ''{choice3}'''
D: ''{choice4}'''
Answer: """
choices = eval(doc["choices"])
text = output.format(
subject=doc["subject"],
question=doc["question"],
choice1=choices[0],
choice2=choices[1],
choice3=choices[2],
choice4=choices[3],
)
return text
def weighted_f1_score(items):
unzipped_list = list(zip(*items))
golds = unzipped_list[0]
preds = unzipped_list[1]
fscore = f1_score(golds, preds, average="weighted")
return fscore
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