Merge branch 'xlnet' into embeddings

This commit is contained in:
Thomas Wolf 2019-07-12 11:10:14 +02:00 committed by GitHub
commit c57e9d946f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,11 +177,11 @@ class GPT2Tokenizer(PreTrainedTokenizer):
def _convert_token_to_id(self, token):
""" Converts a token (str/unicode) in an id using the vocab. """
return self.encoder.get(token, self.encoder.get(self.unk_token))
return self.encoder.get(token)
def _convert_id_to_token(self, index):
"""Converts an index (integer) in a token (string/unicode) using the vocab."""
return self.decoder.get(index, self.unk_token)
return self.decoder.get(index)
def _convert_ids_to_string(self, tokens_ids):
"""Converts a sequence of ids in a string."""