Commit 8a0ce59d authored by Konrad's avatar Konrad
Browse files

added comments

parent d01032d2
...@@ -1054,8 +1054,10 @@ class ConfigurableTask(Task): ...@@ -1054,8 +1054,10 @@ class ConfigurableTask(Task):
if not self.multiple_input: if not self.multiple_input:
if isinstance(example, str): if isinstance(example, str):
labeled_examples.append({"role": "user", "content": example}) labeled_examples.append({"role": "user", "content": example})
# for loglikelihood create a list of questions with appended choices
elif isinstance(example, list): elif isinstance(example, list):
labeled_examples_list = [] labeled_examples_list = []
# copy chat history for each example and append the answer
for ex in example: for ex in example:
chat = deepcopy(labeled_examples) chat = deepcopy(labeled_examples)
chat.append({"role": "user", "content": ex}) chat.append({"role": "user", "content": ex})
...@@ -1063,6 +1065,7 @@ class ConfigurableTask(Task): ...@@ -1063,6 +1065,7 @@ class ConfigurableTask(Task):
self.convert_chat_history_to_string(chat, tokenizer) self.convert_chat_history_to_string(chat, tokenizer)
) )
return labeled_examples_list return labeled_examples_list
# if example is an integer, append the choice or convert to string
elif isinstance(example, int): elif isinstance(example, int):
if self.config.doc_to_choice is not None: if self.config.doc_to_choice is not None:
choices = self.doc_to_choice(doc) choices = self.doc_to_choice(doc)
......
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