[Gemma4] Fix dtype casting for quantized vision/audio embedders#46933
Open
sharmax-vikas wants to merge 1 commit into
Open
[Gemma4] Fix dtype casting for quantized vision/audio embedders#46933sharmax-vikas wants to merge 1 commit into
sharmax-vikas wants to merge 1 commit into
Conversation
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: gemma4 |
Contributor
|
CI Dashboard: View test results in Grafana |
5 tasks
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?
Applies the same
is_floating_pointguard from PR #46904 (which fixedgemma4_unified) to thegemma4model, which has the same bug.Bug
In
Gemma4VisionPatchEmbedder.forward()andGemma4AudioSubSampleConvProjectionLayer.forward(), the code does:When loaded with quantization (e.g.
BitsAndBytesConfig(load_in_4bit=True)),weight.dtypereturnstorch.uint8/torch.int8. This silently casts float pixel values to integers, destroying image/audio data. The model produces garbage outputs with no error.Fix
Add
is_floating_pointguard (same pattern as #46904):Fixes #46932
Before submitting