Repository navigation
[https://nvbugs/6624972][fix] Preserve Nemotron-H hybrid_override_pattern with MLP layers - #18042
Conversation
|
Draft pending CI — root-caused and fixed the
Promoting out of draft once pre-merge CI is green. |
|
/bot run |
|
PR_Github #68036 [ run ] triggered by Bot. Commit: |
|
PR_Github #68036 [ run ] completed with state
|
|
/bot run |
|
PR_Github #68235 [ run ] triggered by Bot. Commit: |
|
PR_Github #68235 [ run ] completed with state
|
|
Re-running CI: the last failure was infrastructure, not this PR.
/bot run --disable-fail-fast |
|
Re-triggering: the previous CI command never registered.
|
|
/bot run --disable-fail-fast |
|
PR_Github #68739 [ run ] triggered by Bot. Commit: |
|
PR_Github #68739 [ run ] completed with state
|
7a3f15c to
1e8ee68
Compare
|
Fixed the current-head AutoDeploy constructor failure.
Re-running the current head with fail-fast disabled. |
|
/bot run --disable-fail-fast |
|
PR_Github #68963 [ run ] triggered by Bot. Commit: |
|
PR_Github #68963 [ run ] completed with state
|
|
Pushed a fix for the registration-ordering failure in The failure analysis for pipeline #56344 was right: the local The fix imports the module eagerly in The A30 OOMs and the |
|
/bot run |
122265d to
4f65f5e
Compare
|
/bot run |
|
PR_Github #74239 [ run ] triggered by Bot. Commit: |
|
PR_Github #74239 [ run ] completed with state
|
Semantic conflict reviewThe verdict of record is the Latest recorded state: No semantic conflict found (best effort) for head Best-effort AI judgment for the recorded revisions. PASS, FAIL and INCONCLUSIVE may be incomplete or incorrect. PR authors and reviewers should independently verify the evidence and relevant behavior. This semantic review and its status/workflow are advisory, not required merge checks under current repository rules; other merge requirements still apply. Advisory status does not make a confirmed defect safe to ignore.
Processed request and reply comments are minimized to reduce timeline noise; they remain expandable for audit. |
|
Retargeted this PR to This was not a direct base switch: the rewritten head contains only the intended six-file NVBug fix (533 additions, 1 deletion), with no unrelated post-branch Validation before push:
The previous full CI run on the same six-file implementation passed on |
|
/bot run |
|
PR_Github #75996 [ run ] triggered by Bot. Commit: |
|
PR_Github #75996 [ run ] completed with state
|
|
@pranav-nvidia it looks like the changes don't touch the MoE block, so there's no need for review from trt-llm-moe-devs? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/bot run |
|
PR_Github #76106 [ run ] triggered by Bot. Commit: |
|
PR_Github #76106 [ run ] completed with state
|
|
/bot run |
|
PR_Github #76129 [ run ] triggered by Bot. Commit: |
|
PR_Github #76129 [ run ] completed with state |
….3: Preserve Nemotron-H hybrid_override_pattern with MLP layers Forward-port of release/1.3 PR NVIDIA#18042 (release/1.3 commit af8c4a2) to main. Signed-off-by: Pranav Shrestha <254760092+pranav-nvidia@users.noreply.github.com> Co-authored-by: Pranav Shrestha <254760092+pranav-nvidia@users.noreply.github.com> Signed-off-by: Simeng Liu <simengl@nvidia.com>
…nt declares it NemotronHConfig from tensorrt_llm._torch.configs (NVIDIA#18042), registered for nemotron_h checkpoints whose hybrid_override_pattern has "-" MLP layers, defaulted mamba_ssm_cache_dtype to "float32". transformers 5.5.4 prefers a registered non-transformers config class over the checkpoint's remote code even with trust_remote_code=True, so dense checkpoints such as NVIDIA-Nemotron-Nano-12B-v2, whose config.json does not declare the field, switched from a bf16 to an fp32 SSM state cache. That doubles the recurrent state per sequence (75.5 MB -> 148.9 MB for Nano-12B-v2). At max_batch_size 512 the V2 Mamba cache then needs 513 x 148,865,024 + 786,432 = 76,368,543,744 bytes, above the ~53 GB H100 quota, and these perf tests fail at executor init with "The V2 Mamba GPU cache quota is too small for live recurrent states and attention pages": perf/test_perf.py::test_perf[nemotron_nano_12b_v2-bench-pytorch-bfloat16-input_output_len:128,128] perf/test_perf.py::test_perf[nemotron_nano_12b_v2-bench-pytorch-bfloat16-input_output_len:500,2000-con:250] Leave mamba_ssm_cache_dtype as None when the checkpoint does not declare it, so resolve_auto_ssm_cache_dtype falls back to the model dtype, as it does with the checkpoint's own config and on main (which does not carry NVIDIA#18042). A declared value is still honored, and patterns transformers can represent natively still load through its own NemotronHConfig. Add a regression test for both cases. Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
Dev Engineer Review
NemotronHConfigpreserves Nemotron-H layer patterns containing-, and delegates patterns supported by Transformers to its native config class.nemotron_hand exported fromtensorrt_llm._torch.configs.TransformersTokenizer.from_pretrainedimports that module before tokenizer loading so the registration is available.use_cache. Verify compatibility with checkpoint variants and future Transformers config changes.QA Engineer Review
tests/unittest/_torch/test_custom_config_registration.pywith Nemotron-H tests for dense-pattern preservation, native-config dispatch, invalid patterns and block types, block-type conversion, MTP behavior,use_cache, tokenizer loading in a clean process, and model-config loading.tests/integration/test_lists/test-db/l0_cpu.yml. Removed the Nemotron Nano NVFP4 waiver fromtests/integration/test_lists/waives.txt.Per-File QA Perspective
tensorrt_llm/_torch/configs/__init__.py: ExportsNemotronHConfigand overrides the Transformers mapping fornemotron_h. Verify dense checkpoints use the local config and representable patterns still use the native config.tensorrt_llm/_torch/configs/nemotron_h.py: Adds custom parsing, validation, and pattern/block-type handling. Verify pattern round-tripping and expected config fields across supported checkpoint formats.tensorrt_llm/tokenizer/tokenizer.py: Imports the config package beforeAutoTokenizer.from_pretrained. Verify tokenizer loading works when config registration has not occurred earlier in the process.tests/unittest/_torch/test_custom_config_registration.py: Adds registration and Nemotron-H regression tests. Listed intests/integration/test_lists/test-db/l0_cpu.yml; no manual-QA list entry is established.tests/integration/test_lists/test-db/l0_cpu.yml: Adds the config-registration unit test file to the CPU CI list.tests/integration/test_lists/waives.txt: Removes the Nemotron Nano NVFP4 test waiver, allowing that integration case to run.Description
transformers5.5.4'sNemotronHConfigconvertshybrid_override_patternintolayers_block_typewith a mapping that only knowsM,Eand*. Every dense Nemotron-H checkpoint also uses-for MLP layers, so config construction raisesKeyError: '-'.AutoTokenizer.from_pretrainedcallsAutoConfig.from_pretrained, so this fails before any model is built.Reproduced on
nvidia/NVIDIA-Nemotron-Nano-9B-v2-NVFP4(CPU only, no GPU required):Widening that one mapping is not sufficient — each of these was checked against the installed 5.5.4:
NemotronHConfig.validate_layers_block_typerestricts entries to{"mamba", "attention", "moe"}.validate_layer_type, reached viaattribute_map = {"layer_types": "layers_block_type"}, also rejects"mlp".hybrid_override_patternis a read-only property derived fromlayers_block_typethrough a reverse mapping with no-, so the MLP entries cannot be recovered even after the first two are relaxed.TRT-LLM builds Nemotron-H by iterating
hybrid_override_pattern(modeling_nemotron_h.py,ModelConfig.get_num_attention_layers/get_num_mamba_layers, and the mamba/attention masks inconfig_utils.py), so the literal checkpoint string has to survive config loading intact.This PR adds a TRT-LLM-local
NemotronHConfigthat stores the pattern verbatim and registers it formodel_type="nemotron_h". Itsfrom_dictdelegates straight back to the native transformers class for every pattern transformers can express, so the only checkpoints whose behaviour changes are the ones that cannot be loaded at all today.Upstream fixed this in transformers v5.6.2;
requirements.txtpinstransformers==5.5.4. Updating that pin is a substantially larger change than this compatibility shim.Test Coverage
tests/unittest/_torch/test_custom_config_registration.py— four new CPU-only tests: the dense pattern survivesAutoConfigwith layer counts intact, representable patterns still resolve to the native transformers class, invalid pattern characters raise a clearValueError, andModelLoader.load_hf_model_configreturns a usable config.test_e2e.py::test_ptp_quickstart_advanced[Nemotron-Nano-9B-v2-nvfp4-NVIDIA-Nemotron-Nano-9B-v2-NVFP4]— thenvbugs/6624972waiver is removed so this B200pre_mergecase exercises the fix directly.PR Checklist
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.