fix: don't cast Silero VAD to fp16 (MPSGraph abort with --fp16 --vad)#32
fix: don't cast Silero VAD to fp16 (MPSGraph abort with --fp16 --vad)#32anubissbe wants to merge 2 commits into
Conversation
SileroVAD::to_half() casts the VAD weights but leaves its context buffer, LSTM state and audio input in fp32. With an fp16 transcriber, enable_vad() therefore builds a mixed-dtype graph and MPSGraph aborts the process: 'mps.add' op requires the same element type for all operands and results %3 = "mps.add"(%arg0, %arg1) : (tensor<1x512xf32>, tensor<512xf16>) failed assertion `Error: MLIR pass manager failed' use_fp16_ in SileroVAD is written but never read, so the cast has nothing backing it. Drop the cast at the three enable_vad() call sites; the VAD still moves to GPU. It is a ~1.2 MB preprocessor emitting segment boundaries rather than tensors entering the ASR graph, so fp32 is numerically irrelevant here. Fixes Frikallo#31 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughVAD setup no longer converts Silero VAD to FP16 in standard, TDT, or diarized transcription paths. VAD remains FP32, while GPU placement continues when enabled. ChangesVAD precision handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/api/diarize.cpp`:
- Around line 78-79: Update the comment near the VAD casting logic to reference
Transcriber::enable_vad instead of ParakeetTranscriber::enable_vad, preserving
the rest of the explanation unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b8d604ee-5dba-47e2-931e-05da4762d7a3
📒 Files selected for processing (2)
include/parakeet/api/transcribe.hppsrc/api/diarize.cpp
The comment pointed at ParakeetTranscriber::enable_vad, which does not exist. The declaring class is Transcriber (include/parakeet/api/transcribe.hpp). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fixes the MPSGraph abort described in #31.
Problem
enable_vad()callsvad_->to_half()whenever the transcriber is fp16.SileroVAD::to_half()casts the VAD weights but leaves its context buffer, LSTM state and audio input in fp32, so the first inference builds a mixed-dtype graph and MPSGraph aborts the process:use_fp16_inSileroVADis written but never read, so the cast has nothing backing it.Change
Stop casting the VAD to fp16 at the three
enable_vad()call sites (ParakeetTranscriber,TDTTranscriber,DiarizedTranscriber). The VAD still moves to GPU; only the dtype cast is dropped.This is deliberately the conservative fix rather than making fp16 VAD work: the VAD is a ~1.2 MB preprocessor whose output is segment boundaries, not tensors entering the ASR graph, so fp32 costs essentially nothing. Making it genuinely fp16 would require the context buffer, LSTM state, input window and the
typed_data<float>()result read inprocess_chunk()all made dtype-aware, plus confirmation that the Silero LSTM is stable in fp16 — which felt like your call to make.Verification
On macOS 27.0 / Apple Silicon, Metal build, model
parakeet-tdt-0.6b-v3(tdt-600m):--fp16 --vad, requestuse_vad: true--fp16 --vad, requestuse_vad: false--fp16, no VADTranscript output is unchanged in every case that already worked, and VAD segmentation is identical to the fp32 path (verified on a 20.4 s clip: 6 speech segments, 19.7 s speech / 20.4 s total, same word output).
clang-formatreports no new violations on the touched files.🤖 Generated with Claude Code
Summary by CodeRabbit