paddlenlp/transformers/gpt/tokenizer.py
def convert_ids_to_string(self, ids):
        """
        Converts a single index or a sequence of indices to texts.

        Args:
            ids (int|List[int]):
                The token id (or token ids) to be converted to text.

        Returns:
            str: The decoded text.

        Example:
            .. code-block::

                from paddlenlp.transformers import GPTTokenizer
                tokenizer = GPTTokenizer.from_pretrained('gpt2-medium-en')
                print(tokenizer.convert_ids_to_string(tokenizer.convert_ids_to_string([14618, 284, 779, 350, 37382, 47, 37382, 290, 350, 37382, 45, 19930]))
                # 'Welcome to use PaddlePaddle and PaddleNLP'

        """

        text = ''.join([self.decoder[id] for id in ids])
        text = bytearray([self.byte_decoder[c] for c in text]).decode(
            'utf-8', errors=self.errors)
        return text

        Converts a single index or a sequence of indices to texts.

        Args:
            ids (int|List[int]):
                The token id (or token ids) to be converted to text.

        Returns:
            str: The decoded text.

        Example:
            .. code-block::

                from paddlenlp.transformers import GPTTokenizer
                tokenizer = GPTTokenizer.from_pretrained('gpt2-medium-en')
                print(tokenizer.convert_ids_to_string(tokenizer.convert_ids_to_string([14618, 284, 779, 350, 37382, 47, 37382, 290, 350, 37382, 45, 19930]))
                # 'Welcome to use PaddlePaddle and PaddleNLP'

        
Converts a single index or a sequence of indices to texts.
Converts a single index or a sequence of indices to texts .
def convert_ids_to_string(self, ids):
        text = ''.join([self.decoder[id] for id in ids])
        text = bytearray([self.byte_decoder[c] for c in text]).decode(
            'utf-8', errors=self.errors)
        return text
def convert_ids_to_string ( self , ids ) : text = '' . join ( [ self . decoder [ id ] for id in ids ] ) text = bytearray ( [ self . byte_decoder [ c ] for c in text ] ) . decode ( 'utf-8' , errors = self . errors ) return text
Converts a single index or a sequence of indices to texts.
Converts a single index or a sequence of indices to texts .
"""
        Converts a single index or a sequence of indices to texts.

        Args:
            ids (int|List[int]):
                The token id (or token ids) to be converted to text.

        Returns:
            str: The decoded text.

        Example:
            .. code-block::

                from paddlenlp.transformers import GPTTokenizer
                tokenizer = GPTTokenizer.from_pretrained('gpt2-medium-en')
                print(tokenizer.convert_ids_to_string(tokenizer.convert_ids_to_string([14618, 284, 779, 350, 37382, 47, 37382, 290, 350, 37382, 45, 19930]))
                # 'Welcome to use PaddlePaddle and PaddleNLP'

        """
The decoded text.
The decoded text .
str
self
ids
The token id (or token ids) to be converted to text.
The token id ( or token ids ) to be converted to text .
examples
code-block:.

from paddlenlp.transformers import GPTTokenizer
tokenizer = GPTTokenizer.from_pretrained('gpt2-medium-en')
print(tokenizer.convert_ids_to_string(tokenizer.convert_ids_to_string([14618, 284, 779, 350, 37382, 47, 37382, 290, 350, 37382, 45, 19930]))
'Welcome to use PaddlePaddle and PaddleNLP'
code - block : . from paddlenlp . transformers import GPTTokenizer tokenizer = GPTTokenizer . from_pretrained ( ' gpt2 - medium - en ' ) print ( tokenizer . convert_ids_to_string ( tokenizer . convert_ids_to_string ( [ 14618 284 779 350 37382 47 37382 290 350 37382 45 19930 ] )) ' Welcome to use PaddlePaddle and PaddleNLP '