Commit d674c7bd authored by Benjamin Fattori's avatar Benjamin Fattori
Browse files

winogrande task implemented

parent d9802303
def partial_context(doc, option):
# Substitute the pronoun in the sentence with the specified option
# and ignore everything after.
pronoun_loc = doc["sentence"].index("_")
return doc["sentence"][:pronoun_loc] + option
def partial_target(doc):
# The target is everything after the document specified pronoun.
pronoun_loc = doc["sentence"].index("_") + 1
return doc["sentence"][pronoun_loc:].strip()
def create_choices(doc):
choices = []
for option in [doc["option1"], doc["option2"]]:
partial_ctx = partial_context(doc, option)
choices.append(partial_ctx)
return choices
def gold_alias(doc):
answer_to_num = {"1": 0, "2": 1}
return answer_to_num[doc['answer']]
\ No newline at end of file
task: winogrande
dataset_path: winogrande
dataset_name: winogrande_xl
output_type: winograd_schema
training_split: train
validation_split: validation
doc_to_target: !function preprocess_winogrande.partial_target
doc_to_text: "{{sentence}}"
create_choices: !function preprocess_winogrande.create_choices
gold_alias: !function preprocess_winogrande.gold_alias
metric_list:
- metric: acc
aggregation: mean
higher_is_better: true
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