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
c74e2761
Commit
c74e2761
authored
Dec 06, 2023
by
lintangsutawika
Browse files
reformat
parent
cc572624
Changes
155
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
51 additions
and
48 deletions
+51
-48
lm_eval/tasks/hellaswag/alternative_worlds/style_08/b.yaml
lm_eval/tasks/hellaswag/alternative_worlds/style_08/b.yaml
+2
-2
lm_eval/tasks/hellaswag/alternative_worlds/style_08/c.yaml
lm_eval/tasks/hellaswag/alternative_worlds/style_08/c.yaml
+2
-2
lm_eval/tasks/hellaswag/alternative_worlds/styles.py
lm_eval/tasks/hellaswag/alternative_worlds/styles.py
+13
-10
lm_eval/tasks/mathqa/alternative_worlds/README.md
lm_eval/tasks/mathqa/alternative_worlds/README.md
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_01/a.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_01/a.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_01/b.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_01/b.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_01/c.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_01/c.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_02/a.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_02/a.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_02/b.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_02/b.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_02/c.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_02/c.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_03/a.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_03/a.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_03/b.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_03/b.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_03/c.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_03/c.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_04/a.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_04/a.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_04/b.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_04/b.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_04/c.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_04/c.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_05/a.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_05/a.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_05/b.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_05/b.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_05/c.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_05/c.yaml
+2
-2
lm_eval/tasks/mathqa/alternative_worlds/style_06/a.yaml
lm_eval/tasks/mathqa/alternative_worlds/style_06/a.yaml
+2
-2
No files found.
lm_eval/tasks/hellaswag/alternative_worlds/style_08/b.yaml
View file @
c74e2761
include
:
../_hellaswag_alt_yaml
include
:
../_hellaswag_alt_yaml
group
:
hellaswag_08
group
:
hellaswag_08
group_alias
:
style_08
group_alias
:
style_08
task
:
hellaswag_08b
task
:
hellaswag_08b
task_alias
:
b
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
\ No newline at end of file
lm_eval/tasks/hellaswag/alternative_worlds/style_08/c.yaml
View file @
c74e2761
include
:
../_hellaswag_alt_yaml
include
:
../_hellaswag_alt_yaml
group
:
hellaswag_08
group
:
hellaswag_08
group_alias
:
style_08
group_alias
:
style_08
task
:
hellaswag_08c
task
:
hellaswag_08c
task_alias
:
c
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
\ No newline at end of file
lm_eval/tasks/hellaswag/alternative_worlds/styles.py
View file @
c74e2761
import
string
import
string
from
functools
import
partial
from
functools
import
partial
def
doc_to_text_base
(
alphabet
,
style
,
doc
):
def
doc_to_text_base
(
alphabet
,
style
,
doc
):
choices
=
doc
[
"choices"
]
choices
=
doc
[
"choices"
]
...
@@ -13,20 +14,22 @@ def doc_to_text_base(alphabet, style, doc):
...
@@ -13,20 +14,22 @@ def doc_to_text_base(alphabet, style, doc):
else
:
else
:
choice_string
=
"{} {}"
choice_string
=
"{} {}"
doc_to_text
=
"
\n\n
"
.
join
([
doc_to_text
=
"
\n\n
"
.
join
(
doc
[
"query"
]
+
"..."
,
[
" What is the most appropriate continuation?"
,
doc
[
"query"
]
+
"..."
,
]
+
[
" What is the most appropriate continuation?"
,
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
)]
)
)
return
doc_to_text
return
doc_to_text
# Full continuation
# Full continuation
def
choice_A
(
doc
):
def
choice_A
(
doc
):
return
doc
[
"choices"
]
return
doc
[
"choices"
]
# Letters only
# Letters only
def
choice_B
(
alphabet
,
style
,
doc
):
def
choice_B
(
alphabet
,
style
,
doc
):
...
@@ -35,10 +38,11 @@ def choice_B(alphabet, style, doc):
...
@@ -35,10 +38,11 @@ def choice_B(alphabet, style, doc):
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
):
...
@@ -47,9 +51,10 @@ def choice_C(alphabet, style, doc):
...
@@ -47,9 +51,10 @@ def choice_C(alphabet, style, doc):
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
,
doc
[
"choices"
])]
return
[
letter
+
choice
for
letter
,
choice
in
zip
(
letter_list
,
doc
[
"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
...
@@ -83,5 +88,3 @@ template_08 = partial(doc_to_text_base, string.ascii_uppercase, "{}\t")
...
@@ -83,5 +88,3 @@ template_08 = partial(doc_to_text_base, string.ascii_uppercase, "{}\t")
choice_08a
=
choice_A
choice_08a
=
choice_A
choice_08b
=
partial
(
choice_B
,
string
.
ascii_uppercase
,
"{}
\t
"
)
choice_08b
=
partial
(
choice_B
,
string
.
ascii_uppercase
,
"{}
\t
"
)
choice_08c
=
partial
(
choice_C
,
string
.
ascii_uppercase
,
"{}
\t
"
)
choice_08c
=
partial
(
choice_C
,
string
.
ascii_uppercase
,
"{}
\t
"
)
lm_eval/tasks/mathqa/alternative_worlds/README.md
View file @
c74e2761
...
@@ -15,6 +15,6 @@ Answer types:
...
@@ -15,6 +15,6 @@ Answer types:
-
original option
-
original option
-
just letter
-
just letter
-
letters + continuation
-
letters + continuation
-
original option
-
original option
-
just letter
-
just letter
-
continuation
-
continuation
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_01/a.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_01
group
:
mathqa_01
group_alias
:
style_01
group_alias
:
style_01
task
:
mathqa_01a
task
:
mathqa_01a
task_alias
:
a
task_alias
:
a
doc_to_text
:
!function
../styles.template_01
doc_to_text
:
!function
../styles.template_01
doc_to_choice
:
!function
../styles.choice_01a
doc_to_choice
:
!function
../styles.choice_01a
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_01/b.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_01
group
:
mathqa_01
group_alias
:
style_01
group_alias
:
style_01
task
:
mathqa_01b
task
:
mathqa_01b
task_alias
:
b
task_alias
:
b
doc_to_text
:
!function
../styles.template_01
doc_to_text
:
!function
../styles.template_01
doc_to_choice
:
!function
../styles.choice_01b
doc_to_choice
:
!function
../styles.choice_01b
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_01/c.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_01
group
:
mathqa_01
group_alias
:
style_01
group_alias
:
style_01
task
:
mathqa_01c
task
:
mathqa_01c
task_alias
:
c
task_alias
:
c
doc_to_text
:
!function
../styles.template_01
doc_to_text
:
!function
../styles.template_01
doc_to_choice
:
!function
../styles.choice_01c
doc_to_choice
:
!function
../styles.choice_01c
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_02/a.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_02
group
:
mathqa_02
group_alias
:
style_02
group_alias
:
style_02
task
:
mathqa_02a
task
:
mathqa_02a
task_alias
:
a
task_alias
:
a
doc_to_text
:
!function
../styles.template_02
doc_to_text
:
!function
../styles.template_02
doc_to_choice
:
!function
../styles.choice_02a
doc_to_choice
:
!function
../styles.choice_02a
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_02/b.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_02
group
:
mathqa_02
group_alias
:
style_02
group_alias
:
style_02
task
:
mathqa_02b
task
:
mathqa_02b
task_alias
:
b
task_alias
:
b
doc_to_text
:
!function
../styles.template_02
doc_to_text
:
!function
../styles.template_02
doc_to_choice
:
!function
../styles.choice_02b
doc_to_choice
:
!function
../styles.choice_02b
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_02/c.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_02
group
:
mathqa_02
group_alias
:
style_02
group_alias
:
style_02
task
:
mathqa_02c
task
:
mathqa_02c
task_alias
:
c
task_alias
:
c
doc_to_text
:
!function
../styles.template_02
doc_to_text
:
!function
../styles.template_02
doc_to_choice
:
!function
../styles.choice_02c
doc_to_choice
:
!function
../styles.choice_02c
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_03/a.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_03
group
:
mathqa_03
group_alias
:
style_03
group_alias
:
style_03
task
:
mathqa_03a
task
:
mathqa_03a
task_alias
:
a
task_alias
:
a
doc_to_text
:
!function
../styles.template_03
doc_to_text
:
!function
../styles.template_03
doc_to_choice
:
!function
../styles.choice_03a
doc_to_choice
:
!function
../styles.choice_03a
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_03/b.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_03
group
:
mathqa_03
group_alias
:
style_03
group_alias
:
style_03
task
:
mathqa_03b
task
:
mathqa_03b
task_alias
:
b
task_alias
:
b
doc_to_text
:
!function
../styles.template_03
doc_to_text
:
!function
../styles.template_03
doc_to_choice
:
!function
../styles.choice_03b
doc_to_choice
:
!function
../styles.choice_03b
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_03/c.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_03
group
:
mathqa_03
group_alias
:
style_03
group_alias
:
style_03
task
:
mathqa_03c
task
:
mathqa_03c
task_alias
:
c
task_alias
:
c
doc_to_text
:
!function
../styles.template_03
doc_to_text
:
!function
../styles.template_03
doc_to_choice
:
!function
../styles.choice_03c
doc_to_choice
:
!function
../styles.choice_03c
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_04/a.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_04
group
:
mathqa_04
group_alias
:
style_04
group_alias
:
style_04
task
:
mathqa_04a
task
:
mathqa_04a
task_alias
:
a
task_alias
:
a
doc_to_text
:
!function
../styles.template_04
doc_to_text
:
!function
../styles.template_04
doc_to_choice
:
!function
../styles.choice_04a
doc_to_choice
:
!function
../styles.choice_04a
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_04/b.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_04
group
:
mathqa_04
group_alias
:
style_04
group_alias
:
style_04
task
:
mathqa_04b
task
:
mathqa_04b
task_alias
:
b
task_alias
:
b
doc_to_text
:
!function
../styles.template_04
doc_to_text
:
!function
../styles.template_04
doc_to_choice
:
!function
../styles.choice_04b
doc_to_choice
:
!function
../styles.choice_04b
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_04/c.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_04
group
:
mathqa_04
group_alias
:
style_04
group_alias
:
style_04
task
:
mathqa_04c
task
:
mathqa_04c
task_alias
:
c
task_alias
:
c
doc_to_text
:
!function
../styles.template_04
doc_to_text
:
!function
../styles.template_04
doc_to_choice
:
!function
../styles.choice_04c
doc_to_choice
:
!function
../styles.choice_04c
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_05/a.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_05
group
:
mathqa_05
group_alias
:
style_05
group_alias
:
style_05
task
:
mathqa_05a
task
:
mathqa_05a
task_alias
:
a
task_alias
:
a
doc_to_text
:
!function
../styles.template_05
doc_to_text
:
!function
../styles.template_05
doc_to_choice
:
!function
../styles.choice_05a
doc_to_choice
:
!function
../styles.choice_05a
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_05/b.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_05
group
:
mathqa_05
group_alias
:
style_05
group_alias
:
style_05
task
:
mathqa_05b
task
:
mathqa_05b
task_alias
:
b
task_alias
:
b
doc_to_text
:
!function
../styles.template_05
doc_to_text
:
!function
../styles.template_05
doc_to_choice
:
!function
../styles.choice_05b
doc_to_choice
:
!function
../styles.choice_05b
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_05/c.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_05
group
:
mathqa_05
group_alias
:
style_05
group_alias
:
style_05
task
:
mathqa_05c
task
:
mathqa_05c
task_alias
:
c
task_alias
:
c
doc_to_text
:
!function
../styles.template_05
doc_to_text
:
!function
../styles.template_05
doc_to_choice
:
!function
../styles.choice_05c
doc_to_choice
:
!function
../styles.choice_05c
\ No newline at end of file
lm_eval/tasks/mathqa/alternative_worlds/style_06/a.yaml
View file @
c74e2761
include
:
../_mathqa_alt_yaml
include
:
../_mathqa_alt_yaml
group
:
mathqa_06
group
:
mathqa_06
group_alias
:
style_06
group_alias
:
style_06
task
:
mathqa_06a
task
:
mathqa_06a
task_alias
:
a
task_alias
:
a
doc_to_text
:
!function
../styles.template_06
doc_to_text
:
!function
../styles.template_06
doc_to_choice
:
!function
../styles.choice_06a
doc_to_choice
:
!function
../styles.choice_06a
\ No newline at end of file
Prev
1
…
3
4
5
6
7
8
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