MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / doc_to_text

Method doc_to_text

lm-eval-harness/lm_eval/tasks/based_fda/task.py:28–38  ·  view source on GitHub ↗
(self, doc)

Source from the content-addressed store, hash-verified

26 return self.dataset["validation"]
27
28 def doc_to_text(self, doc):
29 question = doc["key"]+":"
30 while(doc["text"].lower().endswith(question.lower())):
31 doc["text"] = doc["text"][:-len(question)]
32 upper_key = doc['key'][0].upper() + doc['key'][1:]
33 question = upper_key +":"
34 doc['text'] = doc['text'].strip("\n").strip(".")
35 out = doc["text"]
36 if not out.endswith("."): out += "."
37 out += " " + question
38 return out
39
40 def doc_to_target(self, doc):
41 return doc["value"]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected