Skip to content

fix attribute access in PermuteForRope._apply - #45756

Open
CharlieKerfoot wants to merge 1 commit into
huggingface:mainfrom
CharlieKerfoot:fix/calls-self-config-getattr
Open

fix attribute access in PermuteForRope._apply#45756
CharlieKerfoot wants to merge 1 commit into
huggingface:mainfrom
CharlieKerfoot:fix/calls-self-config-getattr

Conversation

@CharlieKerfoot

Copy link
Copy Markdown
Contributor

Summary

PermuteForRope._apply in src/transformers/core_model_loading.py:387 calls self.config.getattr("num_attention_heads", 1), but config objects have no getattr method, so this raises AttributeError every time the op runs.

Fix

Use the builtin getattr(self.config, "num_attention_heads", 1) to read the attribute with a default fallback, matching the original intent.

Tests

Loading a model that exercises PermuteForRope no longer raises AttributeError on the config lookup.

@Rocketknight1

Copy link
Copy Markdown
Member

cc @ArthurZucker since it was added in #41580 - bug looks real but I think this is dead code that never gets called. Can we just remove the class?

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