Fix Gemma model detection and Gemma-2 2B attn_types config#1227
Merged
jlarson4 merged 1 commit intoTransformerLensOrg:mainfrom Mar 31, 2026
Merged
Conversation
Fix "gemma-2" substring match incorrectly classifying Gemma v1 "gemma-2b"
as Gemma2ForCausalLM by requiring trailing hyphen ("gemma-2-"). Also fix
Gemma-2 2B attn_types having 42 entries for 26 layers (changed *21 to *13).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
"gemma-2b" was being detected as having architecture "Gemma2ForCausalLM" since it starts with "gemma-2", but it's actually a v1 model. "gemma-2-2b" (and actual v2 model) lists 42 entries for attn_types but only has 26 layers (this was probably a copy+paste from gemma-2-9b).
Neither of these cause real problems right now but they're confusing and could cause problems if this code was refactored.
Type of change
Please delete options that are not relevant.
Checklist: