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
dc3560d0
"vscode:/vscode.git/clone" did not exist on "2117f82defd589d97598830df6ec5826187d4541"
Commit
dc3560d0
authored
Oct 24, 2020
by
Charles Foster
Browse files
Updates to natural questions answer handling. Now uses long answers alwasy.
parent
d51f3e7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
lm_eval/tasks/naturalqs.py
lm_eval/tasks/naturalqs.py
+3
-6
No files found.
lm_eval/tasks/naturalqs.py
View file @
dc3560d0
...
...
@@ -28,16 +28,13 @@ class NaturalQs(HFTask):
short_answer
=
doc
[
'annotations'
][
'short_answers'
][
0
][
'text'
]
long_answer_start
=
doc
[
'annotations'
][
'long_answer'
][
0
][
'start_token'
]
long_answer_end
=
doc
[
'annotations'
][
'long_answer'
][
0
][
'end_token'
]
passage
=
" "
.
join
(
doc
[
'document'
][
'tokens'
][
'token'
][
long_answer_start
:
long_answer_end
])
long_answer
=
" "
.
join
(
doc
[
'document'
][
'tokens'
][
'token'
][
long_answer_start
:
long_answer_end
])
text
=
'Q: '
+
question
+
'
\n\n
'
+
'A: '
if
include_target
:
# What if there is no short answer? This will be an empty string. Currently, default to the long answer otherwise.
if
short_answer
:
text
+=
short_answer
[
0
]
else
:
text
+=
long_answer
# There's a short answer and a long answer. Based on the paper, I'm using the long answer.
text
+=
long_answer
# Replace with short_answer[0] for short answer
return
text
...
...
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