return"Label for the relevant action: Sentences describing the context, with an incomplete sentence trailing\nanswer that plausibly completes the situation."
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):
returndoc['activity_label']+': '+doc['ctx']+'\n'
...
...
@@ -46,26 +47,29 @@ class HellaSwag(HFTask):
elifletter_answer=='3':
index=3
else:
raiseValueError("HellaSwag from HF datasets contained an invalid answer key")
raiseValueError(
"HellaSwag from HF datasets contained an invalid answer key")
returndoc['endings'][index]
defconstruct_requests(self,doc,ctx):
""" Uses RequestFactory to construct Requests and returns an iterable of
""" Uses RequestFactory to construct Requests and returns an iterable of
Requests which will be sent to the LM.
:param doc:
The document as returned from training_docs, validation_docs, or test_docs.
:param ctx: str
The context string, generated by fewshot_context. This includes the natural
The context string, generated by fewshot_context. This includes the natural
language description, as well as the few shot examples, and the question
part of the document for `doc`.
part of the document for `doc`.
"""
# TODO: implement evaluation.
raiseNotImplementedError('Evaluation not implemented')