[OpenVINO] Support Gemma 4#1688
Merged
regisss merged 235 commits intohuggingface:mainfrom May 1, 2026
Merged
Conversation
rkazants
commented
Apr 29, 2026
rkazants
commented
Apr 29, 2026
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
echarlaix
reviewed
Apr 29, 2026
Collaborator
echarlaix
left a comment
There was a problem hiding this comment.
Thanks for the addition!
| dummy_inputs["token_type_ids"] = self.orig_export_config.DUMMY_INPUT_GENERATOR_CLASSES[ | ||
| 0 | ||
| ].random_int_tensor(token_type_ids_shape, min_value=0, max_value=2) | ||
| if "per_layer_inputs" in self.inputs: |
Collaborator
There was a problem hiding this comment.
when will this be the case ?
Collaborator
There was a problem hiding this comment.
It's the additional input of the language model for Gemma4. In original Gemma4 they are calculated inside of language model forward, but to calculate them we need input_ids, which we don't pass to language model, so we decided to move them to the separate model for the minimal API impact.
Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>
regisss
reviewed
Apr 30, 2026
Contributor
regisss
left a comment
There was a problem hiding this comment.
Adding a few comments to @echarlaix's
sbalandi
pushed a commit
to sbalandi/openvino.genai
that referenced
this pull request
Apr 30, 2026
<!-- Keep your pull requests (PRs) as atomic as possible. That increases the likelihood that an individual PR won't be stuck because of adjacent problems, merge conflicts, or code review. Your merged PR is going to appear in the automatically generated release notes on GitHub. So the clearer the title the better. --> ## Description <!-- Please include a summary of the change. Also include relevant motivation and context. --> Depends on: huggingface/optimum-intel#1688 optimum-intel PR depends on transformers v5 (**update**: transformers v5 support merged to optimum-intel). ### WWB Accuracy: genai vs optimum-intel: 0.9682357 genai vs transformers: 0.94821364 optimum-intel vs transformers: 0.9387633 Fixes: openvinotoolkit#3653 Current implementation support image text inputs only. Ticket for video support implementation: 185850 ## Checklist: - [x] This PR follows [GenAI Contributing guidelines](https://github.com/openvinotoolkit/openvino.genai?tab=contributing-ov-file#contributing). <!-- Always follow them. If there are deviations, explain what and why. --> - [x] Tests have been updated or added to cover the new code. <!-- Specify exactly which tests were added or updated. If the change isn't maintenance related, update the tests at https://github.com/openvinotoolkit/openvino.genai/tree/master/tests or explain in the description why the tests don't need an update. --> - [x] This PR fully addresses the ticket. <!--- If not, explain clearly what is covered and what is not. If follow-up pull requests are needed, specify in the description. --> - [x] I have made corresponding changes to the documentation. <!-- Run github.com/\<username>/openvino.genai/actions/workflows/deploy_gh_pages.yml on your fork with your branch as a parameter to deploy a test version with the updated content. Replace this comment with the link to the built docs. If the documentation is updated in a separate PR, clearly specify it. -->
regisss
approved these changes
May 1, 2026
This was referenced May 5, 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.
What does this PR do?
Fixes 182357
Re-created from PR #1675
Installation instructions:
Exporting cmd-line:
optimum-cli export openvino -m google/gemma-4-E2B-it ov_gemma4_E2Bit --task=image-text-to-textInference script:
Before submitting