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

[WIP] Add a dedicated tokenizer for byte level transformers #36216

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

apehex
Copy link

@apehex apehex commented Feb 15, 2025

What does this PR do?

This is a simple implementation of a byte tokenizer.
It is useful for models like the recent BLT from Meta.

It accepts all the encoding schemes from the built-in encode function of the standard library.
In particular, "UTF-32-BE" is useful since it allows to use fixed size patching for the bytes.

The class doesn't use a vocabulary, but I still kept the usual methods for compatibility.

Worth noting is that the special tokens use the legacy codepoints built-in Unicode.
For example the mask token is "\u001a", which is the "substitute" codepoint.
See the Unicode table.

Fixes #36202

@apehex
Copy link
Author

apehex commented Feb 15, 2025

I've written tests but I'm not sure where I should place them.
Same goes for the actual implementation.

Where do you want them, if anywhere? @ArthurZucker

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

Successfully merging this pull request may close these issues.

Dedicated tokenizer for byte level transformers
1 participant