MCPcopy Create free account
hub / github.com/InternScience/SciReason / generate_from_template

Method generate_from_template

opencompass/models/base.py:190–201  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers 14

test_modelFunction · 0.80
chatMethod · 0.80
chatMethod · 0.80
chatMethod · 0.80
get_valueMethod · 0.80
get_votesMethod · 0.80
get_proposalsMethod · 0.80
get_samplesMethod · 0.80
inferenceMethod · 0.80
predictMethod · 0.80
infer_lastMethod · 0.80
infer_everyMethod · 0.80

Calls 3

parse_templateMethod · 0.95
sync_inputsMethod · 0.95
generateMethod · 0.95

Tested by 1

test_modelFunction · 0.64