[https://nvbugs/6181383][fix] Build inner text/vision/audio sub-configs as empty PretrainedConfig() then setat
Summary
- Root cause: transformers 5.5.x's strict-dataclass PreTrainedConfig drops unknown kwargs (max_position_embeddings) until after post_init, but rope standardization inside post_init dereferences them first and raises AttributeError.
- Fix: Build inner text/vision/audio sub-configs as empty PretrainedConfig() then setattr each dict entry, sidestepping the rope path; also relax DeepseekV3 detect_shared_mtp_weights to getattr(...) since num_nextn_predict_layers is absent on mistral_large_3 configs and used to read as None.
- Automated fix generated by repair-bot
Test plan
- [x] Verify fix on the same GPU type as the original failure
- [x] Check for regressions in related tests
Links
- Bug: https://nvbugs/6181383
Summary by CodeRabbit
- Bug Fixes
- Improved checkpoint loading robustness for Mistral model configurations, particularly for vision and audio variants, enhancing compatibility with various configuration formats.
- Enhanced DeepseekV3 model configuration handling to gracefully manage missing optional configuration fields during checkpoint loading, improving overall stability.
No actionable comments were generated in the recent review. ๐
โน๏ธ Recent review info
โ๏ธ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 02d3bfa4-843b-4fc3-bf19-206aa1dbf8f6
๐ฅ Commits
Reviewing files that changed from the base of the PR and between b7c23030de761fbb228cc3a37c21ee0e769e0ef9 and 348f63693b64a38a60362b3d227ada71d57675ed.
๐ Files selected for processing (2)
tensorrt_llm/_torch/models/checkpoints/mistral/config_loader.pytensorrt_llm/_torch/models/modeling_deepseekv3.py
๐ Walkthrough
Walkthrough
The PR adds a helper function in Mistral config loading to construct PretrainedConfig instances via setattr instead of from_dict, accommodating Transformers' strict dataclass validation. This helper is applied to both vision and audio checkpoint remapping. Additionally, DeepseekV3 weight loader now safely handles missing num_nextn_predict_layers attributes with a getattr fallback.
Changes
Mistral PretrainedConfig Construction Helper
| Layer / File(s) | Summary |
|---|---|
Helper function and vision config remapping tensorrt_llm/_torch/models/checkpoints/mistral/config_loader.py |
Introduces _dict_to_base_pretrained_config(d) that creates a PretrainedConfig by instantiating empty and assigning keys via setattr. Updates _remap_mistral_vision_args to use this helper for both text_config and vision_config instead of from_dict. |
Audio config remapping tensorrt_llm/_torch/models/checkpoints/mistral/config_loader.py |
Updates _remap_mistral_audio_args to construct text_config using the new helper function, preserving any attached quantization_config. |
DeepseekV3 Safe Config Attribute Access
| Layer / File(s) | Summary |
|---|---|
Safe num_nextn_predict_layers handling tensorrt_llm/_torch/models/modeling_deepseekv3.py |
Changes ckpt_nextn initialization in DeepseekV3WeightLoader.detect_shared_mtp_weights to use getattr(self.config, 'num_nextn_predict_layers', None) or 0, defaulting to 0 instead of raising an AttributeError when the field is missing. |
Estimated code review effort
๐ฏ 2 (Simple) | โฑ๏ธ ~10 minutes
Suggested reviewers
- xinhe-nv
๐ฅ Pre-merge checks | โ 4 | โ 1
โ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 0.00% 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 correctly identifies the main change: building inner text/vision/audio sub-configs as empty PretrainedConfig() then setattr, addressing the root cause of the transformers 5.5.x strict-dataclass issue. |
| Description check | โ Passed | The PR description includes the root cause, fix explanation, test plan with checkmarks, and relevant bug link, but is missing explicit sections for 'Description' and 'Test Coverage' headings as specified in the template structure. |
| 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.
/bot run
/bot run
PR_Github #52170 [ run ] triggered by Bot. Commit: ee05437 Link to invocation
PR_Github #52170 [ run ] completed with state ABORTED. Commit: ee05437
/LLM/main/L0_MergeRequest_PR pipeline #41492 completed with status: 'FAILURE'
โ ๏ธ 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
/bot run
PR_Github #52242 [ run ] triggered by Bot. Commit: ee05437 Link to invocation
PR_Github #52242 [ run ] completed with state SUCCESS. Commit: ee05437
/LLM/main/L0_MergeRequest_PR pipeline #41558 completed with status: 'FAILURE'
โ ๏ธ 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
/bot run
PR_Github #52268 [ run ] triggered by Bot. Commit: ee05437 Link to invocation
PR_Github #52268 [ run ] completed with state SUCCESS. Commit: ee05437
/LLM/main/L0_MergeRequest_PR pipeline #41579 completed with status: 'FAILURE'
โ ๏ธ 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
/bot run --extra-stage "GB200-4_GPUs-PyTorch-Post-Merge-1"
PR_Github #52310 [ run ] triggered by Bot. Commit: 3ae5580 Link to invocation
PR_Github #52310 [ run ] completed with state SUCCESS. Commit: 3ae5580
/LLM/main/L0_MergeRequest_PR pipeline #41616 completed with status: 'FAILURE'
โ ๏ธ 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
/bot run
PR_Github #52355 [ run ] triggered by Bot. Commit: 3ae5580 Link to invocation
PR_Github #52355 [ run ] completed with state SUCCESS. Commit: 3ae5580
/LLM/main/L0_MergeRequest_PR pipeline #41654 completed with status: 'FAILURE'
โ ๏ธ 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
/bot run
PR_Github #52402 [ run ] triggered by Bot. Commit: 413e619 Link to invocation
PR_Github #52402 [ run ] completed with state SUCCESS. Commit: 413e619
/LLM/main/L0_MergeRequest_PR pipeline #41697 completed with status: 'FAILURE'
โ ๏ธ 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