Skip to content

Apply linear rope_scaling in model builder for Neutts/nano - #2142

Merged
kunal-vaishnavi merged 4 commits into
microsoft:mainfrom
VishalX:neutts-air-nano
May 18, 2026
Merged

Apply linear rope_scaling in model builder for Neutts/nano#2142
kunal-vaishnavi merged 4 commits into
microsoft:mainfrom
VishalX:neutts-air-nano

Conversation

@VishalX

@VishalX VishalX commented May 8, 2026

Copy link
Copy Markdown
Contributor

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.

VishalX added 2 commits April 9, 2026 10:30
- 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.
@VishalX
VishalX requested a review from a team as a code owner May 8, 2026 05:59
Copilot AI review requested due to automatic review settings May 8, 2026 05:59
@VishalX

VishalX commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="AMD"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_scaling configs where rope_type/type == "linear" by setting self.rope_attrs["rescale_factors"] to the configured factor.
  • Validate rope_scaling["factor"] is positive and raise a clear ValueError otherwise.
  • Update the file header comments.

Comment thread src/python/py/models/builders/base.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@VishalX

VishalX commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@kunal-vaishnavi pls review.

@kunal-vaishnavi
kunal-vaishnavi dismissed their stale review May 18, 2026 08:33

Need to remove print statement before approving

Comment thread src/python/py/models/builders/base.py Outdated
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants