Apply linear rope_scaling in model builder for Neutts/nano - #2142
Merged
Conversation
- This is used in NeuTTS model: neuphonic/neutts-nano Linear RoPE configs (rope_type/type "linear" with factor) were ignored in make_rope_init, so inv_freq matched unscaled RoPE and diverged from Transformers (_compute_linear_scaling_rope_parameters: inv_freq /= factor). Set rope_attrs["rescale_factors"] to the config factor so make_rotary_embedding_caches_from_scratch matches HF (e.g. neutts-nano). Reject non-positive factors with a clear error.
Contributor
Author
|
@microsoft-github-policy-service agree company="AMD" |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing support in the Python model builder for Hugging Face-style linear RoPE scaling (e.g., neuphonic/neutts-nano) by applying the scaling factor when generating rotary embedding caches, matching Transformers’ inv_freq /= factor behavior.
Changes:
- Handle
rope_scalingconfigs whererope_type/type == "linear"by settingself.rope_attrs["rescale_factors"]to the configured factor. - Validate
rope_scaling["factor"]is positive and raise a clearValueErrorotherwise. - Update the file header comments.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
@kunal-vaishnavi pls review. |
kunal-vaishnavi
previously approved these changes
May 15, 2026
kunal-vaishnavi
dismissed
their stale review
May 18, 2026 08:33
Need to remove print statement before approving
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
kunal-vaishnavi
approved these changes
May 18, 2026
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.
Model builder support for TTS models from neuphonic
This is used in NeuTTS model: neuphonic/neutts-nano
Linear RoPE configs (rope_type/type "linear" with factor) were ignored in make_rope_init, so inv_freq matched unscaled RoPE and diverged from Transformers (_compute_linear_scaling_rope_parameters: inv_freq /= factor). Set rope_attrs["rescale_factors"] to the config factor so make_rotary_embedding_caches_from_scratch matches HF (e.g. neutts-nano). Reject non-positive factors with a clear error.