Repository navigation
refactor(model): build Qwen2 and MiMo from builder-backed model configs - #6379
Open
kamran-nvidia wants to merge 2 commits into
Open
kamran-nvidia wants to merge 2 commits into
kamran-nvidia wants to merge 2 commits into
Conversation
Contributor
Author
|
/ok to test e4e13cd |
This was referenced Oct 9, 2026
Move Qwen2/Qwen2.5 onto the ModelConfig/ModelBuilder path, following Muse Glimmer and Qwen3: - Qwen2Bridge maps Hugging Face configs in hf_config_to_model_config_kwargs(); the deprecated provider path reuses the same kwargs, so provider_bridge() is no longer overridden. - USE_MODEL_CONFIG_FOR_CONVERSION = True: checkpoint import, the conversion scripts and the compare tool build Qwen2 through its ModelBuilder. - All 30 Qwen2/2.5 H100 recipes use get_model_config(). - Add Qwen2 bridge unit tests (none existed) and a strict builder-config recipe test. Signed-off-by: Kamran Jafari <kjafarisadeg@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MimoBridge extends the Qwen2 builder kwargs with its attention settings and MTP depth (mtp_num_layers, mtp_loss_scaling_factor) instead of overriding provider_bridge(). It inherits the Qwen2 conversion flag, so MiMo checkpoints convert through the ModelBuilder as well. Signed-off-by: Kamran Jafari <kjafarisadeg@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kamran-nvidia
force-pushed
the
kjafarisadeg/qwen2-mimo-model-config
branch
from
October 10, 2026 02:35
e4e13cd to
4903e5c
Compare
Contributor
Author
|
/ok to test 4903e5c |
kamran-nvidia
marked this pull request as ready for review
October 13, 2026 15:54
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Moves Qwen2/Qwen2.5 and MiMo onto the builder-backed
ModelConfig/ModelBuilderpath, for recipes and checkpoint conversion, following Muse Glimmer and #6365 (Qwen3).Builds on #6365 (merged). It reuses #6365's
TransformerConfigYaRN fields, without which Qwen2.5 YaRN checkpoints could not convert through the builder. Rebased ontomainafter #6365's squash-merge, so the PR now contains only the Qwen2 and MiMo commits.Changelog
Qwen2Bridge:provider_bridge()is replaced byhf_config_to_model_config_kwargs(), and the provider path reuses the same kwargs (hf_config_to_provider_kwargs). Provider-implied defaults are explicit (masked_softmax_fusion,rope_scaling=False,rope_scaling_factor=1.0,position_embedding_typeviasetdefault("rope")so YaRN is preserved).USE_MODEL_CONFIG_FOR_CONVERSION = True.MimoBridge(subclassesQwen2Bridge): extends the Qwen2 kwargs withqk_layernorm=False,add_qkv_bias=True, and MTP depth (mtp_num_layers,mtp_loss_scaling_factor=0.1) instead of overridingprovider_bridge(). It inherits the conversion flag.get_model_config().test_qwen2_bridge.py; Qwen2 had no bridge unit tests. It covers the direct builder mapping, provider/builder parity (tied, fp16, YaRN), and the YaRN transformer fields plus HF export.BridgeGPTModelConfig.Verification
Each family was validated separately on tiny random-weight checkpoints (single GB200 node, NeMo 26.10 container).
Conversion paths:
scripts/conversionGPU import at TP2 and export.AutoBridge.import_ckpt/export_ckpt.compare.py.roundtrip_checkpoint.Each was run on this branch and on
main.mainvs this branchget_model_config()vs providermain)main)run_config.yamlBridgeGPTModelConfig+GPTModelBuildermtp_num_layers1 / 0main-imported checkpoint)main, and this branch on amain-imported checkpointroundtrip_checkpointTP2Unit tests:
models/qwen,models/mimo,test_auto_bridge.py,recipes/qwen,test_qwen_recipes.pyanddoc_consistency.main(Megatron Core 8949def81): 528 passed, 1 skipped acrossmodels/qwen,models/mimo,recipes/qwen,test_qwen_recipes.py,test_auto_bridge.py,test_gpt_model_config.pyandtest_model_bridge.py.ruff check/ruff format --checkare clean (ruff 0.16.7;pre-commititself not run).Before your PR is "Ready for review"
Pre checks:
Additional Information
beta_fast/beta_slowstill fail at model construction, on both paths, exactly as onmain; fix(model): apply Hugging Face YaRN defaults for omitted rope_scaling keys #6367 fixes this for all GPT families.🤖 Generated with Claude Code