fix(voice-to-text): per-module dtype so the Whisper session loads - #72
Merged
Conversation
Reported: 'Can't create a session … MatMulNBits Missing required scale:
model.decoder.embed_tokens.weight … DequantizeLinear'.
Whisper is an encoder-decoder model. A single-string dtype ('q8', the WASM
default) left the decoder — which holds embed_tokens — on a 4-bit (MatMulNBits)
variant whose scale tensor the bundled ONNX Runtime can't resolve, so the
session fails to create. Switch to a per-module dtype and force
decoder_model_merged to fp32 (unquantized, proper scales); the encoder stays
q8 on WASM / fp32 on WebGPU to limit the download.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Reported:
Can't create a session … MatMulNBits Missing required scale: model.decoder.embed_tokens.weight …Cause: Whisper is encoder-decoder. A single-string
dtype: 'q8'(the WASM default) left the decoder (which holdsembed_tokens) on a 4-bit MatMulNBits variant whose scale tensor the bundled ONNX Runtime can't resolve → session creation fails.Fix: per-module dtype — force
decoder_model_merged: 'fp32'(unquantized, valid scales); encoder staysq8on WASM /fp32on WebGPU to limit the download.Not headless-verifiable (needs real model download in a browser) — needs a smoke test after deploy.
🤖 Generated with Claude Code