[https://nvbugs/6185234][fix] route load_hf_model_config via AutoConfig - #14410
Conversation
PR NVIDIA#14293 registered `deepseek_v32` and `kimi_k2` in `transformers.models.auto.configuration_auto.CONFIG_MAPPING` so that `AutoConfig.from_pretrained` / `AutoTokenizer.from_pretrained` dispatch to TRT-LLM-local `DeepseekV3Config` for those model_types on transformers 5.5.x, fixing the `benchmark_serving` client crash on DeepSeek-V3.2. `ModelLoader.load_hf_model_config` in `tensorrt_llm/llmapi/llm_utils.py` was still calling `transformers.PretrainedConfig.from_pretrained` directly. That bypasses `CONFIG_MAPPING` entirely (the base class `from_pretrained` does not consult the mapping), so on transformers 5.5.x it falls through to a bare `PretrainedConfig` that lacks `max_position_embeddings`. The warning shows up at trtllm-serve startup on V3.2: [W] [llmapi] Failed to load hf model config from .../DeepSeek-V3.2-Exp-FP4-v2, encountered error: 'PreTrainedConfig' object has no attribute 'max_position_embeddings' The L0_PostMerge `disagg_upload-gen_only-gb200_deepseek-v32-fp4_...` perf-sanity test on GB200 (36 GPUs / 9 nodes) PASSED at builds 2719/2721 (transformers 5.3.x), FAILED at 2722/2723 with the original `benchmark_serving` client `max_position_embeddings` AttributeError right after PR NVIDIA#13994 (5.5.3 upgrade) landed, and at 2726 (with NVIDIA#14293 in main) now fails differently with a 5400s `Endpoint /health did not become ready` GEN-side timeout while the warning above is still emitted at GEN_0.0.log:35. Fix: route through `transformers.AutoConfig.from_pretrained` so the NVIDIA#14293 `CONFIG_MAPPING.register` mapping applies. Other call sites of `PretrainedConfig.from_pretrained` in `tensorrt_llm/` were grepped and the only non-comment hit is this one. Verified via standalone reproducer on transformers 5.5.3: - `PretrainedConfig.from_pretrained` returns bare `PreTrainedConfig` (the bypass) - `AutoConfig.from_pretrained` returns the registered subclass Pre-merge regression coverage extended in `tests/unittest/_torch/test_custom_config_registration.py`: `test_load_hf_model_config_uses_autoconfig_dispatch` asserts that `ModelLoader.load_hf_model_config` returns a `DeepseekV3Config` instance for both `deepseek_v32` and `kimi_k2` model_types. Signed-off-by: tianruih <tianruih@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR updates HuggingFace model config loading to use ChangesAutoConfig dispatch for HuggingFace model configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 |
|
/bot run --disable-fail-fast --extra-stage "DGX_B200-8_GPUs-PyTorch-1, DGX_B200-8_GPUs-PyTorch-2, DGX_B200-8_GPUs-AutoDeploy-Post-Merge-1, DGX_B200-8_GPUs-PyTorch-PerfSanity-Post-Merge-4, GB200-36_GPUs-9_Nodes-PyTorch-Disagg-PerfSanity-CTX1-NODE1-GPU4-GEN1-NODE8-GPU32-Post-Merge-9" |
|
PR_Github #49696 [ run ] triggered by Bot. Commit: |
|
PR_Github #49696 [ run ] completed with state
|
|
/bot run --disable-fail-fast --extra-stage "DGX_B200-8_GPUs-PyTorch-1, DGX_B200-8_GPUs-PyTorch-2, DGX_B200-8_GPUs-AutoDeploy-Post-Merge-1, DGX_B200-8_GPUs-PyTorch-PerfSanity-Post-Merge-4, GB200-36_GPUs-9_Nodes-PyTorch-Disagg-PerfSanity-CTX1-NODE1-GPU4-GEN1-NODE8-GPU32-Post-Merge-9" |
|
PR_Github #49816 [ run ] triggered by Bot. Commit: |
|
PR_Github #49816 [ run ] completed with state |
Superjomn
left a comment
There was a problem hiding this comment.
LGTM on the llmapi changes.
…ig (NVIDIA#14410) Signed-off-by: tianruih <tianruih@nvidia.com>
…ig (NVIDIA#14410) Signed-off-by: tianruih <tianruih@nvidia.com>
Summary
Follow-up to #14293.
ModelLoader.load_hf_model_configintensorrt_llm/llmapi/llm_utils.pywas still callingtransformers.PretrainedConfig.from_pretraineddirectly, which bypassesthe
transformers.models.auto.configuration_auto.CONFIG_MAPPINGthat#14293 registers
deepseek_v32/kimi_k2into. On transformers 5.5.xthe base-class
from_pretrainedreturns a barePretrainedConfigthatlacks
max_position_embeddings. Route throughAutoConfig.from_pretrainedso the #14293 mapping applies.
Symptom and CI history
L0_PostMerge stage
GB200-36_GPUs-9_Nodes-PyTorch-Disagg-PerfSanity-CTX1-NODE1-GPU4-GEN1-NODE8-GPU32-Post-Merge-9,test
perf/test_perf_sanity.py::test_e2e[disagg_upload-gen_only-gb200_deepseek-v32-fp4_8k1k_con1024_ctx1_dep4_gen1_dep 32_eplb256_mtp3_ccb-NIXL]:GEN_0.0.log:35 at build 2726 still shows:
[TRT-LLM] [W] [llmapi] Failed to load hf model config from
.../DeepSeek-V3.2-Exp-FP4-v2, encountered error:
'PreTrainedConfig' object has no attribute 'max_position_embeddings'
— because
PretrainedConfig.from_pretraineddoesn't consultCONFIG_MAPPING,so #14293's registration is moot for this call path. The function returns
None, downstream uses a fallback path that doesn't match the V3.2 configshape, and on 9-node MPI weight-load workers eventually die mid-load with
PMIX
-61 LOST_CONNECTION_TO_PEER.Mechanism
transformers.PretrainedConfig.from_pretrained(base class) does notdispatch through
CONFIG_MAPPING.AutoConfig.from_pretraineddoes.Routing the call through
AutoConfigis what_torch/configs/__init__.pyalready assumes for the rest of the codebase; this was the only remaining
direct call to the base class in
tensorrt_llm/.Verified standalone on transformers 5.5.3:
PretrainedConfig.from_pretrained→ barePreTrainedConfig(the bypass)AutoConfig.from_pretrained→ registered subclass with all attributes(the fix)
Test plan
tests/unittest/_torch/test_custom_config_registration.pywith
test_load_hf_model_config_uses_autoconfig_dispatchthatasserts
ModelLoader.load_hf_model_configreturns aDeepseekV3Configinstance (not barePretrainedConfig) fordeepseek_v32andkimi_k2model_types.the post-merge container (srun job 2265026): both
PretrainedConfigbypass and
AutoConfigdispatch behavior confirmed.