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
198ca732
Commit
198ca732
authored
Aug 09, 2021
by
Leo Gao
Browse files
fix squad breakage due to HF change
parent
fc0d2377
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
1 deletion
+8
-1
lm_eval/tasks/squad.py
lm_eval/tasks/squad.py
+5
-1
tests/testdata/squad2-v1-greedy_until
tests/testdata/squad2-v1-greedy_until
+1
-0
tests/testdata/squad2-v1-loglikelihood
tests/testdata/squad2-v1-loglikelihood
+1
-0
tests/testdata/squad2-v1-res.json
tests/testdata/squad2-v1-res.json
+1
-0
No files found.
lm_eval/tasks/squad.py
View file @
198ca732
...
...
@@ -4,6 +4,7 @@ from lm_eval.base import rf
from
lm_eval.metrics
import
f1_score
,
mean
from
.
common
import
HFTask
from
functools
import
partial
from
packaging
import
version
def
_squad_metric
(
predictions
,
references
):
...
...
@@ -18,10 +19,13 @@ def _squad_agg(key, items):
class
SQuAD2
(
HFTask
):
VERSION
=
0
VERSION
=
1
DATASET_PATH
=
"squad_v2"
DATASET_NAME
=
None
# HF changed squad on us so we have to make sure we aren't running the old one
assert
version
.
parse
(
datasets
.
__version__
)
>=
version
.
parse
(
"1.11.0"
),
"datasets v1.11.0 or later required for SQuAD"
def
has_training_docs
(
self
):
return
True
...
...
tests/testdata/squad2-v1-greedy_until
0 → 100644
View file @
198ca732
e17e3d85c1d5adaf2d6b4b752c4babc2e0b3a6e144e6de70cb3b2287e85109b8
\ No newline at end of file
tests/testdata/squad2-v1-loglikelihood
0 → 100644
View file @
198ca732
f5da6173402b274dc89130755c222c6ca6b2a3bacaaa4e4ab07be9322b7bad65
\ No newline at end of file
tests/testdata/squad2-v1-res.json
0 → 100644
View file @
198ca732
{
"results"
:
{
"squad2"
:
{
"HasAns_exact"
:
0.0
,
"HasAns_f1"
:
0.0
,
"NoAns_exact"
:
0.0
,
"NoAns_f1"
:
0.0
,
"best_exact"
:
50.07159100480081
,
"best_f1"
:
50.07159100480081
,
"exact"
:
0.0
,
"f1"
:
0.0
}},
"versions"
:
{
"squad2"
:
1
}}
\ No newline at end of file
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