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

Method construct_requests

test/general/lm_eval/tasks/anli.py:86–100  ·  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

84 return " " + ["True", "Neither", "False"][doc["label"]]
85
86 def construct_requests(self, doc, ctx):
87 """Uses RequestFactory to construct Requests and returns an iterable of
88 Requests which will be sent to the LM.
89
90 :param doc:
91 The document as returned from training_docs, validation_docs, or test_docs.
92 :param ctx: str
93 The context string, generated by fewshot_context. This includes the natural
94 language description, as well as the few shot examples, and the question
95 part of the document for `doc`.
96 """
97 ll_true, _ = rf.loglikelihood(ctx, " True")
98 ll_neither, _ = rf.loglikelihood(ctx, " Neither")
99 ll_false, _ = rf.loglikelihood(ctx, " False")
100 return ll_true, ll_neither, ll_false
101
102 def process_results(self, doc, results):
103 """Take a single document and the LM results and evaluates, returning a

Callers

nothing calls this directly

Calls 1

loglikelihoodMethod · 0.45

Tested by

no test coverage detected