Skip to content
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

ENH: Add default target layers for gemma2 architecture #2078

Merged

Conversation

BenjaminBossan
Copy link
Member

Google's gemma 2 models have a slightly different architecture than gemma 1 and thus a different model_type attribute. This PR adds default target_layers for gemma 2 that correspond to the default target_layers of gemma 1.

Google's gemma 2 models have a slightly different architecture than
gemma 1 and thus a different model_type attribute. This PR adds default
target_layer for gemma 2 that correspond to the default target_layer of
gemma 1.
@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

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

LGTM ! Left a comment

Comment on lines 74 to 75
"gemma": ["input_layernorm", "post_attention_layernorm", "norm"],
"gemma2": ["input_layernorm", "norm"],
Copy link
Member

Choose a reason for hiding this comment

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

Is it normal that they are not the same since you said that it was the same layers as gemma1 in the description of the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what I did there, I checked again and gemma2 has in fact more layer norm layers than gemma1, not fewer. I updated the targets accordingly.

@BenjaminBossan BenjaminBossan merged commit 5efeba1 into huggingface:main Sep 23, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the enh-target-layers-for-gemma2 branch September 23, 2024 09:15
yaswanth19 pushed a commit to yaswanth19/peft that referenced this pull request Sep 23, 2024
)

Google's gemma 2 models have a slightly different architecture than
gemma 1 and thus a different model_type attribute. This PR adds default
target_layer for gemma 2 that correspond to the default target_layer of
gemma 1.

LayerNorm tuning adds one more LN layer.
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