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
aadf2f41
Commit
aadf2f41
authored
Mar 22, 2021
by
Jonathan Tow
Browse files
Fix `LogiQA` prompts
parent
8809c5f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
lm_eval/tasks/logiqa.py
lm_eval/tasks/logiqa.py
+19
-2
No files found.
lm_eval/tasks/logiqa.py
View file @
aadf2f41
...
...
@@ -30,10 +30,27 @@ class LogiQA(MultipleChoiceTask):
return
True
def
_convert_standard
(
self
,
doc
):
def
format_example
(
doc
,
choices
):
"""
Passage: <passage>
Question: <question>
A. <choice1>
B. <choice2>
C. <choice3>
D. <choice4>
Answer:
"""
prompt
=
"Passage: "
+
doc
[
"passage"
]
+
"
\n
"
prompt
+=
"Question: "
+
doc
[
"question"
]
+
"
\n
"
for
choice
,
option
in
zip
(
choices
,
doc
[
"options"
]):
prompt
+=
f
"
{
choice
.
upper
()
}
.
{
option
}
\n
"
prompt
+=
"Answer:"
return
prompt
choices
=
[
'a'
,
'b'
,
'c'
,
'd'
]
return
{
"query"
:
"Passage: "
+
doc
[
"passage"
]
+
"
\n
Question: "
+
doc
[
"question"
]
+
"
\n
Answer:"
,
"query"
:
format_example
(
doc
,
choices
)
,
"choices"
:
doc
[
"options"
],
"gold"
:
[
"a"
,
"b"
,
"c"
,
"d"
]
.
index
(
doc
[
"answerKey"
])
"gold"
:
choices
.
index
(
doc
[
"answerKey"
])
}
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