Unverified Commit d1ef37aa authored by Leo Gao's avatar Leo Gao Committed by GitHub
Browse files

Merge pull request #163 from jon-tow/logiqa-prompt-fix

Fix `LogiQA` prompts
parents 8809c5f1 aadf2f41
...@@ -30,10 +30,27 @@ class LogiQA(MultipleChoiceTask): ...@@ -30,10 +30,27 @@ class LogiQA(MultipleChoiceTask):
return True return True
def _convert_standard(self, doc): def _convert_standard(self, doc):
def format_example(doc, choices):
"""
Passage: <passage>
Question: <question>
A. <choice1>
B. <choice2>
C. <choice3>
D. <choice4>
Answer:
"""
prompt = "Passage: " + doc["passage"] + "\n"
prompt += "Question: " + doc["question"] + "\n"
for choice, option in zip(choices, doc["options"]):
prompt += f"{choice.upper()}. {option}\n"
prompt += "Answer:"
return prompt
choices = ['a', 'b', 'c', 'd']
return { return {
"query": "Passage: " + doc["passage"] + "\nQuestion: " + doc["question"] + "\nAnswer:", "query": format_example(doc, choices),
"choices": doc["options"], "choices": doc["options"],
"gold": ["a", "b", "c", "d"].index(doc["answerKey"]) "gold": choices.index(doc["answerKey"])
} }
def _load_docs(self, filename): def _load_docs(self, filename):
......
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