Skip to content

fix(sensevoice): pad to the lengths the loaded encoder accepts, so fp32 runs - #1096

Merged
Alex-Wengg merged 1 commit into
mainfrom
fix/sensevoice-fp32-input
Nov 1, 2026
Merged

Alex-Wengg merged 1 commit into
mainfrom
fix/sensevoice-fp32-input

Conversation

@Alex-Wengg

Copy link
Copy Markdown
Member

Why is this change needed?

Every SenseVoiceEncoderPrecision.fp32 transcription fails. The fp32 encoder (SenseVoiceSmall_fp32.mlmodelc) has one fixed [1, 1800, 560] input, but runEncoder pads to the fp16 encoder's buckets (SenseVoiceConfig.buckets), so Core ML rejects it:

MultiArray shape (1 x 256 x 560) does not match the shape (1 x 1800 x 560) specified in the model description

Found while reviewing #1082, on FLEURS en_us with fluidaudiocli sensevoice-transcribe <wav> --fp32.

What changes?

SenseVoiceManager reads the lengths its encoder's speech input accepts from the model description once, at init:

  • the enumerated buckets for fp16 and int8
  • 1800 for fp32

It then pads to the smallest one that fits.

Verification (macOS 27, M5 Pro, cached HF models)

  • --fp32 now transcribes. It decodes FLEURS en_us_0001 and en_us_0002 correctly; the fp16 encoder returns empty text on those clips (below).
  • fp16 and int8 output is byte-identical to main on 24 FLEURS clips (en/de/fr/es, 3 each, both precisions).
  • New SenseVoiceEncoderFrameCountsTests, gated on the cached models: fp16 resolves to SenseVoiceConfig.buckets, fp32 to [1800], and fp32 transcribes the real 16.9 s fixture. 11 SenseVoice tests pass.

Not fixed here

The fp16 and int8 encoders output all-NaN ctc_logits on some clips (2 of 6 FLEURS en clips), so the transcript and tags come back empty. It depends on the content, happens on every compute unit, and the fp32 encoder is clean. That needs a fixed fp16 conversion, not a host change.

🤖 Generated with Claude Code

…32 runs

The fp32 encoder has one fixed 1800-frame input, but the manager padded every input to the fp16 buckets, so every --fp32 call failed in Core ML. The accepted lengths now come from the encoder's own input description.
@Alex-Wengg
Alex-Wengg merged commit d11c64d into main Nov 1, 2026
5 of 15 checks passed
@Alex-Wengg
Alex-Wengg deleted the fix/sensevoice-fp32-input branch November 1, 2026 19:52
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Speaker Diarization Benchmark Results

Speaker Diarization Performance

Evaluating "who spoke when" detection accuracy

Metric Value Target Status Description
DER 15.1% <30% ✅ Diarization Error Rate (lower is better)
JER 24.9% <25% ✅ Jaccard Error Rate
RTFx 28.48x >1.0x ✅ Real-Time Factor (higher is faster)

Diarization Pipeline Timing Breakdown

Time spent in each stage of speaker diarization

Stage Time (s) % Description
Model Download 9.359 25.4 Fetching diarization models
Model Compile 4.011 10.9 CoreML compilation
Audio Load 0.021 0.1 Loading audio file
Segmentation 11.051 30.0 Detecting speech regions
Embedding 18.418 50.0 Extracting speaker voices
Clustering 7.367 20.0 Grouping same speakers
Total 36.840 100 Full pipeline

Speaker Diarization Research Comparison

Research baselines typically achieve 18-30% DER on standard datasets

Method DER Notes
FluidAudio 15.1% On-device CoreML
Research baseline 18-30% Standard dataset performance

Note: RTFx shown above is from GitHub Actions runner. On Apple Silicon with ANE:

  • M2 MacBook Air (2022): Runs at 150 RTFx real-time
  • Performance scales with Apple Neural Engine capabilities

🎯 Speaker Diarization Test • AMI Corpus ES2004a • 1049.0s meeting audio • 36.8s diarization time • Test runtime: 2m 54s • 11/01/2026, 04:08 PM EST

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Parakeet EOU Benchmark Results ✅

Status: Benchmark passed
Chunk Size: 320ms
Files Tested: 100/100

Performance Metrics

Metric Value Description
WER (Avg) 7.03% Average Word Error Rate
WER (Med) 4.17% Median Word Error Rate
RTFx 5.47x Real-time factor (higher = faster)
Total Audio 470.6s Total audio duration processed
Total Time 89.1s Total processing time

Streaming Metrics

Metric Value Description
Avg Chunk Time 0.089s Average chunk processing time
Max Chunk Time 0.178s Maximum chunk processing time
EOU Detections 0 Total End-of-Utterance detections

Test runtime: 1m53s • 11/01/2026, 04:25 PM EST

RTFx = Real-Time Factor (higher is better) • Processing includes: Model inference, audio preprocessing, state management, and file I/O

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

PocketTTS Smoke Test ✅

Check Result
Build ✅
Model download ✅
Model load ✅
Synthesis pipeline ✅
Output WAV ✅ (161.3 KB)

Runtime: 0m28s

Note: PocketTTS uses CoreML MLState (macOS 15) KV cache + Mimi streaming state. CI VM lacks physical GPU — audio quality and performance may differ from Apple Silicon.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

VAD Benchmark Results

Performance Comparison

Dataset Accuracy Precision Recall F1-Score RTFx Files
MUSAN 94.0% 89.3% 100.0% 94.3% 708.5x faster 50
VOiCES 94.0% 89.3% 100.0% 94.3% 681.0x faster 50

Dataset Details

  • MUSAN: Music, Speech, and Noise dataset - standard VAD evaluation
  • VOiCES: Voices Obscured in Complex Environmental Settings - tests robustness in real-world conditions

✅: Average F1-Score above 70%

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