Unverified Commit 633fb458 authored by Lintang Sutawika's avatar Lintang Sutawika Committed by GitHub
Browse files

Update task.py

parent 4f0a7e57
...@@ -99,13 +99,27 @@ class TaskConfig(dict): ...@@ -99,13 +99,27 @@ class TaskConfig(dict):
if type(self.gold_alias) == str: if type(self.gold_alias) == str:
self.gold_alias = self.template_aliases + self.gold_alias self.gold_alias = self.template_aliases + self.gold_alias
if self.generation_kwargs: if self.generation_kwargs is not None:
assert ( if self.output_type != "greedy_until":
self.output_type == "greedy_until" eval_logger.warning(
), "passed `generation_kwargs`, but not using a generation request type!" "passed `generation_kwargs`, but not using a generation request type!"
elif self.output_type == "greedy_until": )
# ensure that we greedily generate in absence of explicit arguments otherwise
self.generation_kwargs = {"do_sample": False, "temperature": 0.0} if "temperature" in self.generation_kwargs:
self.generation_kwargs["temperature"] = float(
self.generation_kwargs["temperature"]
)
if "until" not in self.generation_kwargs:
self.generation_kwargs["until"] = [self.target_delimiter]
else:
if self.output_type == "greedy_until":
# ensure that we greedily generate in absence of explicit arguments otherwise
self.generation_kwargs = {
"until": None if self.target_delimiter is None else [self.target_delimiter],
"do_sample": False,
"temperature": 0.0,
}
# TODO: how to make TaskConfigs be de- and re-serializable, even when using the !function constructor? # TODO: how to make TaskConfigs be de- and re-serializable, even when using the !function constructor?
......
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