Skip to content
Snippets Groups Projects
Commit f09ffba8 authored by Grießhaber Daniel's avatar Grießhaber Daniel :squid:
Browse files

add missing parameter in QuestionAnswering.evaluate

parent eb8df827
No related branches found
No related tags found
No related merge requests found
...@@ -402,7 +402,12 @@ class QuestionAnswering(Task): ...@@ -402,7 +402,12 @@ class QuestionAnswering(Task):
def _aggregate_result(self, results: list[float]) -> float: def _aggregate_result(self, results: list[float]) -> float:
return sum(results) / len(results) return sum(results) / len(results)
def evaluate(self, prompt: str, dataset: Dataset): def evaluate(
self,
prompt: str,
dataset: Dataset,
parent_histories: list[list[float]] | None = None,
):
def replace_symbol_for_grammar(sample: DatasetDatum): def replace_symbol_for_grammar(sample: DatasetDatum):
symbol_replacement_mapping = { symbol_replacement_mapping = {
"\u2013": "-", "\u2013": "-",
...@@ -426,7 +431,7 @@ class QuestionAnswering(Task): ...@@ -426,7 +431,7 @@ class QuestionAnswering(Task):
if self.use_grammar: if self.use_grammar:
# NOTE: the LlamaGrammar has issues with symbol '–' therefore we replace all occurences with '-' (hyphen) # NOTE: the LlamaGrammar has issues with symbol '–' therefore we replace all occurences with '-' (hyphen)
dataset = dataset.map(replace_symbol_for_grammar, desc="Replacing symbols") dataset = dataset.map(replace_symbol_for_grammar, desc="Replacing symbols")
return super().evaluate(prompt, dataset) return super().evaluate(prompt, dataset, parent_histories=parent_histories)
@property @property
def metric_name(self): def metric_name(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment