Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
343880ab
Commit
343880ab
authored
May 09, 2024
by
Israel Abebe Azime
Browse files
updated prompt
parent
f64b943d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
lm_eval/tasks/afrimmlu/afrimmlu_common_yaml
lm_eval/tasks/afrimmlu/afrimmlu_common_yaml
+1
-1
lm_eval/tasks/afrimmlu/fewshot.sh
lm_eval/tasks/afrimmlu/fewshot.sh
+1
-6
lm_eval/tasks/afrimmlu/utils.py
lm_eval/tasks/afrimmlu/utils.py
+23
-0
No files found.
lm_eval/tasks/afrimmlu/afrimmlu_common_yaml
View file @
343880ab
...
@@ -8,7 +8,7 @@ output_type: multiple_choice
...
@@ -8,7 +8,7 @@ output_type: multiple_choice
validation_split: validation
validation_split: validation
test_split: test
test_split: test
fewshot_split: validation
fewshot_split: validation
doc_to_text:
"Question: {{question}}\nAnswer:"
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
...
...
lm_eval/tasks/afrimmlu/fewshot.sh
View file @
343880ab
# NUMBER OF SHOT IS SET HERE
num_fewshot
=
0
lm_eval
--model
hf
\
lm_eval
--model
hf
\
--model_args
pretrained
=
masakhane/African-ultrachat-alpaca
\
--model_args
pretrained
=
masakhane/African-ultrachat-alpaca
\
--tasks
afrimmlu_amh,afrimmlu_eng,afrimmlu_ewe,afrimmlu_fra,afrimmlu_hau,afrimmlu_ibo,afrimmlu_kin,afrimmlu_lin,afrimmlu_lug,afrimmlu_orm,afrimmlu_sna,afrimmlu_sot,afrimmlu_twi,afrimmlu_wol,afrimmlu_xho,afrimmlu_yor,afrimmlu_zul
\
--tasks
afrimmlu_amh,afrimmlu_eng,afrimmlu_ewe,afrimmlu_fra,afrimmlu_hau,afrimmlu_ibo,afrimmlu_kin,afrimmlu_lin,afrimmlu_lug,afrimmlu_orm,afrimmlu_sna,afrimmlu_sot,afrimmlu_twi,afrimmlu_wol,afrimmlu_xho,afrimmlu_yor,afrimmlu_zul
\
--device
cuda:0
\
--device
cuda:0
\
--batch_size
1
\
--batch_size
1
\
--num_fewshot
$num_fewshot
\
--num_fewshot
0
\
--verbosity
DEBUG
--verbosity
DEBUG
\ No newline at end of file
lm_eval/tasks/afrimmlu/utils.py
View file @
343880ab
...
@@ -4,6 +4,29 @@ def doc_to_choice(doc):
...
@@ -4,6 +4,29 @@ def doc_to_choice(doc):
choices
=
eval
(
doc
[
"choices"
])
choices
=
eval
(
doc
[
"choices"
])
return
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
])
print
(
text
)
return
text
def
weighted_f1_score
(
items
):
def
weighted_f1_score
(
items
):
unzipped_list
=
list
(
zip
(
*
items
))
unzipped_list
=
list
(
zip
(
*
items
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment