in src/models/struxgpt_v2.py [0:0]
def batch_forward(self, text_list: List[str], return_json=True, **kwargs):
prompt_list, sentences_str_list = \
zip(*[self.prepare_prompt(text, return_sentences_str=True, **kwargs) for text in text_list])
maxOutputLength = kwargs.pop('maxOutputLength', self.max_output_length)
response_list = self.call_model(prompt_list, batched=True, maxOutputLength=maxOutputLength,
**kwargs)
struct_res_list = [StructItem(self.scfg, sentences_str, response) \
for sentences_str, response in zip(sentences_str_list, response_list)]
if return_json:
return zip(*[[struct_res.valid, struct_res.dict] for struct_res in struct_res_list])
else:
return struct_res_list