[models]: add Gemma 4 E2B text support#3
Open
Carlos-Marques wants to merge 1 commit into
Open
Conversation
Co-Authored-By: carlos <carlosmarques.personal@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Adds a Gemma 4 text-path model implementation registered as
gemma4, using the upstream vLLM/HF Gemma4 text architecture as the reference and NxDI primitives for inference:The implementation includes Gemma4 RMSNorm, PLE gates/projections, double-wide MLP sizing for KV-shared tail layers, final-logit softcapping in the LM head, and state-dict conversion for
language_model.model.*/model.language_model.*checkpoints.Model Information
Model Name: Gemma 4 E2B / Gemma 4 E2B-it
Model Architecture: Decoder-only Gemma4 text transformer with mixed sliding/full attention
Purpose: Text generation
Checklist
Required Components
test/integration/test_model.py)src/)src/neuronx_distributed_inference/models/gemma4/modeling_gemma4.pyMODEL_TYPES["gemma4"]registrationOptional Components
test/unit/models/gemma4/test_modeling_gemma4.pyFolder Structure
This PR adds an in-tree model under:
Testing
How did you test this change?
Local static/syntax checks only; the local environment does not have the repo test dependencies (
torch,pytest) installed.Test Results:
All commands above passed locally.
Compatibility
Tested with:
Additional Information
The implementation targets the Gemma4 text path only; multimodal audio/vision encoders are intentionally out of scope. Upstream reference analyzed: vLLM
Gemma4ForCausalLM/Gemma4Model/Gemma4Attentionand HFGemma4Text*implementations.Related Issues
N/A
vLLM Integration
By submitting this PR, I confirm that:
Link to Devin session: https://app.devin.ai/sessions/8501976bc5364801a8d6d8b8b768a547
Requested by: @Carlos-Marques