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)
| 126 | return " " + self.get_answer_option(self.last_problem(doc)) |
| 127 | |
| 128 | def construct_requests(self, doc, ctx): |
| 129 | """Uses RequestFactory to construct Requests and returns an iterable of |
| 130 | Requests which will be sent to the LM. |
| 131 | |
| 132 | :param doc: |
| 133 | The document as returned from training_docs, validation_docs, or test_docs. |
| 134 | :param ctx: str |
| 135 | The context string, generated by fewshot_context. This includes the natural |
| 136 | language description, as well as the few shot examples, and the question |
| 137 | part of the document for `doc`. |
| 138 | """ |
| 139 | problem = self.last_problem(doc) |
| 140 | ll_choices = [ |
| 141 | rf.loglikelihood(ctx, " " + problem["options"][i])[0] for i in range(4) |
| 142 | ] |
| 143 | return ll_choices |
| 144 | |
| 145 | def process_results(self, doc, results): |
| 146 | """Take a single document and the LM results and evaluates, returning a |
nothing calls this directly
no test coverage detected