[None][fix] Fix config sharing issue for Qwen3-VL#14766
Conversation
Signed-off-by: William Zhang <133824995+2ez4bz@users.noreply.github.com>
|
/bot run |
📝 WalkthroughWalkthroughThis PR isolates the Qwen3VL vision encoder's configuration by deep-copying the model config during initialization, preventing the encoder from mutating the caller's quantization settings. A test validates that the caller's ChangesVision Encoder Config Isolation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tensorrt_llm/_torch/models/modeling_qwen3vl.py (1)
1061-1064: ⚡ Quick winFix correctly isolates the vision encoder config.
copy.deepcopy(model_config)at lines 1061-1064 preventsQwen3VisionModelBase.__init__from clobbering the caller’squant_configvia its in-place assignment (self.model_config.quant_config = QuantConfig()around line 881). Repo search forQwen3VisionModelBase(shows this is the only construction site, so the defensive copy won’t miss other callers.Optional: for stronger misuse-proofing, encapsulate the “reset QuantConfig for the vision encoder” inside
Qwen3VisionModelBaseitself rather than relying on each call site to deep-copy.🤖 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_qwen3vl.py` around lines 1061 - 1064, The vision encoder construction must not clobber the caller's model_config.quant_config; ensure Qwen3VisionModelBase is instantiated with an isolated config by passing a deep copy of model_config (e.g., copy.deepcopy(model_config)) when creating mm_encoder inside the _is_disagg() branch, and keep the existing conditional use of kwargs.get("vision_model_class", None); alternatively (recommended for robustness) move the quant_config reset into Qwen3VisionModelBase.__init__ so the class itself does self.model_config.quant_config = QuantConfig() on its own copy to prevent any caller-side mutation.
🤖 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_qwen3vl.py`:
- Around line 1061-1064: The vision encoder construction must not clobber the
caller's model_config.quant_config; ensure Qwen3VisionModelBase is instantiated
with an isolated config by passing a deep copy of model_config (e.g.,
copy.deepcopy(model_config)) when creating mm_encoder inside the _is_disagg()
branch, and keep the existing conditional use of
kwargs.get("vision_model_class", None); alternatively (recommended for
robustness) move the quant_config reset into Qwen3VisionModelBase.__init__ so
the class itself does self.model_config.quant_config = QuantConfig() on its own
copy to prevent any caller-side mutation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: d626ebfb-4e69-46ab-ad88-aeb0631f39f2
📒 Files selected for processing (3)
tensorrt_llm/_torch/models/modeling_qwen3vl.pytests/integration/test_lists/test-db/l0_l40s.ymltests/unittest/_torch/modeling/test_modeling_qwen3vl.py
|
PR_Github #51124 [ run ] triggered by Bot. Commit: |
|
PR_Github #51124 [ run ] completed with state
|
|
/bot run |
|
PR_Github #51166 [ run ] triggered by Bot. Commit: |
|
PR_Github #51166 [ run ] completed with state
|
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
Description
This commit fixes an issue where the KV cache config of
the Qwen3 VLM's end model is overwritten by changes
made to it in its vision model. Amongst other things, this
affected the KV cache dtype used by the KV cache manager.
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.