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

IndexError: piece id is out of range. #1854

Open
kydxh opened this issue Mar 17, 2025 · 0 comments
Open

IndexError: piece id is out of range. #1854

kydxh opened this issue Mar 17, 2025 · 0 comments

Comments

@kydxh
Copy link

kydxh commented Mar 17, 2025

I want to inference llava v1.5, but encountered error "IndexError: piece id is out of range". The environment I used is "llava 1.1.3, transformers 4.31.0, sentencepiece 0.1.99, torch 2.0.1"
The detailed error information is listed as follows:
output = self.tokenizer.batch_decode(output_ids, skip_special_tokens=True)[
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3485, in batch_decode
return [
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3486, in
self.decode(
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3525, in decode
return self._decode(
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/transformers/tokenization_utils.py", line 931, in _decode
filtered_tokens = self.convert_ids_to_tokens(token_ids, skip_special_tokens=skip_special_tokens)
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/transformers/tokenization_utils.py", line 912, in convert_ids_to_tokens
tokens.append(self._convert_id_to_token(index))
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/transformers/models/llama/tokenization_llama.py", line 204, in _convert_id_to_token
token = self.sp_model.IdToPiece(index)
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/sentencepiece/init.py", line 1045, in _batched_func
return _func(self, arg)
File "/root/anaconda3/envs/llava16/lib/python3.10/site-packages/sentencepiece/init.py", line 1038, in _func
raise IndexError('piece id is out of range.')
How can I solve the problem?

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

1 participant