paddlenlp/taskflow/text_generation.py
def _postprocess(self, inputs):
        """
        The model output is tag ids, this function will convert the model output to raw text.
        """
        batch_out = []
        preds = inputs['results']
        for index in range(0, len(preds)):
            seq_len = inputs['lens'][index]
            single_result = {}
            single_result['text'] = inputs['text'][index]
            single_result['answer'] = self._tokenizer.convert_ids_to_string(
                preds[index][seq_len:-1])
            batch_out.append(single_result)
        return batch_out

        The model output is tag ids, this function will convert the model output to raw text.
        
The model output is tag ids, this function will convert the model output to raw text.
The model output is tag ids this function will convert the model output to raw text .
def _postprocess(self, inputs):
        batch_out = []
        preds = inputs['results']
        for index in range(0, len(preds)):
            seq_len = inputs['lens'][index]
            single_result = {}
            single_result['text'] = inputs['text'][index]
            single_result['answer'] = self._tokenizer.convert_ids_to_string(
                preds[index][seq_len:-1])
            batch_out.append(single_result)
        return batch_out
def _postprocess ( self , inputs ) : batch_out = [ ] preds = inputs [ 'results' ] for index in range ( 0 , len ( preds ) ) : seq_len = inputs [ 'lens' ] [ index ] single_result = { } single_result [ 'text' ] = inputs [ 'text' ] [ index ] single_result [ 'answer' ] = self . _tokenizer . convert_ids_to_string ( preds [ index ] [ seq_len : - 1 ] ) batch_out . append ( single_result ) return batch_out
The model output is tag ids, this function will convert the model output to raw text.
The model output is tag ids this function will convert the model output to raw text .
"""
        The model output is tag ids, this function will convert the model output to raw text.
        """
self
inputs