feat(transcription): wire OnnxNpuTranscriber behind npu feature (T3.4)
This commit is contained in:
1 parent
f8731adae3
commit
f58c0f2d6c
1 file changed
+14
-31
@@ -1,8 +1,9 @@
|
|||||||
//! Transcription engine (Phase 1 CPU; Phase 3 acceleration). FR-TRX-*.
|
//! Transcription engine (Phase 1 CPU; Phase 3 acceleration). FR-TRX-*.
|
||||||
//!
|
//!
|
||||||
//! Primary engine: whisper-rs (whisper.cpp) for CPU/Vulkan/CUDA. The NPU path is
|
//! Primary engine: whisper-rs (whisper.cpp) for CPU/Vulkan/CUDA. The NPU path is
|
||||||
//! a second `Transcriber` impl using ONNX Runtime (ort + DirectML) — same trait,
|
//! a second `Transcriber` impl using ONNX Runtime (ort + OpenVINO EP on Intel
|
||||||
//! same `TranscriptSegment` output (ADR-0003/0004). Callers never branch on engine.
|
//! NPUs) — same trait, same `TranscriptSegment` output (ADR-0003/0004). Callers
|
||||||
|
//! never branch on engine.
|
||||||
|
|
||||||
use crate::models::{BackendId, TranscriptSegment};
|
use crate::models::{BackendId, TranscriptSegment};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -198,35 +199,17 @@ fn audio_ctx_for_window(n_samples: usize) -> i32 {
|
|||||||
((window_secs / 30.0) * 1500.0).ceil().clamp(64.0, 1500.0) as i32
|
((window_secs / 30.0) * 1500.0).ceil().clamp(64.0, 1500.0) as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ONNX Runtime + DirectML transcriber for the NPU tier (T3.4).
|
// NPU tier (T3.4): Whisper ONNX on the Intel NPU via ONNX Runtime + OpenVINO.
|
||||||
///
|
// A real `OnnxNpuTranscriber` implementing the same `Transcriber` trait; see
|
||||||
/// ponytail: the encoder/decoder inference loop (ORT session + DirectML
|
// `npu.rs`. Gated on the `npu` feature so the CPU-only build never pulls `ort`.
|
||||||
/// execution provider, greedy decode over a Whisper ONNX export) is a
|
#[cfg(feature = "npu")]
|
||||||
/// multi-day integration on its own and untestable without NPU hardware in
|
pub mod mel;
|
||||||
/// this environment — ships as a real `Transcriber` impl that fails loudly
|
#[cfg(feature = "npu")]
|
||||||
/// instead of a silent no-op. `hardware::WinHardwareDetector` reports NPU as
|
pub mod npu;
|
||||||
/// unavailable (see hardware/mod.rs) so nothing routes here until it's built.
|
#[cfg(feature = "npu")]
|
||||||
#[cfg(feature = "directml")]
|
pub mod onnx_models;
|
||||||
pub struct OnnxNpuTranscriber;
|
#[cfg(feature = "npu")]
|
||||||
|
pub use npu::OnnxNpuTranscriber;
|
||||||
#[cfg(feature = "directml")]
|
|
||||||
impl Transcriber for OnnxNpuTranscriber {
|
|
||||||
fn load(_model: &Path, _backend: BackendId) -> Result<Self, TrxError> {
|
|
||||||
Err(TrxError::Load(
|
|
||||||
"NPU (ONNX Runtime + DirectML) transcription is not yet implemented (T3.4)".into(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
fn transcribe_stream(&self, _audio: AudioWindow, _out: SegmentSink) -> Result<(), TrxError> {
|
|
||||||
Err(TrxError::Inference(
|
|
||||||
"NPU backend not yet implemented".into(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
fn transcribe_file(&self, _wav: &Path) -> Result<Vec<TranscriptSegment>, TrxError> {
|
|
||||||
Err(TrxError::Inference(
|
|
||||||
"NPU backend not yet implemented".into(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Streaming window worker (Phase 1, T1.5/T1.6): accumulates raw 16kHz-mono
|
/// Streaming window worker (Phase 1, T1.5/T1.6): accumulates raw 16kHz-mono
|
||||||
/// chunks from the `audio` service into fixed-size, **non-overlapping** windows
|
/// chunks from the `audio` service into fixed-size, **non-overlapping** windows
|
||||||
|
|||||||
Reference in new issue
Block a user