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, **kwargs)
| 41 | return doc["value"] |
| 42 | |
| 43 | def construct_requests(self, doc, ctx, **kwargs): |
| 44 | """Uses RequestFactory to construct Requests and returns an iterable of |
| 45 | Requests which will be sent to the LM. |
| 46 | |
| 47 | :param doc: |
| 48 | The document as returned from training_docs, validation_docs, or test_docs. |
| 49 | :param ctx: str |
| 50 | The context string, generated by fewshot_context. This includes the natural |
| 51 | language description, as well as the few shot examples, and the question |
| 52 | part of the document for `doc`. |
| 53 | """ |
| 54 | |
| 55 | return [ |
| 56 | Instance( |
| 57 | request_type="generate_until", |
| 58 | doc=doc, |
| 59 | arguments=(ctx, {"until": ["\n"], "max_gen_toks": 48}), |
| 60 | idx=0, |
| 61 | **kwargs, |
| 62 | ), |
| 63 | ] |
| 64 | |
| 65 | def process_results(self, doc, results): |
| 66 | """Take a single document and the LM results and evaluates, returning a |