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

Method _process_doc

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

Source from the content-addressed store, hash-verified

52 return map(self._process_doc, self.dataset["test"])
53
54 def _process_doc(self, doc):
55 # NOTE: Some `doc["answerKey"]`s are in numeric string format being one
56 # of {'1', '2', '3', '4', '5'}. We map them back to letters.
57 num_to_letter = {"1": "A", "2": "B", "3": "C", "4": "D", "5": "E"}
58 doc["answerKey"] = num_to_letter.get(doc["answerKey"], doc["answerKey"])
59 out_doc = {
60 "id": doc["id"],
61 "query": "Question: " + doc["question"] + "\nAnswer:",
62 "choices": doc["choices"]["text"],
63 "gold": ["A", "B", "C", "D", "E"].index(doc["answerKey"]),
64 }
65 return out_doc
66
67 def doc_to_text(self, doc):
68 return doc["query"]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected