fix gemma2 checkpoint conversion validation check#3514
Merged
copybara-service[bot] merged 1 commit intomainfrom Mar 28, 2026
Merged
fix gemma2 checkpoint conversion validation check#3514copybara-service[bot] merged 1 commit intomainfrom
copybara-service[bot] merged 1 commit intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
bvandermoon
approved these changes
Mar 27, 2026
|
🤖 Hi @gagika, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 I'm sorry @gagika, but I was unable to process your request. Please see the logs for more details. |
hengtaoguo
approved these changes
Mar 28, 2026
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
Fix Gemma 2 architecture validation during Hugging Face conversion
This updates the
_validate_or_update_architecturelogic into_huggingface.pyto correctly handle Gemma 2 specific discrepancies:num_hidden_layers: MaxText bundles local and global attention layers into a singleGemma2DecoderLayer, halving the layer count relative to Hugging Face. The validation now multiplies the MaxText layer count by 2 for Gemma 2 before comparison.vocab_size: MaxText pads vocabulary sizes up to multiples of 128 or 256 for optimal TPU efficiency (e.g., 256128 instead of 256000). The logic now gracefully accepts a padded vocab size up to a 256-token difference.Tests
Tested locally
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.