fix: harden ONNX transcription and update sherpa-onnx to 1.13.7 - #253
Merged
Conversation
✅ Deploy Preview for voca-mac canceled.
|
|
| Filename | Overview |
|---|---|
| Sources/VocaMac/Services/SherpaService.swift | Retains recognizers for complete requests, serializes native decoding, propagates failures, and rejects cancelled or superseded loads. |
| Sources/VocaMac/Services/SherpaAudioPreparation.swift | Adds malformed-audio validation, digital-silence suppression, and minimum-length padding for ONNX segments. |
| Sources/VocaMac/Services/LoadSerializer.swift | Adds cancellation propagation while allowing teardown operations to retain their queue position. |
| Sources/VocaMac/Services/AudioSegmenter.swift | Refines pause detection to avoid artificial early boundaries in continuous audio. |
| Sources/VocaMac/Services/ModelManager.swift | Adds cancellation checks around download preparation, hashing, extraction, and installation. |
| Package.swift | Pins sherpa-onnx to exact release 1.13.7 and excludes binary fixtures from test resources. |
| Tests/VocaMacTests/SherpaServiceTests.swift | Adds regressions for short audio, malformed input, lifecycle invalidation, cancellation, and segment processing. |
Sequence Diagram
sequenceDiagram
participant Caller
participant Router as TranscriptionRouter
participant Sherpa as SherpaService
participant Model as LoadedRecognizer
participant Native as sherpa-onnx
Caller->>Router: transcribe(audio)
Router->>Sherpa: transcribe(audio)
Sherpa->>Sherpa: validate and segment
Sherpa->>Model: retain request snapshot
loop Prepared non-silent segments
Sherpa->>Model: acquire decode lock
Model->>Native: create stream and decode
Native-->>Model: result
Model-->>Sherpa: transcript segment
end
Sherpa-->>Router: joined transcription
Router-->>Caller: VocaTranscription
Reviews (2): Last reviewed commit: "fix: preserve ONNX pause boundaries and ..." | Re-trigger Greptile
Member
|
@Mr-Sunglasses thanks, this looks good. Merging. |
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.
Problem
Short ONNX recordings went directly into native feature extraction and encoder subsampling. On the previous runtime, a one-sample Canary input aborted the process; tightly trimmed Moonshine Tiny clips produced repeated or incorrect words (
Yes→Yes, yes, yes,Stop→Star). The service also read model state without locking, could change recognizers between segments, and could reinstall an obsolete asynchronous load after unloading. Further regressions reproduced a 300 ms pause being ignored, continuous sound being split prematurely at 6.01 seconds instead of the 8-second limit, cancellation not reaching queued/running operations, and Korean segment boundaries losing spaces.Changes
Validation
swift test: 462 tests, one unrelated skip, no failures. Native integration coverage ran locally with all five catalog models installed; CI skips those integrations when model weights are absent.swift build -c release: passed.git diff --check: passed.Synthetic fixtures cover the reproduced failures; they do not establish accuracy for every microphone, language, or recording. No installed application or release was replaced. Remote CI/app-bundle verification remains separate from these local checks. Synchronous native inference/extraction cannot be interrupted mid-call; cancellation stops subsequent work after the current native operation returns.