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
b2bab740
"parse.vcproj" did not exist on "2ffc7dc6ac9efedf3ff7a54ecaeda7471990a28b"
Commit
b2bab740
authored
Mar 22, 2021
by
Jonathan Tow
Browse files
Restore proper prompt formatting
parent
806b022b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
lm_eval/tasks/hendrycks_test.py
lm_eval/tasks/hendrycks_test.py
+16
-2
No files found.
lm_eval/tasks/hendrycks_test.py
View file @
b2bab740
...
@@ -60,10 +60,24 @@ class GeneralHendrycksTest(MultipleChoiceTask):
...
@@ -60,10 +60,24 @@ class GeneralHendrycksTest(MultipleChoiceTask):
return
True
return
True
def
_convert_standard
(
self
,
doc
):
def
_convert_standard
(
self
,
doc
):
def
format_example
(
doc
,
choices
):
"""
Question: <prompt>
A. <choice1>
B. <choice2>
C. <choice3>
D. <choice4>
Answer:
"""
prompt
=
"Question: "
+
doc
[
0
]
prompt
+=
" "
.
join
([
f
"
\n
{
choices
[
j
]
}
.
{
doc
[
j
+
1
]
}
"
for
j
in
range
(
4
)])
prompt
+=
"
\n
Answer:"
return
prompt
choices
=
[
'A'
,
'B'
,
'C'
,
'D'
]
return
{
return
{
"query"
:
"Question: "
+
doc
[
0
]
+
"
\n
Answer:"
,
"query"
:
format_example
(
doc
,
choices
)
,
"choices"
:
doc
[
1
:
5
],
"choices"
:
doc
[
1
:
5
],
"gold"
:
[
'A'
,
'B'
,
'C'
,
'D'
]
.
index
(
doc
[
5
])
"gold"
:
choices
.
index
(
doc
[
5
])
}
}
def
_load_docs
(
self
,
filename
):
def
_load_docs
(
self
,
filename
):
...
...
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