feat(tokenization): add optional gigatoken tokenizer backend - #3603
Open
aminehd wants to merge 1 commit into
Open
feat(tokenization): add optional gigatoken tokenizer backend#3603aminehd wants to merge 1 commit into
aminehd wants to merge 1 commit into
Conversation
Contributor
|
/ok to test 3dc0ebc |
Add an optional, additive gigatoken tokenizer backend for issue NVIDIA-NeMo#3177. gigatoken is a Rust BPE tokenizer whose .as_hf() mode yields token IDs identical to the source HuggingFace tokenizer, accelerating the plain-text tokenization path. The backend is guarded by safe_import so it is a no-op when gigatoken is not installed, and it is not yet wired into NeMoAutoTokenizer dispatch. Includes a gigatoken optional-dependency group and unit tests covering availability, the HF-fallback path, wrapping, and ID parity against the HF tokenizer. Signed-off-by: Amineh Dadsetan <amineh.dadsetan@gmail.com>
aminehd
force-pushed
the
aminehd/feat/gigatoken-backend
branch
from
August 21, 2026 15:22
3dc0ebc to
5655e95
Compare
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.
What
Adds an optional gigatoken tokenizer backend, addressing #3177. gigatoken is a Rust BPE tokenizer whose
.as_hf()compatibility mode produces token IDs identical to the source HuggingFace tokenizer, so it can accelerate the plain-text tokenization path.Scope
This is an additive, opt-in base backend — it is not yet wired into
NeMoAutoTokenizerdispatch, so it changes no existing behavior:nemo_automodel/_transformers/tokenization/gigatoken.py—is_available()andbuild_gigatoken_tokenizer(hf_tokenizer), guarded bysafe_importso it is a no-op when gigatoken is not installed.gigatokenoptional-dependency group inpyproject.toml.Notes / open questions
gigatoken is BPE-only (no SentencePiece/WordPiece) and its
.as_hf()does not implementapply_chat_template. Before wiring it into dispatch end-to-end, a few design questions remain — chat/SFT template coverage, bulkencode_filesvs. per-sample drop-in, and the interface (ause_gigatokenflag vs. a config option). Happy to follow up in a subsequent PR once the interface is settled.