feat: Add HuggingFace-style skip_special_tokens and batch_decode support (#403)#1186
Open
lakshitsoni26 wants to merge 2 commits into
Open
Conversation
Collaborator
|
@lakshitsoni26 so there are some risks here, and decisions to be made, it's not a 'zero regression' case... there's also some shifting ground re other significant additions (e.g. #2713) so am going to defer tokenizer cleanup until a bit later |
Author
|
Understood! Thanks for taking a look. I'll leave this PR open for now — just ping me whenever the dust settles on #2713 and you are ready to revisit the tokenizer cleanup. Happy to update this PR to resolve any conflicts then! |
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.
batch_decode,skip_special_tokens, andclean_up_tokenization_spacesto the tokenizer API.clean_up_tokenizationhelper to exactly mimic HuggingFace's internal string-cleaning logic (stripping spurious spaces before punctuation).batch_decodeand the new decoding arguments toSimpleTokenizerandTikTokenTokenizer.HFTokenizerandSigLipTokenizer.SimpleTokenizer.tests/test_tokenizer_decode.pycovering all tokenizer variants (100% test coverage for the new features).Falseacross all signatures.