Skip to content

Gemma3 hybrid fix - #42287

Merged
zucchini-nlp merged 4 commits into
mainfrom
gemma3-hybrid-fix
Nov 24, 2025
Merged

zucchini-nlp merged 4 commits into
mainfrom
gemma3-hybrid-fix

Conversation

@remi-or

@remi-or remi-or commented Nov 19, 2025

Copy link
Copy Markdown
Collaborator

In gemma3 modeling tests, there are still mentions of the deprecated cache type hybrid
This PR removes those mentions and adjust the expectations when needed.

@remi-or

remi-or commented Nov 19, 2025

Copy link
Copy Markdown
Collaborator Author

run-slow: gemma3

@github-actions

Copy link
Copy Markdown
Contributor

This comment contains run-slow, running the specified jobs:

models: ["models/gemma3"]
quantizations: []

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@github-actions

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Model CI Report

❌ Failed tests

  • gemma3:
    tests/models/gemma3/test_modeling_gemma3.py::Gemma3IntegrationTest::test_model_4b_batch

@remi-or

remi-or commented Nov 19, 2025

Copy link
Copy Markdown
Collaborator Author

run-slow: gemma3

@github-actions

Copy link
Copy Markdown
Contributor

💔 This comment contains run-slow, but unknown error occurred and the workflow run aborted!

@remi-or

remi-or commented Nov 19, 2025

Copy link
Copy Markdown
Collaborator Author

run-slow: gemma3

@github-actions

Copy link
Copy Markdown
Contributor

This comment contains run-slow, running the specified jobs:

models: ["models/gemma3"]
quantizations: []

@github-actions

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

✅ No failing test specific to this PR 🎉 !

Comment on lines 603 to 607

# cache_implementation="hybrid" an in the original transformers implementation
output = model.generate(**inputs, max_new_tokens=30, do_sample=False, cache_implementation="hybrid")
output = model.generate(**inputs, max_new_tokens=30, do_sample=False, cache_implementation="static")
output_text = self.processor.batch_decode(output, skip_special_tokens=True)

EXPECTED_NUM_IMAGES = 3 # one for the origin image and two crops of images

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to replace "hybrid" with "static" cache, if we're not testing compile no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked about this with @Cyrilvallez , the choice we made was to put "dynamic" everywhere unless it did not match the expected result, in which case we used "static"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for clarifying

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: gemma3

@remi-or
remi-or requested a review from zucchini-nlp November 21, 2025 12:43

@zucchini-nlp zucchini-nlp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's run slow tests and merge after it turns ✅

Comment on lines 603 to 607

# cache_implementation="hybrid" an in the original transformers implementation
output = model.generate(**inputs, max_new_tokens=30, do_sample=False, cache_implementation="hybrid")
output = model.generate(**inputs, max_new_tokens=30, do_sample=False, cache_implementation="static")
output_text = self.processor.batch_decode(output, skip_special_tokens=True)

EXPECTED_NUM_IMAGES = 3 # one for the origin image and two crops of images

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for clarifying

@zucchini-nlp

Copy link
Copy Markdown
Member

run-slow: gemma3

@github-actions

Copy link
Copy Markdown
Contributor

This comment contains run-slow, running the specified jobs:

models: ["models/gemma3"]
quantizations: []

@github-actions

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

✅ No failing test specific to this PR 🎉 !

@zucchini-nlp
zucchini-nlp merged commit 3410ba9 into main Nov 24, 2025
19 checks passed
@zucchini-nlp
zucchini-nlp deleted the gemma3-hybrid-fix branch November 24, 2025 10:23
SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Jan 23, 2026
* Fix gemma3 on H100

* Partial fixes for Mi325

* First half of A10 fix

* Final A10 fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants