Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix Gemma 4 audio inference dtype mismatch - #308

#308
Draft
Auro-rium wants to merge 1 commit into
unslothai:mainunslothai/notebooks:mainfrom
Auro-rium:agent/fix-gemma4-audio-dtypeAuro-rium/notebooks:agent/fix-gemma4-audio-dtypeCopy head branch name to clipboard
Draft

Fix Gemma 4 audio inference dtype mismatch#308
Auro-rium wants to merge 1 commit into
unslothai:mainunslothai/notebooks:mainfrom
Auro-rium:agent/fix-gemma4-audio-dtypeAuro-rium/notebooks:agent/fix-gemma4-audio-dtypeCopy head branch name to clipboard

Conversation

@Auro-rium

Copy link
Copy Markdown

Summary

  • Cast multimodal processor outputs to model.dtype before Gemma 4 generation.
  • Prevents the T4 audio path from mixing Float audio features with Half model tensors.

Root cause

The notebook moved processor outputs to CUDA but did not normalize floating-point dtypes. On a T4, Gemma 4 runs in FP16 while audio features can remain FP32, causing masked_scatter_ to fail with a Float/Half mismatch during multimodal fusion.

Change

Updated the inference helper to use .to("cuda", dtype=model.dtype). Integer token IDs remain integer tensors.

Validation

  • Notebook parses as valid JSON.
  • git diff --check passes.
  • Saved T4 notebook outputs show successful text, image, audio, and audio+image inference.
  • Saved notebook contains zero error outputs.
  • A fresh authenticated T4 rerun is still recommended for maintainer confirmation.

Note

This patch was prepared with assistance from Codex.

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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.