return"Label for the relevant action: Sentences describing the context, with an incomplete sentence trailing\nanswer that plausibly completes the situation."
defdoc_to_text(self,doc,include_target=True):
text=doc['activity_label']+': '+doc['ctx']+'\n'
ifinclude_target:
letter_answer=doc['label']
ifletter_answer=='0':
index=0
elifletter_answer=='1':
index=1
elifletter_answer=='2':
index=2
elifletter_answer=='3':
index=3
else:
raiseValueError("HellaSwag from HF datasets contained an invalid answer key")
text+=doc['endings'][index]
returntext
defdoc_to_text(self,doc):
returndoc['activity_label']+': '+doc['ctx']+'\n'
defdoc_to_target(self,doc):
letter_answer=doc['label']
ifletter_answer=='0':
index=0
elifletter_answer=='1':
index=1
elifletter_answer=='2':
index=2
elifletter_answer=='3':
index=3
else:
raiseValueError("HellaSwag from HF datasets contained an invalid answer key")
return"Title: The_Title_of_It\n\nBackground: A text passage as background to answer the question with.\n\nQ: Question about the passage.\n\nA: Answer."
return"Winograd schema sentence including a either a ___ blank with a missing word, making the pronoun ambiguous, or the same with the word filled in."
defdoc_to_text(self,doc,include_target=True):
defdoc_to_text(self,doc):
returndoc['sentence']
defdoc_to_target(self,doc):
text=doc['sentence']
ifinclude_target:
answer_n=doc['answer']
ifanswer_n=='1':
answer=doc['option1']
elifanswer_n=='2':
answer=doc['option2']
else:
raiseValueError("Winogrande from HF datasets contained an invalid answer key")
text=text.replace("_",answer)
returntext
answer_n=doc['answer']
ifanswer_n=='1':
answer=doc['option1']
elifanswer_n=='2':
answer=doc['option2']
else:
raiseValueError("Winogrande from HF datasets contained an invalid answer key")