Skip to content

Use getattr in standardize_rope_params because rope_parameters not always present#42593

Merged
hmellor merged 1 commit intohuggingface:mainfrom
hmellor:fix-rope-parameters
Dec 3, 2025
Merged

Use getattr in standardize_rope_params because rope_parameters not always present#42593
hmellor merged 1 commit intohuggingface:mainfrom
hmellor:fix-rope-parameters

Conversation

@hmellor
Copy link
Member

@hmellor hmellor commented Dec 3, 2025

Some custom models written for v4 will specify rope_theta but not rope_scaling/rope_parameters. In this case, there was an attribute error when accessing rope_parameters in standardize_rope_params. This PR fixes that.

…not always present

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

This fn was simplified a lot in the prev PR since we can make a few assumptions about inputs. Looks like it will still work with custom models, as long as they have single rope per model. Thanks for fixing

@hmellor hmellor merged commit 232ecf2 into huggingface:main Dec 3, 2025
23 checks passed
@hmellor hmellor deleted the fix-rope-parameters branch December 3, 2025 12:04
sarathc-cerebras pushed a commit to sarathc-cerebras/transformers that referenced this pull request Dec 7, 2025
…not always present (huggingface#42593)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Jan 23, 2026
…not always present (huggingface#42593)

Signed-off-by: Harry Mellor <19981378+hmellor@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