Skip to content

feat: add linear rope type #1982

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

Merged
merged 8 commits into from
Apr 2, 2025
Merged

feat: add linear rope type #1982

merged 8 commits into from
Apr 2, 2025

Conversation

k223kim
Copy link
Contributor

@k223kim k223kim commented Mar 27, 2025

Gemma3 uses the following config for rope:

    "rope_scaling": {
      "factor": 8.0,
      "rope_type": "linear"
    },

I added a linear rope type within extra_configs so that it can properly calculate theta.

Currently the HF transformer version does not have Gemma3, so it is skipped for pytest. With the newest version, it passes the test: see here.

Copy link
Collaborator

@t-vi t-vi left a comment

Choose a reason for hiding this comment

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

I wonder if this could be simplified but just handling a case where low_freq_factor/low_freq_factor is not given and having smooth_factor=0 in this case.

Copy link
Contributor

@ali-alshaar7 ali-alshaar7 left a comment

Choose a reason for hiding this comment

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

LGTM!

@k223kim k223kim force-pushed the k223kim/add-linear-rope branch from 3174dcc to c4ef607 Compare March 27, 2025 14:39
@k223kim k223kim marked this pull request as ready for review March 27, 2025 14:39
@k223kim k223kim requested a review from lantiga as a code owner March 27, 2025 14:39
@k223kim k223kim requested a review from t-vi March 27, 2025 15:20
@Borda
Copy link
Member

Borda commented Mar 27, 2025

@k223kim you may need this bump #1969 or make the import optional

Copy link
Collaborator

@t-vi t-vi left a comment

Choose a reason for hiding this comment

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

Seems good, thank you.

We could have a versioned skip to auto-enable, or point out the version that has gemma3, but let's have it as is now.

@t-vi t-vi enabled auto-merge (squash) March 27, 2025 18:37
Copy link
Collaborator

@t-vi t-vi left a comment

Choose a reason for hiding this comment

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

Thank you @k223kim

@t-vi t-vi disabled auto-merge April 2, 2025 00:02
@t-vi t-vi merged commit 6eba533 into main Apr 2, 2025
10 of 15 checks passed
@t-vi t-vi deleted the k223kim/add-linear-rope branch April 2, 2025 00:02
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.

4 participants