Adopt StreamingAsrEngine in voxora-whisper (waiting on whisper-rs incremental decoding)
- Lenguaje dominante
- Rust
- Estrellas
- 0
- Forks
- 1
- Merge medio
- 11 min
- PR fusionados (30 d)
- 47
Descripción
Tracks the work to implement `voxora_traits::StreamingAsrEngine`
in `voxora-whisper`. The trait surface was added in voxora 0.3.0
(PR #38) but no engine implements it yet.
## Status
**Blocked on upstream.** `whisper-rs` (the Rust binding for
whisper.cpp) does not currently expose whisper.cpp's
chunked-decoder API cleanly. There is an open feature request
on the whisper-rs repo; the upstream PR is the only way to
unblock this.
Reference upstream issue:
- `tazz/whisper-rs` issue tracker — search for \"streaming\"
or \"incremental decode\".
## What implementing looks like (once whisper-rs supports it)
In `voxora-whisper/src/engine.rs`:
\`\`\`rust
use voxora_traits::StreamingAsrEngine;
use voxora_traits::StreamingOptions;
use voxora_traits::StreamingResult;
use voxora_traits::StreamingSession;
use voxora_engine::EngineAdapter;
impl StreamingAsrEngine for WhisperEngine {
async fn begin_stream(&self, opts: &StreamingOptions) -> Result, AsrError> {
// Acquire a fresh whisper_rs::WhisperState.
// Carry it through a new `WhisperStreamingSession` struct.
// ...
}
}
struct WhisperStreamingSession {
state: whisper_rs::WhisperState,
accumulated: Vec,
language: Option,
}
impl StreamingSession for WhisperStreamingSession {
async fn transcribe_chunk(&mut self, samples: &[f32]) -> Result {
// Feed `samples` to `state.full(...)`.
// Return partial transcript.
// ...
}
async fn finalize_stream(self: Box) -> Result {
// Final flush + cleanup.
}
}
\`\`\`
In `voxora-whisper/src/lib.rs`: add a `streaming` module gated by
a `voxora-whisper/streaming` Cargo feature, so the upstream
dependency stays optional.
In `voxora-engine/src/adapter.rs`: when `engine-adapter` +
`streaming` features are both on, override
`as_streaming_engine` to return `Some(&self as &dyn
StreamingAsrEngine)`.
## Acceptance
- `voxora-whisper 0.X.0` published with a `streaming` feature
flag (default off).
- When the feature is on, `WhisperEngine::adapter()` returns an
`EngineAdapter` whose `as_streaming_engine()` returns
`Some(...)`.
- A streaming parity test transcribes a known audio file in 1-second
chunks and verifies the final assembled transcript matches the
batch-transcribed reference.
## Out of scope
- Backporting streaming to a `voxora-whisper` version that uses an
older whisper-rs without the chunked API.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.