Skip to content

[https://nvbugs/6182617][fix] Restore K2.5 multimodal dep8 accuracy test on transformers 5.5.x - #14392

Merged
lancelly merged 3 commits into
NVIDIA:mainfrom
tianyuxbear:fix/6182617
May 25, 2026
Merged

[https://nvbugs/6182617][fix] Restore K2.5 multimodal dep8 accuracy test on transformers 5.5.x#14392
lancelly merged 3 commits into
NVIDIA:mainfrom
tianyuxbear:fix/6182617

Conversation

@tianyuxbear

@tianyuxbear tianyuxbear commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Tokenizer fix: force the K2.5 slow TikTokenTokenizer in the multimodal InputProcessor. transformers 5.5.x's AutoTokenizer routing for K2.5 sometimes returns the Rust fast backend, which BPE-splits K2.5 special tokens (<|media_pad|>, <|im_user|>, ...) instead of preserving their canonical IDs. This previously made the multimodal hashing path fall back with Number of mm_embeds (N) does not match expected total (0).
  • Drop max_num_tokens=16384 override on K2.5 dep8 multimodal: with attention_dp=True on dep8 the resolved moe_max_num_tokens was max_num_tokens * dp_size = 131072, pushing the per-call torch.ops.trtllm.fused_moe workspace to ~24 GiB. Combined with PyTorch caching-allocator fragmentation from mid-run attention workspace resizes, this caused intermittent CUDA OOM. Falling back to the LLM default max_num_tokens=8192 brings the workspace to ~12 GiB and keeps it within activation headroom.
  • Bump dep8 timeout 60 → 120 min: K2.5 NVFP4 dep8 takes ~68 min at the smaller max_num_tokens (twice the prefill steps per long prompt). Matches the precedent set by TestKimiK25::test_nvfp4[tp8] on l0_gb200_multi_nodes (180 min) for K2.5 NVFP4 workloads.
  • Unwaive TestKimiK25::test_nvfp4[dep8]: both failure modes (tokenizer mismatch, fused_moe OOM) are addressed; re-enable the test in pre-merge CI.

Resolves NVBug 6182617.

Test plan

  • pytest tests/unittest/_torch/modeling/test_modeling_kimi_k25.py — 24/24 PASS (previously 10 failures around placeholder_count and multimodal embeddings).
  • HW verification on 8x B200: pytest tests/integration/defs/accuracy/test_llm_api_pytorch_multimodal.py::TestKimiK25::test_nvfp4 -k dep8PASSED, MMMU accuracy 81.44 (within sample noise of transformers 5.3 baseline 80.889), 0 OOM, total runtime ~68 min.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed tokenization behavior for Kimi K2.5 models to ensure proper token-id mapping and compatibility with recent dependency updates.
  • Tests

    • Updated test configuration timeout and removed test waiver for K2.5 multimodal accuracy validation.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR addresses tokenizer routing inconsistency in Kimi K2.5 by forcing deterministic use of TikTokenTokenizer, adds dynamic module loading with fallback, adjusts the multimodal test token budget strategy, increases test timeout, and removes the associated skip waiver.

Changes

Kimi K25 Tokenizer Determinism

Layer / File(s) Summary
Tokenizer Override Implementation
tensorrt_llm/_torch/models/modeling_kimi_k25.py
New _ensure_k25_slow_tokenizer() method dynamically loads TikTokenTokenizer from the model module and replaces both self._tokenizer and self._processor.tokenizer. The method logs diagnostic info, warns if dynamic loading fails, and keeps the existing tokenizer as fallback. KimiK25InputProcessor.__init__ calls this method after media_placeholder_token_id resolution.
Multimodal Test Adjustment and Harness Configuration
tests/integration/defs/accuracy/test_llm_api_pytorch_multimodal.py, tests/integration/test_lists/test-db/l0_dgx_b200.yml, tests/integration/test_lists/waives.txt
test_nvfp4 removes explicit max_num_tokens argument to rely on LLM defaults, keeping moe_max_num_tokens within allocator headroom. Test timeout increases from 60s to 120s for the dep8 configuration. Skip waiver for this test case is removed, indicating it is no longer expected to fail.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • VALLIS-NERIA
  • jaedeok-nvidia
  • Wanli-Jiang
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: restoring K2.5 multimodal accuracy test with a fix for transformers 5.5.x compatibility by addressing tokenizer and memory issues.
Description check ✅ Passed The PR description comprehensively covers the issue, solution, test coverage, and provides detailed test results. All key sections from the template are addressed with clear explanations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tensorrt_llm/_torch/models/modeling_kimi_k25.py (1)

1187-1206: 💤 Low value

Consider narrowing exception scope for dynamic module loading.

Per coding guidelines, prefer catching specific exceptions over broad Exception. The dynamic module loading could fail with ImportError, ModuleNotFoundError, AttributeError, or TypeError. While the fallback is safe, narrowing the catch would make failure modes more explicit:

♻️ Suggested narrowing of exception handling
-        except Exception as exc:  # pragma: no cover - defensive fallback
+        except (ImportError, ModuleNotFoundError, AttributeError, TypeError, OSError) as exc:  # pragma: no cover - defensive fallback

As per coding guidelines: "Avoid broad exception handling — catch specific exceptions, not bare except:"

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tensorrt_llm/_torch/models/modeling_kimi_k25.py` around lines 1187 - 1206,
The current broad except Exception in the dynamic loading block around
get_class_from_dynamic_module / slow_cls.from_pretrained should be narrowed to
only the relevant failure types; replace the generic except Exception as exc
with a specific tuple like except (ImportError, ModuleNotFoundError,
AttributeError, TypeError) as exc so import/factory failures are handled but
other exceptions still propagate, keeping the same logging and early return
behavior for slow_tok fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tensorrt_llm/_torch/models/modeling_kimi_k25.py`:
- Around line 1187-1206: The current broad except Exception in the dynamic
loading block around get_class_from_dynamic_module / slow_cls.from_pretrained
should be narrowed to only the relevant failure types; replace the generic
except Exception as exc with a specific tuple like except (ImportError,
ModuleNotFoundError, AttributeError, TypeError) as exc so import/factory
failures are handled but other exceptions still propagate, keeping the same
logging and early return behavior for slow_tok fallback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fad18cc1-a3c6-4eef-9ab0-84def202119b

📥 Commits

Reviewing files that changed from the base of the PR and between 6a4a2a8 and d012c36.

📒 Files selected for processing (4)
  • tensorrt_llm/_torch/models/modeling_kimi_k25.py
  • tests/integration/defs/accuracy/test_llm_api_pytorch_multimodal.py
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
  • tests/integration/test_lists/waives.txt
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49617 [ run ] triggered by Bot. Commit: f377f7a Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49617 [ run ] completed with state SUCCESS. Commit: f377f7a
/LLM/main/L0_MergeRequest_PR pipeline #39238 completed with status: 'SUCCESS'

CI Report

Link to invocation

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage DGX_B200-8_GPUs-PyTorch-1

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49710 [ run ] triggered by Bot. Commit: e3c840d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49711 [ run ] triggered by Bot. Commit: e3c840d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49710 [ run ] completed with state ABORTED. Commit: e3c840d

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49711 [ run ] completed with state SUCCESS. Commit: e3c840d
/LLM/main/L0_MergeRequest_PR pipeline #39317 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage DGX_B200-8_GPUs-PyTorch-1 --disable-fail-fast

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49845 [ run ] triggered by Bot. Commit: e3c840d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49845 [ run ] completed with state SUCCESS. Commit: e3c840d
/LLM/main/L0_MergeRequest_PR pipeline #39429 completed with status: 'SUCCESS'

CI Report

Link to invocation

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --stage-list DGX_B200-8_GPUs-PyTorch-1

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49906 [ run ] triggered by Bot. Commit: e3c840d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49906 [ run ] completed with state SUCCESS. Commit: e3c840d
/LLM/main/L0_MergeRequest_PR pipeline #39485 (Partly Tested) completed with status: 'SUCCESS'

CI Report

Link to invocation

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50047 [ run ] triggered by Bot. Commit: e1bb177 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50047 [ run ] completed with state SUCCESS. Commit: e1bb177
/LLM/main/L0_MergeRequest_PR pipeline #39608 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50085 [ run ] triggered by Bot. Commit: e1bb177 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50085 [ run ] completed with state SUCCESS. Commit: e1bb177
/LLM/main/L0_MergeRequest_PR pipeline #39638 completed with status: 'SUCCESS'

CI Report

Link to invocation

…essor

Signed-off-by: Tianyu Xiong <117647511+tianyuxbear@users.noreply.github.com>
Signed-off-by: Tianyu Xiong <117647511+tianyuxbear@users.noreply.github.com>
Signed-off-by: Tianyu Xiong <117647511+tianyuxbear@users.noreply.github.com>
@tianyuxbear

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50155 [ run ] triggered by Bot. Commit: 98cfb02 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50155 [ run ] completed with state SUCCESS. Commit: 98cfb02
/LLM/main/L0_MergeRequest_PR pipeline #39700 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

CI Report

Link to invocation

@lancelly
lancelly merged commit 546a5b0 into NVIDIA:main May 25, 2026
7 checks passed
KleinBlueC pushed a commit to KleinBlueC/TensorRT-LLM that referenced this pull request May 26, 2026
…est on transformers 5.5.x (NVIDIA#14392)

Signed-off-by: Tianyu Xiong <117647511+tianyuxbear@users.noreply.github.com>
bmarimuthu-nv pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request May 28, 2026
…est on transformers 5.5.x (NVIDIA#14392)

Signed-off-by: Tianyu Xiong <117647511+tianyuxbear@users.noreply.github.com>
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.

5 participants