Add the YARN support for hybrid_model - #4244
Merged
Merged
Conversation
Member
|
/ok to test c7c9d79 |
Contributor
Author
|
/ok to test 3ace27b |
Member
|
/claude review |
jaredcasper
approved these changes
Apr 10, 2026
5 tasks
Phlip79
approved these changes
Apr 13, 2026
janEbert
reviewed
Apr 13, 2026
guihong-nv
enabled auto-merge
April 21, 2026 12:18
guihong-nv
disabled auto-merge
April 21, 2026 12:18
Phlip79
enabled auto-merge
April 23, 2026 04:55
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Apr 23, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/24838266239 |
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Apr 23, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/24867274470 |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 24, 2026
Member
|
/ok to test 5f895dd |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/24872833192 |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/24873177343 |
yangbofun
pushed a commit
to xlm-research/Megatron-LM
that referenced
this pull request
May 22, 2026
Co-authored-by: Philip Petrakian <ppetrakian@nvidia.com>
yhgalaxy
pushed a commit
to yhgalaxy/Megatron-LM
that referenced
this pull request
Jun 17, 2026
Co-authored-by: Philip Petrakian <ppetrakian@nvidia.com> Signed-off-by: yhgalaxy <yhgalaxy@outlook.com>
6 tasks
guihong-nv
added a commit
to guihong-nv/Megatron-LM
that referenced
this pull request
Jun 23, 2026
HybridModel already builds YarnRotaryEmbedding from getattr(self.config, "yarn_*") (NVIDIA#4244), but those attributes were never declared on TransformerConfig and had no CLI plumbing, so --position-embedding-type yarn raised AttributeError and YaRN could not be configured from the command line. - transformer_config.py: declare the 7 yarn_* fields with safe defaults (yarn_rotary_scaling_factor default 1.0 is a no-op). - arguments.py: add matching --yarn-* args; dest names match the field names so core_transformer_config_from_args plumbs them through automatically. - test_hybrid_model.py: drive the yarn test config via the constructor and add tests for the dataclass fields and config->embedding plumbing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Guihong Li <guihongl@nvidia.com>
This was referenced Jun 23, 2026
jon-barker
pushed a commit
to jon-barker/Megatron-LM
that referenced
this pull request
Jul 10, 2026
Co-authored-by: Philip Petrakian <ppetrakian@nvidia.com> Signed-off-by: Jon Barker <jbarker@aws-cmh-slurm-1-vscode-02.cm.cluster>
terminator123
pushed a commit
to 021ai/Megatron-LM
that referenced
this pull request
Aug 3, 2026
Co-authored-by: Philip Petrakian <ppetrakian@nvidia.com>
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.
Add YaRN positional embedding support to MambaModel
Summary
megatron/core/models/mamba/mamba_model.py: Extendedposition_embedding_typeto accept'yarn'. Adds aYarnRotaryEmbeddingin__init__and calls it inforward(discarding the returned mscale), mirroring the existing RoPE path.mamba_builders.py: Injects YaRN-specific config attributes (yarn_rotary_scaling_factor,yarn_original_max_position_embeddings,yarn_beta_fast,yarn_beta_slow,yarn_mscale,yarn_mscale_all_dim,yarn_correction_range_round_to_int) ontoTransformerConfigbeforeMambaModelis constructed, sopretrain_mamba.pycan accept--position-embedding-type yarn.megatron/training/arguments.py: Added'yarn'to the allowed values for--position-embedding-type.tests/unit_tests/models/test_mamba_model.py: AddedTestMambaModelWithYarnwith three tests — constructor (checksYarnRotaryEmbeddingis created), forward pass, and inference (static context, prefill + decode steps).Contribution process
Pre-checks
Code review
Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.
For MRs into `dev` branch
The proposed review process for `dev` branch is under active discussion.MRs are mergable after one approval by either
eharper@nvidia.comorzijiey@nvidia.com.