-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use head_dim if in config for RoPE #32495
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM that looks like a regression (for llama at least) cc @gante !
@gante could you please take a look at this PR ? |
Hi @ArthurZucker @gante , may I ask if there is any update on this ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's simplify and good to go otherwise 🤗
@@ -58,7 +58,8 @@ def _compute_default_rope_parameters( | |||
elif config is not None: | |||
base = config.rope_theta | |||
partial_rotary_factor = config.partial_rotary_factor if hasattr(config, "partial_rotary_factor") else 1.0 | |||
dim = int((config.hidden_size // config.num_attention_heads) * partial_rotary_factor) | |||
head_dim = config.head_dim if hasattr(config, "head_dim") else config.hidden_size // config.num_attention_heads |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
head_dim = config.head_dim if hasattr(config, "head_dim") else config.hidden_size // config.num_attention_heads | |
head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching this! just fixed!
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool thanks for updating
* use head_dim if in config for RoPE * typo * simplify with getattr
* use head_dim if in config for RoPE * typo * simplify with getattr
* use head_dim if in config for RoPE * typo * simplify with getattr
What does this PR do?
Fixes issue that when head_dim * num_attention_heads != hidden_size, the RoPE is not initialized correctly
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.