Generate completion from a list of templates. Args: templates (List[PromptType]): A list of templates. max_out_len (int): The maximum length of the output.
(self, templates: List[PromptType],
max_out_len: int, **kwargs)
| 188 | return self.get_ppl_tokenwise(inputs, label, mask_length) |
| 189 | |
| 190 | def generate_from_template(self, templates: List[PromptType], |
| 191 | max_out_len: int, **kwargs): |
| 192 | """Generate completion from a list of templates. |
| 193 | |
| 194 | Args: |
| 195 | templates (List[PromptType]): A list of templates. |
| 196 | max_out_len (int): The maximum length of the output. |
| 197 | """ |
| 198 | inputs = self.parse_template(templates, mode='gen') |
| 199 | if hasattr(self, 'sync_rank') and self.sync_rank: |
| 200 | inputs = self.sync_inputs(inputs) |
| 201 | return self.generate(inputs, max_out_len=max_out_len, **kwargs) |
| 202 | |
| 203 | def get_token_len_from_template( |
| 204 | self, |