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

Method construct_requests

test/general/lm_eval/tasks/xnli.py:98–115  ·  view source on GitHub ↗

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 fewsho

(self, doc, ctx)

Source from the content-addressed store, hash-verified

96 return prompt.replace("[MASK]", self.doc_to_target(doc)[1:])
97
98 def construct_requests(self, doc, ctx):
99 """Uses RequestFactory to construct Requests and returns an iterable of
100 Requests which will be sent to the LM.
101
102 :param doc:
103 The document as returned from training_docs, validation_docs, or test_docs.
104 :param ctx: str
105 The context string, generated by fewshot_context. This includes the natural
106 language description, as well as the few shot examples, and the question
107 part of the document for `doc`.
108 """
109 ll_true = rf.loglikelihood_rolling(ctx.replace("[MASK]", self.ENTAILMENT_LABEL))
110 ll_neither = rf.loglikelihood_rolling(ctx.replace("[MASK]", self.NEUTRAL_LABEL))
111 ll_false = rf.loglikelihood_rolling(
112 ctx.replace("[MASK]", self.CONTRADICTION_LABEL)
113 )
114
115 return ll_true, ll_neither, ll_false
116
117 def process_results(self, doc, results):
118 """Take a single document and the LM results and evaluates, returning a

Callers

nothing calls this directly

Calls 1

loglikelihood_rollingMethod · 0.45

Tested by

no test coverage detected