Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add qa template exact output #1674

Merged
merged 14 commits into from
Mar 12, 2025
15 changes: 15 additions & 0 deletions prepare/templates/qa/multiple_choice/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,21 @@
overwrite=True,
)

add_to_catalog(
MultipleChoiceTemplate(
input_format="Answer the following multiple choice question based on the {context_type}. Answer only and exactly with one of the following: {numerals}.\nContext:\n{context}\nQuestion:\n{question}\nChoices:\n{choices}",
target_prefix="Answer:\n",
target_field="answer",
choices_separator="\n",
postprocessors=["processors.to_string_stripped"],
title_fields=["context_type"],
),
"templates.qa.multiple_choice.with_context.exact_answer_instruct",
overwrite=True,
)




def remove_duplicates(input_list):
seen = set()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"__type__": "multiple_choice_template",
"input_format": "Answer the following multiple choice question based on the {context_type}. Answer only and exactly with one of the following: {numerals}.\nContext:\n{context}\nQuestion:\n{question}\nChoices:\n{choices}",
"target_prefix": "Answer:\n",
"target_field": "answer",
"choices_separator": "\n",
"postprocessors": [
"processors.to_string_stripped"
],
"title_fields": [
"context_type"
]
}
Loading