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
8f0e1765
Commit
8f0e1765
authored
Feb 13, 2022
by
Stephen Hogg
Browse files
Remove extractive spans score; mark as TODO
parent
af9766d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
lm_eval/tasks/qasper.py
lm_eval/tasks/qasper.py
+3
-15
No files found.
lm_eval/tasks/qasper.py
View file @
8f0e1765
...
@@ -92,16 +92,6 @@ def token_f1_score(prediction, ground_truth):
...
@@ -92,16 +92,6 @@ def token_f1_score(prediction, ground_truth):
return
f1
return
f1
def
paragraph_f1_score
(
prediction
,
ground_truth
):
num_same
=
len
(
set
(
ground_truth
).
intersection
(
set
(
prediction
)))
if
num_same
==
0
:
return
0.0
precision
=
num_same
/
len
(
prediction
)
recall
=
num_same
/
len
(
ground_truth
)
f1
=
(
2
*
precision
*
recall
)
/
(
precision
+
recall
)
return
f1
class
QASPER
(
HFTask
):
class
QASPER
(
HFTask
):
VERSION
=
0
VERSION
=
0
DATASET_PATH
=
"qasper"
DATASET_PATH
=
"qasper"
...
@@ -182,9 +172,9 @@ class QASPER(HFTask):
...
@@ -182,9 +172,9 @@ class QASPER(HFTask):
if
doc
[
"answer_type"
]
==
"free form answer"
:
if
doc
[
"answer_type"
]
==
"free form answer"
:
res_dict
[
"f1_abstractive"
]
=
token_f1_score
(
res
,
doc
[
"answer"
])
res_dict
[
"f1_abstractive"
]
=
token_f1_score
(
res
,
doc
[
"answer"
])
# Handle extraction
#
TODO:
Handle extraction
if
doc
[
"answer_type"
]
==
"extractive_spans"
:
#
if doc["answer_type"] == "extractive_spans":
res_dict
[
"f1_extractive"
]
=
0
#
res_dict["f1_extractive"] = 0
return
res_dict
return
res_dict
def
aggregation
(
self
):
def
aggregation
(
self
):
...
@@ -192,7 +182,6 @@ class QASPER(HFTask):
...
@@ -192,7 +182,6 @@ class QASPER(HFTask):
"f1_unanswerable"
:
f1_score
,
"f1_unanswerable"
:
f1_score
,
"f1_yesno"
:
f1_score
,
"f1_yesno"
:
f1_score
,
"f1_abstractive"
:
mean
,
"f1_abstractive"
:
mean
,
"f1_extractive"
:
mean
,
}
}
def
construct_requests
(
self
,
doc
,
ctx
):
def
construct_requests
(
self
,
doc
,
ctx
):
...
@@ -226,5 +215,4 @@ class QASPER(HFTask):
...
@@ -226,5 +215,4 @@ class QASPER(HFTask):
"f1_unanswerable"
:
True
,
"f1_unanswerable"
:
True
,
"f1_yesno"
:
True
,
"f1_yesno"
:
True
,
"f1_abstractive"
:
True
,
"f1_abstractive"
:
True
,
"f1_extractive"
:
True
,
}
}
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