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

Duplicate Token <s> in Tokenizer Encoded Token ids #2899

Closed
zxybazh opened this issue Feb 17, 2024 · 3 comments
Closed

Duplicate Token <s> in Tokenizer Encoded Token ids #2899

zxybazh opened this issue Feb 17, 2024 · 3 comments
Labels
usage How to use vllm

Comments

@zxybazh
Copy link

zxybazh commented Feb 17, 2024

When working on tokenizer result for llama-2-7b-chat-hf model, I noticed that the prompt_token_ids generated in this place would generate an extra token <s> in the beginning of the sentence.

For example for the follow prompt <s>[INST] what is the color of the snow? [/INST] , hf tokenizer can directly tokenize it to

['<s>', '▁[', 'INST', ']', '▁what', '▁is', '▁the', '▁color', '▁of', '▁the', '▁snow', '?', '▁[', '/', 'INST', ']']
[1, 518, 25580, 29962, 825, 338, 278, 2927, 310, 278, 15007, 29973, 518, 29914, 25580, 29962]

but for the very same prompt vllm would generate tokenized prompt ids as follows

[1, 1, 518, 25580, 29962, 825, 338, 278, 2927, 310, 278, 15007, 29973, 518, 29914, 25580, 29962]

which has an extra token 1, aka <s> in the beginning.

Looking forward to have someone help me confirm if this is designated behaviour or caused by some of the model options.

@DarkLight1337 DarkLight1337 added the usage How to use vllm label May 31, 2024
@CatherineSue
Copy link
Contributor

I think this is because in llama2-7b-chat-hf's tokenizer_config.json, it sets add_bos_token to true.

@zxybazh
Copy link
Author

zxybazh commented Jun 4, 2024

Thanks for the clarification, in that case it should be designated behaviour.

@zxybazh zxybazh closed this as completed Jun 4, 2024
@CatherineSue
Copy link
Contributor

CatherineSue commented Jun 4, 2024

a fix is merged #4688

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

No branches or pull requests

3 participants