Repository navigation
Chenshuz/gigatoken integration - #8294
Open
jupiterepoch wants to merge 3 commits into
Open
jupiterepoch wants to merge 3 commits into
jupiterepoch wants to merge 3 commits into
Conversation
svcnvidia-nemo-ci
marked this pull request as draft
October 16, 2026 17:25
Contributor
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
jupiterepoch
marked this pull request as ready for review
October 16, 2026 18:30
jupiterepoch
force-pushed
the
chenshuz/gigatoken-integration
branch
from
October 16, 2026 18:42
98bcf3d to
ceffc7f
Compare
Wrap the existing Gigatoken factory in an HF fast-tokenizer adapter so chat serving retains template rendering, metadata and streaming decoding. Keep HF call options and return types, with HF handling unsupported encoding requests. Rebuild native encoders when serving workers copy or serialize the tokenizer. Support split_special_tokens through the same call interface and extend the existing tokenizer tests. Signed-off-by: Chenshu Zhu <chenshuz@nvidia.com>
Keep compatible text on Gigatoken, with an ASCII fast check. Route the whole input or batch through HF when it contains a character classified differently by Gigatoken's Unicode 17 tables and HF's Unicode 16 regex. Checking the rendered text also covers characters introduced by chat templates without changing serving code. Extend the existing tokenizer tests to cover both encoding modes, mixed batches, rendered chat text, and native routing for compatible Unicode. Signed-off-by: Chenshu Zhu <chenshuz@nvidia.com>
Add annotations to the adapter interfaces and focused tokenizer tests. Keep optional native imports behind TYPE_CHECKING. Validation: repository autoformatter check, 38 tokenizer tests, and exact-HF chat-handler checks pass. Mypy reports the same 15 diagnostics as untouched upstream main. Signed-off-by: Chenshu Zhu <chenshuz@nvidia.com>
jupiterepoch
force-pushed
the
chenshuz/gigatoken-integration
branch
from
October 16, 2026 18:44
ceffc7f to
5adc2dd
Compare
This branch was successfully deployed
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 does this PR do?
Support
use_gigatoken=Truewhile maintaining HF parity (with fallback on a fixed set of unicode characters). The default path remainsuse_gigatoken=False, this change requires user to explicitly opt in via use_gigatoken=Trueor the--use-gigatoken` flag. The tokenization encoding time is 10x - 40x faster depending on input. The functional support is achieved through:encode_filesbypass this guard.Validation
Validated with end2end run, with transformers 5.15.1 and tokenizers 0.22.2:
Setup for right-aligned tokenizer configurations
Install the required fork into the same Python environment used by the serving/RL processes, including the container used on worker nodes. After the normal Megatron environment and Gigatoken dependencies are installed, replace only Gigatoken with the tested revision:
python -m pip install --force-reinstall --no-deps \ "gigatoken @ git+https://github.com/jupiterepoch/gigatoken.git@522b4fadabd2a6d475fc355b0b4b54ee691c24f2"This source build requires Git and the Rust nightly toolchain specified by the fork's
rust-toolchain.toml. Verify the loaded module and recorded source revision:The recorded repository should be
https://github.com/jupiterepoch/gigatoken.gitandvcs_info.commit_idshould be522b4fadabd2a6d475fc355b0b4b54ee691c24f2.Contribution process
Pre-checks
jit_fuser/torch.compile, CUDA extension, TE or external-library dispatch, or a scatter/index accumulation), I have added or updated its bit-exact determinism test and registered it intests/unit_tests/determinism/kernels/manifest.py(guide)