"experiments/vscode:/vscode.git/clone" did not exist on "eca65b73ddd858bc8a25ef4c0e0348cc84c5078d"
Unverified Commit 56a4e794 authored by Lintang Sutawika's avatar Lintang Sutawika Committed by GitHub
Browse files

formatting (#2104)

parent 9884ad6e
dataset_name: twi dataset_name: twi
include: afrimmlu_common_yaml include: afrimmlu_common_yaml
task: afrimmlu_direct_twi task: afrimmlu_direct_twi
\ No newline at end of file
dataset_name: wol dataset_name: wol
include: afrimmlu_common_yaml include: afrimmlu_common_yaml
task: afrimmlu_direct_wol task: afrimmlu_direct_wol
\ No newline at end of file
dataset_name: xho dataset_name: xho
include: afrimmlu_common_yaml include: afrimmlu_common_yaml
task: afrimmlu_direct_xho task: afrimmlu_direct_xho
\ No newline at end of file
dataset_name: yor dataset_name: yor
include: afrimmlu_common_yaml include: afrimmlu_common_yaml
task: afrimmlu_direct_yor task: afrimmlu_direct_yor
\ No newline at end of file
dataset_name: zul dataset_name: zul
include: afrimmlu_common_yaml include: afrimmlu_common_yaml
task: afrimmlu_direct_zul task: afrimmlu_direct_zul
\ No newline at end of file
import re
import sys
import unicodedata
from sklearn.metrics import f1_score from sklearn.metrics import f1_score
from lm_eval.filters.extraction import RegexFilter
def doc_to_choice(doc): def doc_to_choice(doc):
...@@ -12,9 +7,9 @@ def doc_to_choice(doc): ...@@ -12,9 +7,9 @@ def doc_to_choice(doc):
def doc_to_text(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} model answers multiple-choice questions about {subject}
Question: {question} Question: {question}
Choices: Choices:
...@@ -22,16 +17,18 @@ def doc_to_text(doc): ...@@ -22,16 +17,18 @@ def doc_to_text(doc):
B: {choice2} B: {choice2}
C: {choice3} C: {choice3}
D: {choice4} D: {choice4}
Answer: """ Answer: """
choices = eval(doc["choices"]) choices = eval(doc["choices"])
text = output.format(subject=doc['subject'], text = output.format(
question=doc['question'], subject=doc["subject"],
choice1=choices[0], question=doc["question"],
choice2=choices[1], choice1=choices[0],
choice3=choices[2], choice2=choices[1],
choice4=choices[3]) choice3=choices[2],
choice4=choices[3],
)
return text return text
...@@ -40,4 +37,4 @@ def weighted_f1_score(items): ...@@ -40,4 +37,4 @@ def weighted_f1_score(items):
golds = unzipped_list[0] golds = unzipped_list[0]
preds = unzipped_list[1] preds = unzipped_list[1]
fscore = f1_score(golds, preds, average="weighted") fscore = f1_score(golds, preds, average="weighted")
return fscore return fscore
\ No newline at end of file
...@@ -5,4 +5,4 @@ lm_eval --model hf \ ...@@ -5,4 +5,4 @@ lm_eval --model hf \
--batch_size 1 \ --batch_size 1 \
--num_fewshot 0 \ --num_fewshot 0 \
--verbosity DEBUG \ --verbosity DEBUG \
--wandb_args project=afrimmlu --wandb_args project=afrimmlu
\ No newline at end of file
...@@ -6,18 +6,18 @@ dataset_path: masakhane/afrimmlu-translate-test ...@@ -6,18 +6,18 @@ dataset_path: masakhane/afrimmlu-translate-test
dataset_name: null dataset_name: null
output_type: multiple_choice output_type: multiple_choice
test_split: test 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_target: "{{['A', 'B', 'C', 'D'].index(answer)}}"
doc_to_choice: !function utils.doc_to_choice doc_to_choice: !function utils.doc_to_choice
should_decontaminate: true should_decontaminate: true
doc_to_decontamination_query: "Question: {{question}}\nAnswer:" doc_to_decontamination_query: "Question: {{question}}\nAnswer:"
metric_list: metric_list:
- metric: f1 - metric: f1
aggregation: !function utils.weighted_f1_score aggregation: !function utils.weighted_f1_score
# aggregation: mean # aggregation: mean
average: weighted average: weighted
hf_evaluate: true hf_evaluate: true
higher_is_better: True higher_is_better: True
ignore_case: true ignore_case: true
ignore_punctuation: true ignore_punctuation: true
regexes_to_ignore: regexes_to_ignore:
......
dataset_name: eng dataset_name: eng
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_eng task: afrimmlu_translate_eng
dataset_name: ewe dataset_name: ewe
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_ewe task: afrimmlu_translate_ewe
dataset_name: fra dataset_name: fra
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_fra task: afrimmlu_translate_fra
\ No newline at end of file
dataset_name: hau dataset_name: hau
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_hau task: afrimmlu_translate_hau
\ No newline at end of file
dataset_name: ibo dataset_name: ibo
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_ibo task: afrimmlu_translate_ibo
\ No newline at end of file
dataset_name: kin dataset_name: kin
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_kin task: afrimmlu_translate_kin
\ No newline at end of file
dataset_name: lin dataset_name: lin
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_lin task: afrimmlu_translate_lin
\ No newline at end of file
dataset_name: lug dataset_name: lug
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_lug task: afrimmlu_translate_lug
\ No newline at end of file
dataset_name: orm dataset_name: orm
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_orm task: afrimmlu_translate_orm
\ No newline at end of file
dataset_name: sna dataset_name: sna
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_sna task: afrimmlu_translate_sna
\ No newline at end of file
dataset_name: sot dataset_name: sot
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_sot task: afrimmlu_translate_sot
\ No newline at end of file
dataset_name: swa dataset_name: swa
include: afrimmlu_common_translate_yaml include: afrimmlu_common_translate_yaml
task: afrimmlu_translate_swa task: afrimmlu_translate_swa
\ No newline at end of file
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