MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / doc_to_text

Method doc_to_text

test/general/lm_eval/tasks/coqa.py:54–64  ·  view source on GitHub ↗
(self, doc)

Source from the content-addressed store, hash-verified

52 pass
53
54 def doc_to_text(self, doc):
55 # Given a passage p, the conversation history {q1, a1, . . . qi−1, ai−1}
56 # and a question qi, the task is to predict the answer ai
57 doc_text = doc["story"] + "\n\n"
58 for (q, a) in zip_longest(
59 doc["questions"]["input_text"], doc["answers"]["input_text"][:-1]
60 ): # omit target answer ai
61 question = f"Q: {q}\n\n"
62 answer = f"A: {a}\n\n" if a is not None else "A:"
63 doc_text += question + answer
64 return doc_text
65
66 def should_decontaminate(self):
67 return True

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected