"csrc/vscode:/vscode.git/clone" did not exist on "eb66a19d90730601263a7977d1f93f1f43945cde"
Commit 6fc2e148 authored by haileyschoelkopf's avatar haileyschoelkopf
Browse files

revert change to template_aliases

parent e8702f15
...@@ -43,7 +43,7 @@ ALL_OUTPUT_TYPES = [ ...@@ -43,7 +43,7 @@ ALL_OUTPUT_TYPES = [
"multiple_choice", "multiple_choice",
"loglikelihood_rolling", "loglikelihood_rolling",
"greedy_until", "greedy_until",
"winograd_schema" "winograd_schema",
] ]
...@@ -91,7 +91,7 @@ class TaskConfig(dict): ...@@ -91,7 +91,7 @@ class TaskConfig(dict):
# allow user-specified aliases so that users can # allow user-specified aliases so that users can
# force prompt-compatibility for some prompt regardless of # force prompt-compatibility for some prompt regardless of
# field names in prompt # field names in prompt
if type(self.template_aliases) == str: if self.template_aliases:
if type(self.doc_to_text) == str: if type(self.doc_to_text) == str:
self.doc_to_text = self.template_aliases + self.doc_to_text self.doc_to_text = self.template_aliases + self.doc_to_text
...@@ -299,14 +299,14 @@ class Task(abc.ABC): ...@@ -299,14 +299,14 @@ class Task(abc.ABC):
The processed version of the specified `doc`. The processed version of the specified `doc`.
""" """
return doc return doc
def create_choices(self, doc): def create_choices(self, doc):
if self._config.create_choices is None: if self._config.create_choices is None:
return ast.literal_eval( return ast.literal_eval(
utils.apply_template( utils.apply_template(
self._config.template_aliases + "{{answer_choices}}", doc self._config.template_aliases + "{{answer_choices}}", doc
) )
) )
elif type(self._config.create_choices) == str: elif type(self._config.create_choices) == str:
return utils.apply_template(self._config.create_choices, doc) return utils.apply_template(self._config.create_choices, doc)
else: else:
...@@ -743,7 +743,7 @@ class ConfigurableTask(Task): ...@@ -743,7 +743,7 @@ class ConfigurableTask(Task):
# we pass the user-defined answer_choices var (in aliases) and translate the result to a Python list. # we pass the user-defined answer_choices var (in aliases) and translate the result to a Python list.
# TODO: any cleaner way to do this? # TODO: any cleaner way to do this?
choices = self.create_choices(doc) choices = self.create_choices(doc)
request_list = [ request_list = [
Instance( Instance(
request_type="loglikelihood", request_type="loglikelihood",
...@@ -785,7 +785,7 @@ class ConfigurableTask(Task): ...@@ -785,7 +785,7 @@ class ConfigurableTask(Task):
contexts = self.create_choices(doc) contexts = self.create_choices(doc)
choice = self.doc_to_target(doc) choice = self.doc_to_target(doc)
request_list = [ request_list = [
Instance( Instance(
request_type="loglikelihood", request_type="loglikelihood",
...@@ -796,7 +796,7 @@ class ConfigurableTask(Task): ...@@ -796,7 +796,7 @@ class ConfigurableTask(Task):
) )
for i, context in enumerate(contexts) for i, context in enumerate(contexts)
] ]
return request_list return request_list
return Instance( return Instance(
......
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