src/transformers/pipelines/text2text_generation.py/Text2TextGenerationPipeline/postprocess
class Text2TextGenerationPipeline:    def postprocess(self, model_outputs, return_type=ReturnType.TEXT, clean_up_tokenization_spaces=False):
        record = {}
        if return_type == ReturnType.TENSORS:
            record = {f"{self.return_name}_token_ids": model_outputs}
        elif return_type == ReturnType.TEXT:
            record = {
                f"{self.return_name}_text": self.tokenizer.decode(
                    model_outputs["output_ids"][0],
                    skip_special_tokens=True,
                    clean_up_tokenization_spaces=clean_up_tokenization_spaces,
                )
            }
        return record