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
5b26b3b0
Commit
5b26b3b0
authored
Sep 22, 2023
by
Chris
Browse files
Cast gold to the same type as result
parent
94346b7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
lm_eval/api/task.py
lm_eval/api/task.py
+4
-3
No files found.
lm_eval/api/task.py
View file @
5b26b3b0
...
@@ -1069,6 +1069,7 @@ class ConfigurableTask(Task):
...
@@ -1069,6 +1069,7 @@ class ConfigurableTask(Task):
elif
self
.
OUTPUT_TYPE
==
"greedy_until"
:
elif
self
.
OUTPUT_TYPE
==
"greedy_until"
:
gold
=
self
.
doc_to_target
(
doc
)
gold
=
self
.
doc_to_target
(
doc
)
result
=
results
[
0
]
if
self
.
config
.
doc_to_choice
is
not
None
:
if
self
.
config
.
doc_to_choice
is
not
None
:
# If you set doc_to_choice,
# If you set doc_to_choice,
# it assumes that doc_to_target returns a number.
# it assumes that doc_to_target returns a number.
...
@@ -1077,10 +1078,10 @@ class ConfigurableTask(Task):
...
@@ -1077,10 +1078,10 @@ class ConfigurableTask(Task):
# we expect multiple_targets to be a list.
# we expect multiple_targets to be a list.
elif
self
.
multiple_target
:
elif
self
.
multiple_target
:
gold
=
list
(
gold
)
gold
=
list
(
gold
)
else
:
elif
type
(
gold
)
!=
type
(
result
):
gold
=
str
(
gold
)
# cast gold to the same type as result
gold
=
type
(
result
)(
gold
)
result
=
results
[
0
]
for
metric
in
self
.
_metric_fn_list
.
keys
():
for
metric
in
self
.
_metric_fn_list
.
keys
():
if
self
.
multiple_target
:
if
self
.
multiple_target
:
# in the case where we have multiple targets,
# in the case where we have multiple targets,
...
...
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