Fix bytelevel decode of added tokens + 27x faster deserialization#1995
Open
ArthurZucker wants to merge 10 commits intomainfrom
Open
Fix bytelevel decode of added tokens + 27x faster deserialization#1995ArthurZucker wants to merge 10 commits intomainfrom
ArthurZucker wants to merge 10 commits intomainfrom
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
8 tasks
ArthurZucker
commented
Mar 27, 2026
| print(tokenizer.get_added_tokens_decoder()) | ||
| enc = tokenizer.encode(new_tokens[0].content + new_tokens[1].content + " " + new_tokens[2].content) | ||
| print(enc) | ||
| assert tokenizer.decode(enc.ids, False) == 'Za\rnimokućameđa' |
Collaborator
Author
There was a problem hiding this comment.
the 1st has normalized false -> broken but the next 2 are properly re-constructed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Todo: check if normalizer ByteLevel vs PreTokenizer which is better?
mains vs this branch
daahorse just insane here.
gains mostly on non-special (probably because default is non special == normalize)
Also previously every
add_tokenscall renormalized the entire vocab to build the regex, now it only normalizes what's new. This can be wrong if normalizer changes tho. We could "guard" against this by updating tokenizer.normalizer setter to refresh added tokens.