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

The inferenced text has a leading space because of the vocab #41

Closed
Zardinality opened this issue Jul 24, 2023 · 3 comments
Closed

The inferenced text has a leading space because of the vocab #41

Zardinality opened this issue Jul 24, 2023 · 3 comments

Comments

@Zardinality
Copy link

Debugged to the first token emerged:

image

And confirmed by using python model directly:

image

Clearly the tokenizer model count ▁Once instead of Once as a token. Note that sentencepiece use ▁ as space.

@karpathy
Copy link
Owner

Yes, the vocab itself has this space. But somehow when you ask sentencepiece to decode a token sequence, it doesn't print this leading space.

@Zardinality
Copy link
Author

I am not familiar with the tokenizer common practices, but seems there it has a patch for such scenario in decoding: https://github.com/google/sentencepiece/blob/master/src/sentencepiece_processor.cc#L788 . Might have a good reason to do so.

@karpathy
Copy link
Owner

This was fixed while back

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

2 participants