Fix Gemma4 MoE parameter mappings#3554
Merged
copybara-service[bot] merged 1 commit intomainfrom Apr 2, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
aireenmei
approved these changes
Apr 2, 2026
hengtaoguo
approved these changes
Apr 2, 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. |
There was a problem hiding this comment.
The pull request successfully updates the Gemma 4 MoE parameter mappings to match the refactored Hugging Face weights. It also includes several improvements to the end-to-end test scripts, such as fixing path typos and correcting variable names in comments.
🔍 General Feedback
- The parameter mapping changes in
src/maxtext/checkpoint_conversion/utils/param_mapping.pyare consistent across the model configuration. - The correction of
//base.ymlto/base.ymlin the shell scripts is a small but important fix for path reliability. - I've noted a change in the
USE_MULTIMODALflag in the test scripts; please verify if this change is intended to be permanent for these specific tests.
| TOKENIZER_PATH='google/gemma-4-26b-a4b-it' | ||
| # To convert the multimodal model, make sure the use_multimodal is set to be true | ||
| USE_MULTIMODAL=true | ||
| USE_MULTIMODAL=false |
There was a problem hiding this comment.
🟡 The `USE_MULTIMODAL` flag has been changed from `true` to `false`. If these tests are intended to verify multimodal capabilities for Gemma 4, this change will disable that verification. Please confirm if this is intended.
Suggested change
| USE_MULTIMODAL=false | |
| USE_MULTIMODAL=false |
|
|
||
| # To get converted ckpt: | ||
| python3 -m maxtext.checkpoint_conversion.to_maxtext "${MAXTEXT_CONFIGS_DIR:-${MAXTEXT_REPO_ROOT:-$PWD}/src/maxtext/configs}"//base.yml \ | ||
| python3 -m maxtext.checkpoint_conversion.to_maxtext "${MAXTEXT_CONFIGS_DIR:-${MAXTEXT_REPO_ROOT:-$PWD}/src/maxtext/configs}"/base.yml \ |
There was a problem hiding this comment.
🟢 Good fix on the configuration path. The double slash `//` was likely a typo.
Suggested change
| python3 -m maxtext.checkpoint_conversion.to_maxtext "${MAXTEXT_CONFIGS_DIR:-${MAXTEXT_REPO_ROOT:-$PWD}/src/maxtext/configs}"/base.yml \ | |
| python3 -m maxtext.checkpoint_conversion.to_maxtext "${MAXTEXT_CONFIGS_DIR:-${MAXTEXT_REPO_ROOT:-$PWD}/src/maxtext/configs}"/base.yml \ |
| TOKENIZER_PATH='google/gemma-4-26b-a4b' | ||
| # To convert the multimodal model, make sure the use_multimodal is set to be true | ||
| USE_MULTIMODAL=true | ||
| USE_MULTIMODAL=false |
There was a problem hiding this comment.
🟡 Similar to the other 26b script, `USE_MULTIMODAL` is set to `false`. Please ensure this is the desired state for these end-to-end tests.
Suggested change
| USE_MULTIMODAL=false | |
| USE_MULTIMODAL=false |
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
Update Gemma 4 MoE parameter mappings for refactored HF weights
Tests
End to end Gemma4-26b model with and without scan
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.