You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
text = self.tokenizer.convert_ids_to_tokens(token_list)
File "/home/lambda/repos/pytorch-transformers/pytorch_transformers/tokenization_utils.py", line 444, in convert_ids_to_tokens
tokens.append(self._convert_id_to_token(index))
File "/home/lambda/repos/pytorch-transformers/pytorch_transformers/tokenization_xlnet.py", line 170, in _convert_id_to_token
token = self.sp_model.IdToPiece(index)
File "/home/lambda/python-envs/research/lib/python3.6/site-packages/sentencepiece.py", line 187, in IdToPiece
return _sentencepiece.SentencePieceProcessor_IdToPiece(self, id)
TypeError: in method 'SentencePieceProcessor_IdToPiece', argument 2 of type 'int'
I find that if I explicitly convert ids to integers it works fine. In tokenization_xlnet.py
def _convert_id_to_token(self, index, return_unicode=True):
"""Converts an index (integer) in a token (string/unicode) using the vocab."""
token = self.sp_model.IdToPiece(int(index))
if six.PY2 and return_unicode and isinstance(token, str):
token = token.decode('utf-8')
return token
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I find that if I explicitly convert ids to integers it works fine. In
tokenization_xlnet.py
The text was updated successfully, but these errors were encountered: