Fix accessing final norm for Gemma-3 models#1687
Merged
Merged
Conversation
nenad1002
previously approved these changes
Aug 19, 2025
nenad1002
approved these changes
Aug 20, 2025
kunal-vaishnavi
added a commit
that referenced
this pull request
Sep 18, 2025
### Description This PR replaces any references to `NvTensorRtRtx` with `trt-rtx` except in the GenAI config file. ### Motivation and Context This abbreviation reduces [potential bugs](#1687 (comment)) that can be raised while using the EP name in the model builder. It also preserves the original intention to keep EP names short and brief.
kunal-vaishnavi
added a commit
that referenced
this pull request
Dec 20, 2025
### Description This PR adds a tutorial to show how to create the ONNX models for Gemma-3 vision (4B, 12B, 27B). ### Motivation and Context This PR requires the changes from the following PRs. - #1374 - #1687 - #1701 - #1786 This PR also resolves the following issues. - #1329 - #1536 - #1655 - #1698
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
This PR fixes how the final norm is identified for the Gemma-3 models. It works with the latest version of Hugging Face's
transformers(v4.55.2).Motivation and Context
Previous versions of
transformerswould modify the class structure for the Gemma-3 models as breaking changes. Sincetransformershas landed on a stable way to load multi-modal models withAutoModelForCausalLMfor now, the current approach is to identify the path tomodel.model.language_model.normfor the Gemma-3 models that are multi-modal.Gemma-3 1B's final norm is accessible at
model.model.normwhile Gemma-3 4B's final norm is accessible atmodel.model.language_model.norm. For PEFT's decoder-only models, the core model is accessible atmodel.base_model.modeland the final norm is usually accessible atmodel.base_model.model.model.norm.We can read the parent-most class name to identify whether a model is from PEFT or not. One advantage with this approach is that it allows any adaptations in the path to the final norm of a Transformers model to still be found in the PEFT version of that model.