Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG/Help] <IndexError: Out of range: piece id is out of range.> #527

Closed
1 task done
Data2Me opened this issue Apr 11, 2023 · 2 comments
Closed
1 task done

[BUG/Help] <IndexError: Out of range: piece id is out of range.> #527

Data2Me opened this issue Apr 11, 2023 · 2 comments

Comments

@Data2Me
Copy link

Data2Me commented Apr 11, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

File "/root/.cache/huggingface/modules/transformers_modules/THUDM/chatglm-6b/aa51e62ddc9c9f334858b0af44cf59b05c70148a/tokenization_chatglm.py", line 268, in _decode
return self.sp_tokenizer.decode(token_ids)
File "/root/.cache/huggingface/modules/transformers_modules/THUDM/chatglm-6b/aa51e62ddc9c9f334858b0af44cf59b05c70148a/tokenization_chatglm.py", line 117, in decode
text = self._get_text_tokenizer().decode(ids)
File "/root/.cache/huggingface/modules/transformers_modules/THUDM/chatglm-6b/aa51e62ddc9c9f334858b0af44cf59b05c70148a/tokenization_chatglm.py", line 29, in decode
return self.sp.DecodeIds(ids)
File "/opt/conda/lib/python3.10/site-packages/sentencepiece/init.py", line 837, in DecodeIds
return self.Decode(input=input, out_type=out_type, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/sentencepiece/init.py", line 780, in Decode
return self._DecodeIds(input)
File "/opt/conda/lib/python3.10/site-packages/sentencepiece/init.py", line 337, in _DecodeIds
return _sentencepiece.SentencePieceProcessor__DecodeIds(self, ids)
IndexError: Out of range: piece id is out of range.

Expected Behavior

No response

Steps To Reproduce

..

Environment

- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :

Anything else?

No response

@duzx16
Copy link
Member

duzx16 commented Apr 12, 2023

Duplicate of #438

@yecphaha
Copy link

参考 https://huggingface.co/THUDM/chatglm3-6b/commit/ea563876364622a0a5c24e6b71db0b93a9861ba0#d2h-069285
在 tokenization_chatglm.py 里新增两行代码
Snipaste_2023-11-21_17-42-58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants