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
af6e46fd
"vscode:/vscode.git/clone" did not exist on "23bd3449624883fa3d6322d8444ca3bfa76eaa97"
Commit
af6e46fd
authored
Dec 08, 2023
by
lintangsutawika
Browse files
added prompt and output variations
parent
66421b57
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
67 additions
and
51 deletions
+67
-51
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_06/b.yaml
...athqa/alternative_worlds/output_variation/style_06/b.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_06/c.yaml
...athqa/alternative_worlds/output_variation/style_06/c.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_07/a.yaml
...athqa/alternative_worlds/output_variation/style_07/a.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_07/b.yaml
...athqa/alternative_worlds/output_variation/style_07/b.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_07/c.yaml
...athqa/alternative_worlds/output_variation/style_07/c.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_08/a.yaml
...athqa/alternative_worlds/output_variation/style_08/a.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_08/b.yaml
...athqa/alternative_worlds/output_variation/style_08/b.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/style_08/c.yaml
...athqa/alternative_worlds/output_variation/style_08/c.yaml
+2
-4
lm_eval/tasks/mathqa/alternative_worlds/output_variation/styles.py
...asks/mathqa/alternative_worlds/output_variation/styles.py
+3
-19
lm_eval/tasks/mathqa/alternative_worlds/prompt_variation/style_01.yaml
.../mathqa/alternative_worlds/prompt_variation/style_01.yaml
+16
-0
lm_eval/tasks/mathqa/alternative_worlds/prompt_variation/style_02.yaml
.../mathqa/alternative_worlds/prompt_variation/style_02.yaml
+16
-0
lm_eval/tasks/mathqa/alternative_worlds/prompt_variation/style_03.yaml
.../mathqa/alternative_worlds/prompt_variation/style_03.yaml
+16
-0
No files found.
lm_eval/tasks/mathqa/alternative_worlds/style_06/b.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_06/b.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_06
group
:
mathqa_alt_ov_06
group_alias
:
style_06
task
:
mathqa_alt_ov_06b
task
:
mathqa_06b
task_alias
:
b
doc_to_text
:
!function
../styles.template_06
doc_to_text
:
!function
../styles.template_06
doc_to_choice
:
!function
../styles.choice_06b
doc_to_choice
:
!function
../styles.choice_06b
lm_eval/tasks/mathqa/alternative_worlds/style_06/c.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_06/c.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_06
group
:
mathqa_alt_ov_06
group_alias
:
style_06
task
:
mathqa_alt_ov_06c
task
:
mathqa_06c
task_alias
:
c
doc_to_text
:
!function
../styles.template_06
doc_to_text
:
!function
../styles.template_06
doc_to_choice
:
!function
../styles.choice_06c
doc_to_choice
:
!function
../styles.choice_06c
lm_eval/tasks/mathqa/alternative_worlds/style_07/a.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_07/a.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_07
group
:
mathqa_alt_ov_07
group_alias
:
style_07
task
:
mathqa_alt_ov_07a
task
:
mathqa_07a
task_alias
:
a
doc_to_text
:
!function
../styles.template_07
doc_to_text
:
!function
../styles.template_07
doc_to_choice
:
!function
../styles.choice_07a
doc_to_choice
:
!function
../styles.choice_07a
lm_eval/tasks/mathqa/alternative_worlds/style_07/b.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_07/b.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_07
group
:
mathqa_alt_ov_07
group_alias
:
style_07
task
:
mathqa_alt_ov_07b
task
:
mathqa_07b
task_alias
:
b
doc_to_text
:
!function
../styles.template_07
doc_to_text
:
!function
../styles.template_07
doc_to_choice
:
!function
../styles.choice_07b
doc_to_choice
:
!function
../styles.choice_07b
lm_eval/tasks/mathqa/alternative_worlds/style_07/c.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_07/c.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_07
group
:
mathqa_alt_ov_07
group_alias
:
style_07
task
:
mathqa_alt_ov_07c
task
:
mathqa_07c
task_alias
:
c
doc_to_text
:
!function
../styles.template_07
doc_to_text
:
!function
../styles.template_07
doc_to_choice
:
!function
../styles.choice_07c
doc_to_choice
:
!function
../styles.choice_07c
lm_eval/tasks/mathqa/alternative_worlds/style_08/a.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_08/a.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_08
group
:
mathqa_alt_ov_08
group_alias
:
style_08
task
:
mathqa_alt_ov_08a
task
:
mathqa_08a
task_alias
:
a
doc_to_text
:
!function
../styles.template_08
doc_to_text
:
!function
../styles.template_08
doc_to_choice
:
!function
../styles.choice_08a
doc_to_choice
:
!function
../styles.choice_08a
lm_eval/tasks/mathqa/alternative_worlds/style_08/b.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_08/b.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_08
group
:
mathqa_alt_ov_08
group_alias
:
style_08
task
:
mathqa_alt_ov_08b
task
:
mathqa_08b
task_alias
:
b
doc_to_text
:
!function
../styles.template_08
doc_to_text
:
!function
../styles.template_08
doc_to_choice
:
!function
../styles.choice_08b
doc_to_choice
:
!function
../styles.choice_08b
lm_eval/tasks/mathqa/alternative_worlds/style_08/c.yaml
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
style_08/c.yaml
View file @
af6e46fd
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_08
group
:
mathqa_alt_ov_08
group_alias
:
style_08
task
:
mathqa_alt_ov_08c
task
:
mathqa_08c
task_alias
:
c
doc_to_text
:
!function
../styles.template_08
doc_to_text
:
!function
../styles.template_08
doc_to_choice
:
!function
../styles.choice_08c
doc_to_choice
:
!function
../styles.choice_08c
lm_eval/tasks/mathqa/alternative_worlds/styles.py
→
lm_eval/tasks/mathqa/alternative_worlds/
output_variation/
styles.py
View file @
af6e46fd
...
@@ -2,7 +2,6 @@ import re
...
@@ -2,7 +2,6 @@ import re
import
string
import
string
from
functools
import
partial
from
functools
import
partial
def
parse_choices
(
doc
):
def
parse_choices
(
doc
):
choices
=
[
choices
=
[
c
[
4
:].
rstrip
(
" ,"
)
c
[
4
:].
rstrip
(
" ,"
)
...
@@ -10,58 +9,43 @@ def parse_choices(doc):
...
@@ -10,58 +9,43 @@ def parse_choices(doc):
]
]
return
choices
return
choices
def
doc_to_text_base
(
alphabet
,
style
,
doc
):
def
doc_to_text_base
(
alphabet
,
style
,
doc
):
choices
=
parse_choices
(
doc
)
choices
=
parse_choices
(
doc
)
num
=
len
(
choices
)
num
=
len
(
choices
)
letter_list
=
[
style
.
format
(
letter
)
for
letter
in
alphabet
[
0
:
num
]]
letter_list
=
[
style
.
format
(
letter
)
for
letter
in
alphabet
[
0
:
num
]]
if
"
\t
"
in
style
:
if
"
\t
"
in
style
:
choice_string
=
"{}{}"
choice_string
=
"{}{}"
else
:
else
:
choice_string
=
"{} {}"
choice_string
=
"{} {}"
doc_to_text
=
"
\n
\n
"
.
join
(
doc_to_text
=
"
\n
"
.
join
(
[
doc
[
"Problem"
]]
[
"Question: "
+
doc
[
"Problem"
]]
+
[
choice_string
.
format
(
i
,
j
)
for
i
,
j
in
zip
(
letter_list
,
choices
)]
+
[
choice_string
.
format
(
i
,
j
)
for
i
,
j
in
zip
(
letter_list
,
choices
)]
+
[
"Answer:"
]
)
)
return
doc_to_text
return
doc_to_text
# Full continuation
# Full continuation
def
choice_A
(
doc
):
def
choice_A
(
doc
):
return
parse_choices
(
doc
)
return
parse_choices
(
doc
)
# Letters only
# Letters only
def
choice_B
(
alphabet
,
style
,
doc
):
def
choice_B
(
alphabet
,
style
,
doc
):
choices
=
parse_choices
(
doc
)
choices
=
parse_choices
(
doc
)
num
=
len
(
choices
)
num
=
len
(
choices
)
letter_list
=
[
style
.
format
(
letter
)
for
letter
in
alphabet
[
0
:
num
]]
letter_list
=
[
style
.
format
(
letter
)
for
letter
in
alphabet
[
0
:
num
]]
if
"
\t
"
in
style
:
if
"
\t
"
in
style
:
letter_list
=
[
letter
.
replace
(
"
\t
"
,
""
)
for
letter
in
letter_list
]
letter_list
=
[
letter
.
replace
(
"
\t
"
,
""
)
for
letter
in
letter_list
]
return
letter_list
return
letter_list
# Letters + Full continuation
# Letters + Full continuation
def
choice_C
(
alphabet
,
style
,
doc
):
def
choice_C
(
alphabet
,
style
,
doc
):
choices
=
parse_choices
(
doc
)
choices
=
parse_choices
(
doc
)
num
=
len
(
choices
)
num
=
len
(
choices
)
letter_list
=
[
style
.
format
(
letter
)
for
letter
in
alphabet
[
0
:
num
]]
letter_list
=
[
style
.
format
(
letter
)
for
letter
in
alphabet
[
0
:
num
]]
if
"
\t
"
not
in
style
:
if
"
\t
"
not
in
style
:
letter_list
=
[
letter
+
" "
for
letter
in
letter_list
]
letter_list
=
[
letter
+
" "
for
letter
in
letter_list
]
return
[
letter
+
choice
for
letter
,
choice
in
zip
(
letter_list
,
choices
)]
return
[
letter
+
choice
for
letter
,
choice
in
zip
(
letter_list
,
choices
)]
template_01
=
partial
(
doc_to_text_base
,
string
.
ascii_lowercase
,
"({})"
)
template_01
=
partial
(
doc_to_text_base
,
string
.
ascii_lowercase
,
"({})"
)
choice_01a
=
choice_A
choice_01a
=
choice_A
choice_01b
=
partial
(
choice_B
,
string
.
ascii_lowercase
,
"({})"
)
choice_01b
=
partial
(
choice_B
,
string
.
ascii_lowercase
,
"({})"
)
...
...
lm_eval/tasks/mathqa/alternative_worlds/prompt_variation/style_01.yaml
0 → 100644
View file @
af6e46fd
group
:
mathqa_alt_pv
task
:
mathqa_alt_pv_01
dataset_path
:
math_qa
output_type
:
multiple_choice
training_split
:
train
validation_split
:
validation
test_split
:
test
doc_to_text
:
"
{{Problem}}"
doc_to_target
:
"
{{['a',
'b',
'c',
'd',
'e'].index(correct)}}"
doc_to_choice
:
!function
../../utils.doc_to_choice
should_decontaminate
:
true
doc_to_decontamination_query
:
"
{{Problem}}"
metric_list
:
-
metric
:
acc
-
metric
:
acc_norm
-
metric
:
brier_score
lm_eval/tasks/mathqa/alternative_worlds/prompt_variation/style_02.yaml
0 → 100644
View file @
af6e46fd
group
:
mathqa_alt_pv
task
:
mathqa_alt_pv_02
dataset_path
:
math_qa
output_type
:
multiple_choice
training_split
:
train
validation_split
:
validation
test_split
:
test
doc_to_text
:
"
Q:
{{Problem}}
\n
A:"
doc_to_target
:
"
{{['a',
'b',
'c',
'd',
'e'].index(correct)}}"
doc_to_choice
:
!function
../../utils.doc_to_choice
should_decontaminate
:
true
doc_to_decontamination_query
:
"
Q:
{{Problem}}
\n
A:"
metric_list
:
-
metric
:
acc
-
metric
:
acc_norm
-
metric
:
brier_score
lm_eval/tasks/mathqa/alternative_worlds/prompt_variation/style_03.yaml
0 → 100644
View file @
af6e46fd
group
:
mathqa_alt_pv
task
:
mathqa_alt_pv_03
dataset_path
:
math_qa
output_type
:
multiple_choice
training_split
:
train
validation_split
:
validation
test_split
:
test
doc_to_text
:
"
Question:
{{Problem}}
\n
Answer:"
doc_to_target
:
"
{{['a',
'b',
'c',
'd',
'e'].index(correct)}}"
doc_to_choice
:
!function
../../utils.doc_to_choice
should_decontaminate
:
true
doc_to_decontamination_query
:
"
Question:
{{Problem}}
\n
Answer:"
metric_list
:
-
metric
:
acc
-
metric
:
acc_norm
-
metric
:
brier_score
Prev
1
2
Next
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