[https://nvbugs/6227203][fix] Remove redundant TikTokenTokenizer shim from KimiK25InputProcessor - #14741
Conversation
📝 WalkthroughWalkthroughThe PR removes the slow tokenizer forcing mechanism from ChangesKimi K2.5 Tokenizer and Token Count Simplification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/bot run --disable-fail-fast |
|
PR_Github #51017 [ run ] triggered by Bot. Commit: |
|
PR_Github #51017 [ run ] completed with state
|
… from KimiK25InputProcessor Signed-off-by: Tianyu Xiong <117647511+tianyuxbear@users.noreply.github.com>
|
/bot run --disable-fail-fast |
|
PR_Github #52571 [ run ] triggered by Bot. Commit: |
|
PR_Github #52571 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #52627 [ run ] triggered by Bot. Commit: |
|
PR_Github #52627 [ run ] completed with state |
The rc18->rc19 rebase kept our rc18-based modeling_kimi_k25.py wholesale, which missed rc19's own evolution of the (shared-lineage) file: - NVIDIA#13864 (EPD): get_prompt_token_ids() -> build_disagg_prefill_multimodal_inputs() returning DisaggPrefillMultimodalInputs. rc19's inputs/registry.py now REQUIRES this method for multimodal disagg; our old file only had the removed get_prompt_token_ids -> disaggregated multimodal Kimi would fail registry validation. - NVIDIA#14741: removed DI's lazy slow-tokenizer shim as redundant. - NVIDIA#15219: native vocab_size_padded delegating property. Re-base our file on rc19's modeling_kimi_k25.py and re-apply only the DI deltas that rc19 lacks: - tokenizer denylist discard ("kimi_k25") for correct gapped special-token ids (kept even though the slow-tokenizer shim was dropped; harmless no-op if upstream resolves the denylist entry); - root-logger filter silencing the per-encode "Calling super().encode" spam; - vision-tower MLP row chunking (TLLM_KIMI_VISION_MLP_CHUNK) to bound peak activation on large images; - keep MoonViT3d LayerNorm params in float32 (TRT-LLM LayerNorm.forward upcasts activations -> bf16 weights crash F.layer_norm); - data.image placeholder deficit top-up (drop the now-removed _ensure_k25_slow_tokenizer call); - spec-decode delegations rc19 lacks (spec_worker, spec_config, set_guided_decoder; rc19 already forwards the rest); - preserve original_input_ids across fuse_input_embeds for the Eagle3 drafter. Net +110 lines over rc19 base. Aggregated and disaggregated multimodal paths both supported now. Needs a vision smoke before prod. Signed-off-by: Bo <bo@deepinfra.com>
Description
Remove the
_ensure_k25_slow_tokenizershim fromKimiK25InputProcessor. The shim is redundant under the currentAutoTokenizerdefault behavior, and its side effect of discarding theTransformersTokenizerwrapper is the direct cause ofAttributeError: TikTokenTokenizer has no attribute tokenizeratopenai_server.py:1142(NVBug 6227203).Timeline
TikTokenTokenizer. No shim needed.__init__now just sets `_slo #14846 (NVBug 6248987) — made the shim swap lazy and conditional, so that on the text-only thinking path the default tokenizer is kept (running the slow PythonTikTokenTokenizeron the orchestrator GIL adds ~100 ms per_fetch_new_requests/broadcast_requestsstep, a 9x TPOT regression).After step 4,
AutoTokenizer's default output for K2.5 is already the slowTikTokenTokenizer. #14846 keeps that default tokenizer for the text-only path; the only additional work the shim does is to force-load a fresh slow class instance on the multimodal path — which produces a byte-identical tokenizer to the one already loaded by default. The shim machinery is therefore dead code.This PR removes the entire shim (the original swap in #14392 plus the lazy/conditional machinery added by #14846), letting every path use the default
AutoTokenizeroutput. NVBug 6227203 is resolved because theTransformersTokenizerwrapper is no longer overwritten; NVBug 6248987's perf concern is structurally resolved because no Python-side swap ever fires.Why the shim is harmful, not just redundant
LLMbuilds aTransformersTokenizerwrapper whose.tokenizerinner attribute is the HF tokenizer, and passes the wrapper intoKimiK25InputProcessor. The shim (whether eager or lazy) overwritesself._tokenizerwith a bare slow class once it fires.LLM.tokenizerthen reads the bare class back viaself.input_processor.tokenizerand propagates it to the OpenAI server, where five sites inopenai_server.pyaccessself.tokenizer.tokenizer.<attr>directly — and raiseAttributeError.Test Coverage
test_e2e.py::test_openai_kv_cache_contamination— the failing test for NVBug 6227203; unwaived inwaives.txt.accuracy/test_llm_api_pytorch_multimodal.py::TestKimiK25::test_nvfp4[dep8]— the original NVBug 6182617 regression test. Re-ran 3× sequentially on 8x B200 with the shim removed: 3/3 PASS, MMMU within sample noise of the transformers 5.3 baseline, no OOM.