-
Notifications
You must be signed in to change notification settings - Fork 994
Implement Append normalizer #1755
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
base: main
Are you sure you want to change the base?
Conversation
ArthurZucker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind adding a new normalizers, but do you have example of real usecases? Like papers or blogs or something?
|
This normalizer is very useful when used in conjunction with the
@ArthurZucker Yes—this feature comes directly from my PhD research. I use the To address this, I developed a tokenization scheme that encodes the whitespace following each move as a sort of non-promotion token. The promotion-related token set becomes Publications for reference:
|
ArthurZucker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow sorry for the delay! just missing a .py test and good for me
|
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. |
Implement Append Normalizer
Description
This pull request introduces a new
Appendnormalizer to the HuggingFace Tokenizers library. TheAppendnormalizer adds a specified string to the end of input sequences. Its functionality mirrors the existingPrependnormalizer, except that it appends text rather than prepending it.Motivation
There are use-cases where appending a token or specific character to the end of token sequences is beneficial, particularly when working with special formatting or language modeling tasks. This addition complements the existing functionality and extends the flexibility of the normalization utilities.
Changes Implemented
Appendanalogous to the existingPrepend.normalizemethod to append text to the end of the input.Testing
Unit tests have been added, verifying:
Example Usage
Please let me know if there are additional requirements or improvements needed!