Skip to content

RotaryEmbeddings change is not None -> isinstance(..., dict) - #39145

Merged
qubvel merged 1 commit into
huggingface:mainfrom
qubvel:fix-unbound-method-llama-rope
Jul 7, 2025
Merged

RotaryEmbeddings change is not None -> isinstance(..., dict)#39145
qubvel merged 1 commit into
huggingface:mainfrom
qubvel:fix-unbound-method-llama-rope

Conversation

@qubvel

@qubvel qubvel commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Small quality improvement of if/else statement for RotaryEmbeddings, motivated by static typechecking

The behaviour has slightly changed in case rope_scaling has an unexpected type:

Condition Before (Previous Behavior) After (Updated Behavior)
rope_scaling is a dict rope_type retrieved from dict rope_type retrieved from dict
rope_scaling is None rope_type = "default" rope_type = "default"
rope_scaling is an unexpected type Raises AttributeError: '<type>'
object has no attribute 'get'
rope_type = "default"

cc @gante

@qubvel
qubvel requested a review from gante July 1, 2025 10:32
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@qubvel
qubvel marked this pull request as ready for review July 3, 2025 10:57

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks 🤗

@qubvel
qubvel merged commit a3618d4 into huggingface:main Jul 7, 2025
21 checks passed
SwiftAkira pushed a commit to SwiftAkira/transformers that referenced this pull request Jul 11, 2025
rjgleaton pushed a commit to rjgleaton/transformers that referenced this pull request Jul 17, 2025
zaristei pushed a commit to zaristei/transformers that referenced this pull request Sep 9, 2025
zaristei pushed a commit to zaristei/transformers that referenced this pull request Sep 9, 2025
zaristei pushed a commit to zaristei/transformers that referenced this pull request Sep 9, 2025
zaristei pushed a commit to zaristei/transformers that referenced this pull request Sep 9, 2025
zaristei pushed a commit to zaristei/transformers that referenced this pull request Sep 9, 2025
zaristei pushed a commit to zaristei/transformers that referenced this pull request Sep 9, 2025
zaristei pushed a commit to zaristei/transformers that referenced this pull request Sep 9, 2025
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