Fix Gemma4 shared KV export compatibility for transformer 5.12.0 with older support as well#1794
Open
dhandhalyabhavik wants to merge 2 commits into
Open
Fix Gemma4 shared KV export compatibility for transformer 5.12.0 with older support as well#1794dhandhalyabhavik wants to merge 2 commits into
dhandhalyabhavik wants to merge 2 commits into
Conversation
rkazants
approved these changes
Jun 17, 2026
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
rkazants
reviewed
Jun 17, 2026
rkazants
left a comment
Collaborator
There was a problem hiding this comment.
please set MAX_TRANSFORMERS_VERSION=5.12.99 here https://github.com/huggingface/optimum-intel/blob/main/optimum/exporters/openvino/model_configs.py#L1289
the same we need here https://github.com/huggingface/optimum-intel/blob/main/optimum/exporters/openvino/model_configs.py#L3844 both min and max version. It helps to avoid bug issue report from the community
e5c04c0 to
f3226e4
Compare
rkazants
approved these changes
Jun 17, 2026
f3226e4 to
e14579f
Compare
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?
ov export for gemma4 models failed with recent transformers version 5.12.0 because it has changed internal model implementation of Gemma4. They started using
shared_kv_statesalong withpast_key_values. Older 5.5.0 implementation of gemma4 had onlypast_key_valueswithshared_kv_statesinside it.This patch adds support for latest transformers as well as old transformers.
Fixes # (issue)
#1785
Before submitting
Reference links
https://github.com/huggingface/transformers/blob/v5.12.1/src/transformers/models/gemma4/modeling_gemma4.py#L1234