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
052c7bde
"tools/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "d9fe1c6cc0801b0cefdf370798026d1a9d49d892"
Commit
052c7bde
authored
May 12, 2024
by
JessicaOjo
Browse files
remove squad metric
parent
fef54568
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
24 deletions
+0
-24
lm_eval/api/metrics.py
lm_eval/api/metrics.py
+0
-24
No files found.
lm_eval/api/metrics.py
View file @
052c7bde
...
@@ -58,20 +58,6 @@ def f1_score(items):
...
@@ -58,20 +58,6 @@ def f1_score(items):
return
np
.
max
(
fscore
)
return
np
.
max
(
fscore
)
@
register_aggregation
(
"squad_f1"
)
def
squad_f1_score
(
items
):
gold_squad
,
pred_squad
=
[],
[]
for
index
,
(
ref
,
pred
)
in
enumerate
(
items
):
pred_dict
=
{
'prediction_text'
:
str
(
pred
),
'id'
:
str
(
index
)}
ref_dict
=
{
'answers'
:
{
'answer_start'
:
[
0
],
'text'
:
str
(
ref
)},
'id'
:
str
(
index
)}
gold_squad
.
append
(
ref_dict
)
pred_squad
.
append
(
pred_dict
)
squad_metric
=
hf_evaluate
.
load
(
"squad"
)
results_squad
=
squad_metric
.
compute
(
predictions
=
pred_squad
,
references
=
gold_squad
)
return
results_squad
[
'f1'
]
@
register_aggregation
(
"matthews_corrcoef"
)
@
register_aggregation
(
"matthews_corrcoef"
)
def
matthews_corrcoef
(
items
):
def
matthews_corrcoef
(
items
):
unzipped_list
=
list
(
zip
(
*
items
))
unzipped_list
=
list
(
zip
(
*
items
))
...
@@ -192,16 +178,6 @@ def exact_match_fn(**kwargs):
...
@@ -192,16 +178,6 @@ def exact_match_fn(**kwargs):
return
exact_match
.
compute
(
**
kwargs
)
return
exact_match
.
compute
(
**
kwargs
)
@
register_metric
(
metric
=
"squad"
,
higher_is_better
=
True
,
output_type
=
"generate_until"
,
aggregation
=
"squad_f1"
)
def
squad_fn
(
items
):
return
items
@
register_metric
(
@
register_metric
(
metric
=
"perplexity"
,
metric
=
"perplexity"
,
higher_is_better
=
False
,
higher_is_better
=
False
,
...
...
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