Commit 5b26b3b0 authored by Chris's avatar Chris
Browse files

Cast gold to the same type as result

parent 94346b7e
...@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment