TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

[https://nvbugs/6181383][fix] Build inner text/vision/audio sub-configs as empty PretrainedConfig() then setat

Open tensorrt-cicd opened this issue 6 months ago โ€ข 26 comments

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.

Review Change Stack

tensorrt-cicd avatar May 21 '26 08:05 tensorrt-cicd

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.py
  • tensorrt_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.

coderabbitai[bot] avatar May 21 '26 08:05 coderabbitai[bot]

/bot run

2ez4bz avatar Jun 04 '26 22:06 2ez4bz

/bot run

2ez4bz avatar Jun 04 '26 22:06 2ez4bz

PR_Github #52170 [ run ] triggered by Bot. Commit: ee05437 Link to invocation

tensorrt-cicd avatar Jun 04 '26 22:06 tensorrt-cicd

PR_Github #52170 [ run ] completed with state ABORTED. Commit: ee05437 /LLM/main/L0_MergeRequest_PR pipeline #41492 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

tensorrt-cicd avatar Jun 05 '26 00:06 tensorrt-cicd

/bot run

2ez4bz avatar Jun 05 '26 04:06 2ez4bz

PR_Github #52242 [ run ] triggered by Bot. Commit: ee05437 Link to invocation

tensorrt-cicd avatar Jun 05 '26 04:06 tensorrt-cicd

PR_Github #52242 [ run ] completed with state SUCCESS. Commit: ee05437 /LLM/main/L0_MergeRequest_PR pipeline #41558 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

tensorrt-cicd avatar Jun 05 '26 05:06 tensorrt-cicd

/bot run

2ez4bz avatar Jun 05 '26 05:06 2ez4bz

PR_Github #52268 [ run ] triggered by Bot. Commit: ee05437 Link to invocation

tensorrt-cicd avatar Jun 05 '26 05:06 tensorrt-cicd

PR_Github #52268 [ run ] completed with state SUCCESS. Commit: ee05437 /LLM/main/L0_MergeRequest_PR pipeline #41579 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

tensorrt-cicd avatar Jun 05 '26 07:06 tensorrt-cicd

/bot run --extra-stage "GB200-4_GPUs-PyTorch-Post-Merge-1"

evezhier avatar Jun 05 '26 08:06 evezhier

PR_Github #52310 [ run ] triggered by Bot. Commit: 3ae5580 Link to invocation

tensorrt-cicd avatar Jun 05 '26 08:06 tensorrt-cicd

PR_Github #52310 [ run ] completed with state SUCCESS. Commit: 3ae5580 /LLM/main/L0_MergeRequest_PR pipeline #41616 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

tensorrt-cicd avatar Jun 05 '26 11:06 tensorrt-cicd

/bot run

2ez4bz avatar Jun 05 '26 15:06 2ez4bz

PR_Github #52355 [ run ] triggered by Bot. Commit: 3ae5580 Link to invocation

tensorrt-cicd avatar Jun 05 '26 15:06 tensorrt-cicd

PR_Github #52355 [ run ] completed with state SUCCESS. Commit: 3ae5580 /LLM/main/L0_MergeRequest_PR pipeline #41654 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

tensorrt-cicd avatar Jun 05 '26 16:06 tensorrt-cicd

/bot run

2ez4bz avatar Jun 05 '26 17:06 2ez4bz

PR_Github #52402 [ run ] triggered by Bot. Commit: 413e619 Link to invocation

tensorrt-cicd avatar Jun 05 '26 18:06 tensorrt-cicd

PR_Github #52402 [ run ] completed with state SUCCESS. Commit: 413e619 /LLM/main/L0_MergeRequest_PR pipeline #41697 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

tensorrt-cicd avatar Jun 05 '26 19:06 tensorrt-cicd