Repository navigation
fix(model): default MODEL_CONFIG_CLASS to None and opt in per family - #6305
Conversation
…apping # What does this PR do ? Builder calls for families that have not migrated their config mapping now raise instead of returning a wrong config, and the provider path no longer tells those families to switch. Every bridge inherits MODEL_CONFIG_CLASS = BridgeGPTModelConfig, but only Llama and Muse Glimmer map their HF config into it. For the rest, get_model_config() returned generic defaults (Qwen3: learned_absolute position embeddings, linear bias on, no QK norm), and to_megatron_provider() warned users toward it. # Changelog - Add MegatronModelBridge._has_model_config_mapping(): true when a bridge overrides hf_config_to_model_config_kwargs() or hf_config_to_model_config(). - hf_config_to_model_config() raises ModelConfigNotSupportedError naming the bridge and pointing to AutoBridge.to_megatron_provider() when there is no mapping. - provider_bridge() only emits the deprecation FutureWarning for families with a mapping. The provider path itself is unchanged. - Two unit tests in test_gpt_model_config.py (Qwen3 as the unmigrated family). This is a guard on the hook overrides; the alternative is flipping the MODEL_CONFIG_CLASS default to None and opting in per family. Happy to switch if you prefer that. # Testing CPU only. Both new tests fail on main (DID NOT RAISE, and the FutureWarning) and pass with this change. test_gpt_model_config.py, llama/test_llama_bridge.py and qwen/test_qwen3_bridge.py: 74 passed, 1 skipped. Llama builder tests in test_auto_bridge.py still pass; the rest of that file has the same failures before and after locally (no TE/modelopt). ruff check and format clean. # Additional Information - Fixes NVIDIA-NeMo#6242 AI-assisted (Claude Code); I reviewed the change and ran the tests. Signed-off-by: Eugenio "Jay" Zuccarelli <11176606+jayzuccarelli@users.noreply.github.com>
cuichenx
left a comment
There was a problem hiding this comment.
"flipping the MODEL_CONFIG_CLASS default to None", i think i prefer this approach slightly, one because in case there's a two level inheritance of model configs in the future (e.g. different muse glimmer model sizes) and two because it would make testing easier, the existing test_bridge_can_explicitly_disable_model_config can be modified to cover all models
…ct-unmigrated Signed-off-by: Eugenio "Jay" Zuccarelli <11176606+jayzuccarelli@users.noreply.github.com>
Make the builder-backed config path opt-in. MegatronModelBridge.MODEL_CONFIG_CLASS now defaults to None, and the migrated families (Llama, Qwen3, Muse Glimmer) set it explicitly. Unmigrated families reject get_model_config() through the existing MODEL_CONFIG_CLASS is None branch, and provider_bridge() only emits the deprecation FutureWarning for opted-in families. This replaces the _has_model_config_mapping() hook-override guard. The explicit MODEL_CONFIG_CLASS = None on GLM5Bridge and BagelBridge is now the default and is removed. test_bridge_can_explicitly_disable_model_config is parametrized over every registered bridge. Signed-off-by: Eugenio "Jay" Zuccarelli <11176606+jayzuccarelli@users.noreply.github.com>
…ge test Signed-off-by: Eugenio "Jay" Zuccarelli <11176606+jayzuccarelli@users.noreply.github.com>
|
@cuichenx thanks, switched to that approach.
I also removed the explicit |
|
/ok to test 0ef959a |
|
Automatic Claude reviews have been retired. To request a pull-request review, post a comment containing: Add |
|
The link check failed on retired documentation targets, which are now corrected on main. Could you bring in current main and rerun validation? The Qwen3 review thread also looks addressed and can be resolved. |
…ct-unmigrated Signed-off-by: Eugenio "Jay" Zuccarelli <11176606+jayzuccarelli@users.noreply.github.com>
|
@aroshanghias-nvd done: merged current main (no conflicts, same 8 files in the diff) and resolved the Qwen3 thread. CI is re-running. |
|
/ok to test 69e2521 |
…configs After #6305, MODEL_CONFIG_CLASS defaults to None and each family opts in. Set MODEL_CONFIG_CLASS = BridgeGPTModelConfig on the bridges this PR migrates, matching Qwen3 and Llama, and assert it in their tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kamran Jafari <kjafarisadeg@nvidia.com>
…configs After #6305, MODEL_CONFIG_CLASS defaults to None and each family opts in. Set MODEL_CONFIG_CLASS = BridgeGPTModelConfig on the bridges this PR migrates, matching Qwen3 and Llama, and assert it in their tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kamran Jafari <kjafarisadeg@nvidia.com>
…configs After #6305, MODEL_CONFIG_CLASS defaults to None and each family opts in. Set MODEL_CONFIG_CLASS = BridgeGPTModelConfig on the bridges this PR migrates, matching Qwen3 and Llama, and assert it in their tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kamran Jafari <kjafarisadeg@nvidia.com>
…configs After #6305, MODEL_CONFIG_CLASS defaults to None and each family opts in. Set MODEL_CONFIG_CLASS = BridgeGPTModelConfig on the bridges this PR migrates, matching Qwen3 and Llama, and assert it in their tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kamran Jafari <kjafarisadeg@nvidia.com>
What does this PR do ?
Makes the builder-backed config path opt-in per model family. Builder calls for families that have not migrated now raise instead of returning a wrong config, and the provider path no longer tells those families to switch.
Every bridge used to inherit MODEL_CONFIG_CLASS = BridgeGPTModelConfig, but only the migrated families map their HF config into it. For the rest, get_model_config() returned generic defaults and to_megatron_provider() warned users toward it.
Changelog
Testing
CPU only, no TransformerEngine (stubbed locally). Run against unmodified main, the updated test file gives 65 failed, 9 passed, 1 skipped; with this change it gives 74 passed, 1 skipped.
Unchanged between main and this branch: models/llama 44 passed, models/qwen 118 passed, models/glm_moe_dsa 25 passed, models/bagel conversion/checkpoint/dependencies 16 passed and 1 skipped, test_gpu_backend.py 21 passed, test_vlm_generation.py 7 passed, test_llama_recipes.py 105 passed, test_llama_perf_recipes.py 16 passed, test_qwen3_recipes.py 24 passed. test_auto_bridge.py: 97 passed, with the same 5 failures before and after locally (they need TE or a writable /tmp/output). The Muse Glimmer tests need real TransformerEngine and were not run locally; no Muse Glimmer file changed. ruff check and format clean.
Additional Information
AI-assisted (Claude Code); I reviewed the change and ran the tests.