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
21aa92d2
Commit
21aa92d2
authored
Aug 15, 2023
by
haileyschoelkopf
Browse files
rename var
parent
40f81c42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
lm_eval/api/task.py
lm_eval/api/task.py
+14
-12
No files found.
lm_eval/api/task.py
View file @
21aa92d2
...
...
@@ -1011,34 +1011,36 @@ class ConfigurableTask(Task):
scores
=
[]
for
gold_option
in
gold
:
try
:
res
=
self
.
_metric_fn_list
[
key
](
res
ult_score
=
self
.
_metric_fn_list
[
key
](
references
=
[
gold_option
],
predictions
=
[
result
],
**
self
.
_metric_fn_kwargs
[
key
],
)
except
TypeError
:
# TODO: this is hacky and I don't want to do it
result
=
self
.
_metric_fn_list
[
key
]([
gold_option
,
result
])
if
isinstance
(
res
,
dict
):
result_score
=
self
.
_metric_fn_list
[
key
](
[
gold_option
,
result
]
)
if
isinstance
(
result_score
,
dict
):
# TODO: this handles the case where HF evaluate returns a dict.
res
=
res
[
key
]
scores
.
append
(
res
)
res
ult_score
=
result_score
[
key
]
scores
.
append
(
res
ult_score
)
if
any
(
scores
):
result
=
1.0
result
_score
=
1.0
else
:
result
=
0.0
result
_score
=
0.0
else
:
try
:
result
=
self
.
_metric_fn_list
[
key
](
result
_score
=
self
.
_metric_fn_list
[
key
](
references
=
[
gold
],
predictions
=
[
result
],
**
self
.
_metric_fn_kwargs
[
key
],
)
except
TypeError
:
result
=
self
.
_metric_fn_list
[
key
]([
gold
,
result
])
if
isinstance
(
result
,
dict
):
result_dict
.
update
(
result
)
result
_score
=
self
.
_metric_fn_list
[
key
]([
gold
,
result
])
if
isinstance
(
result
_score
,
dict
):
result_dict
.
update
(
result
_score
)
else
:
result_dict
[
key
]
=
result
result_dict
[
key
]
=
result
_score
else
:
raise
ValueError
(
f
"Passed invalid output_type '
{
self
.
OUTPUT_TYPE
}
' ! Please use one of "
,
...
...
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