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

"Qwen2Tokenizer" cannot encode some words correctly #199

Closed
Line290 opened this issue Mar 22, 2024 · 3 comments
Closed

"Qwen2Tokenizer" cannot encode some words correctly #199

Line290 opened this issue Mar 22, 2024 · 3 comments

Comments

@Line290
Copy link

Line290 commented Mar 22, 2024

Below is the BUG:
transformers==4.37.1

t = AutoTokenizer.from_pretrained("Qwen1.5-72B-Chat", trust_remote_code=True, use_fast=False)
t_fast = AutoTokenizer.from_pretrained("Qwen1.5-72B-Chat", trust_remote_code=True, use_fast=True)

t.encode("#######")
# Out: [2, 2, 2, 2, 2, 2, 2]

t_fast.encode("#######")
# Out: [97864]

There are 120+ words in the vocabulary with the same BUG.

@jklj077
Copy link
Collaborator

jklj077 commented Mar 22, 2024

For the issues related to "#" in the slow tokenizer (Qwen2Tokenizer), please try this branch and see if the problem could be fixed. There should be 121 tokens affected by this.

@Line290
Copy link
Author

Line290 commented Mar 25, 2024

It was fixed after I followed your branch and modified the code at here. Thank you.

Copy link

github-actions bot commented Mar 8, 2025

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants