Unverified Commit 56a4e794 authored by Lintang Sutawika's avatar Lintang Sutawika Committed by GitHub
Browse files

formatting (#2104)

parent 9884ad6e
dataset_name: twi
include: afrimmlu_common_yaml
task: afrimmlu_direct_twi
\ No newline at end of file
task: afrimmlu_direct_twi
dataset_name: wol
include: afrimmlu_common_yaml
task: afrimmlu_direct_wol
\ No newline at end of file
task: afrimmlu_direct_wol
dataset_name: xho
include: afrimmlu_common_yaml
task: afrimmlu_direct_xho
\ No newline at end of file
task: afrimmlu_direct_xho
dataset_name: yor
include: afrimmlu_common_yaml
task: afrimmlu_direct_yor
\ No newline at end of file
task: afrimmlu_direct_yor
dataset_name: zul
include: afrimmlu_common_yaml
task: afrimmlu_direct_zul
\ No newline at end of file
task: afrimmlu_direct_zul
import re
import sys
import unicodedata
from sklearn.metrics import f1_score
from lm_eval.filters.extraction import RegexFilter
def doc_to_choice(doc):
......@@ -12,9 +7,9 @@ def doc_to_choice(doc):
def doc_to_text(doc):
output = """You are a highly knowledgeable and intelligent artificial intelligence
output = """You are a highly knowledgeable and intelligent artificial intelligence
model answers multiple-choice questions about {subject}
Question: {question}
Choices:
......@@ -22,16 +17,18 @@ def doc_to_text(doc):
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])
text = output.format(
subject=doc["subject"],
question=doc["question"],
choice1=choices[0],
choice2=choices[1],
choice3=choices[2],
choice4=choices[3],
)
return text
......@@ -40,4 +37,4 @@ def weighted_f1_score(items):
golds = unzipped_list[0]
preds = unzipped_list[1]
fscore = f1_score(golds, preds, average="weighted")
return fscore
\ No newline at end of file
return fscore
......@@ -5,4 +5,4 @@ lm_eval --model hf \
--batch_size 1 \
--num_fewshot 0 \
--verbosity DEBUG \
--wandb_args project=afrimmlu
\ No newline at end of file
--wandb_args project=afrimmlu
......@@ -6,18 +6,18 @@ 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_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
- metric: f1
aggregation: !function utils.weighted_f1_score
# aggregation: mean
average: weighted
hf_evaluate: true
higher_is_better: True
average: weighted
hf_evaluate: true
higher_is_better: True
ignore_case: true
ignore_punctuation: true
regexes_to_ignore:
......
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
\ No newline at end of file
task: afrimmlu_translate_fra
dataset_name: hau
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_hau
\ No newline at end of file
task: afrimmlu_translate_hau
dataset_name: ibo
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_ibo
\ No newline at end of file
task: afrimmlu_translate_ibo
dataset_name: kin
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_kin
\ No newline at end of file
task: afrimmlu_translate_kin
dataset_name: lin
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_lin
\ No newline at end of file
task: afrimmlu_translate_lin
dataset_name: lug
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_lug
\ No newline at end of file
task: afrimmlu_translate_lug
dataset_name: orm
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_orm
\ No newline at end of file
task: afrimmlu_translate_orm
dataset_name: sna
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_sna
\ No newline at end of file
task: afrimmlu_translate_sna
dataset_name: sot
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_sot
\ No newline at end of file
task: afrimmlu_translate_sot
dataset_name: swa
include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_swa
\ No newline at end of file
task: afrimmlu_translate_swa
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