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
222027b9
Commit
222027b9
authored
Feb 06, 2021
by
thefazzer
Browse files
HFTask -> Task, line break correction
parent
a21df355
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
lm_eval/tasks/coqa.py
lm_eval/tasks/coqa.py
+3
-3
No files found.
lm_eval/tasks/coqa.py
View file @
222027b9
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
import
json
import
json
import
random
import
random
import
numpy
as
np
import
numpy
as
np
from
lm_eval.base
import
Dataset
,
rf
,
mean
from
lm_eval.base
import
Task
,
rf
,
mean
from
..utils
import
sh
from
..utils
import
sh
from
itertools
import
zip_longest
from
itertools
import
zip_longest
import
transformers.data.metrics.squad_metrics
as
squad_metrics
import
transformers.data.metrics.squad_metrics
as
squad_metrics
class
CoQA
(
Dataset
):
class
CoQA
(
Task
):
def
download
(
self
):
def
download
(
self
):
pass
pass
# -N only overwrites if the remote file has changed
# -N only overwrites if the remote file has changed
...
@@ -44,7 +44,7 @@ class CoQA(Dataset):
...
@@ -44,7 +44,7 @@ class CoQA(Dataset):
doc_text
=
doc
[
"story"
]
+
'
\n\n
'
doc_text
=
doc
[
"story"
]
+
'
\n\n
'
for
(
q
,
a
)
in
zip_longest
(
doc
[
"questions"
],
doc
[
"answers"
][:
-
1
]):
# omit target answer
for
(
q
,
a
)
in
zip_longest
(
doc
[
"questions"
],
doc
[
"answers"
][:
-
1
]):
# omit target answer
question
=
f
"Q:
{
q
[
'input_text'
]
}
"
+
'
\n\n
'
question
=
f
"Q:
{
q
[
'input_text'
]
}
"
+
'
\n\n
'
answer
=
f
"A:
{
a
[
'input_text'
]
}
"
+
'
\n\n
'
if
a
is
not
None
else
"A:
\n\n
"
answer
=
f
"A:
{
a
[
'input_text'
]
}
"
+
'
\n\n
'
if
a
is
not
None
else
"A:
"
doc_text
+=
question
+
answer
doc_text
+=
question
+
answer
print
(
doc_text
)
print
(
doc_text
)
return
doc_text
return
doc_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