diff --git a/src-tauri/src/transcription/mod.rs b/src-tauri/src/transcription/mod.rs index a8d3552..b72c954 100644 --- a/src-tauri/src/transcription/mod.rs +++ b/src-tauri/src/transcription/mod.rs @@ -1,8 +1,9 @@ //! Transcription engine (Phase 1 CPU; Phase 3 acceleration). FR-TRX-*. //! //! 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, -//! same `TranscriptSegment` output (ADR-0003/0004). Callers never branch on engine. +//! a second `Transcriber` impl using ONNX Runtime (ort + OpenVINO EP on Intel +//! NPUs) — same trait, same `TranscriptSegment` output (ADR-0003/0004). Callers +//! never branch on engine. use crate::models::{BackendId, TranscriptSegment}; 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 } -/// ONNX Runtime + DirectML transcriber for the NPU tier (T3.4). -/// -/// ponytail: the encoder/decoder inference loop (ORT session + DirectML -/// execution provider, greedy decode over a Whisper ONNX export) is a -/// multi-day integration on its own and untestable without NPU hardware in -/// this environment — ships as a real `Transcriber` impl that fails loudly -/// instead of a silent no-op. `hardware::WinHardwareDetector` reports NPU as -/// unavailable (see hardware/mod.rs) so nothing routes here until it's built. -#[cfg(feature = "directml")] -pub struct OnnxNpuTranscriber; - -#[cfg(feature = "directml")] -impl Transcriber for OnnxNpuTranscriber { - fn load(_model: &Path, _backend: BackendId) -> Result { - 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, TrxError> { - Err(TrxError::Inference( - "NPU backend not yet implemented".into(), - )) - } -} +// NPU tier (T3.4): Whisper ONNX on the Intel NPU via ONNX Runtime + OpenVINO. +// A real `OnnxNpuTranscriber` implementing the same `Transcriber` trait; see +// `npu.rs`. Gated on the `npu` feature so the CPU-only build never pulls `ort`. +#[cfg(feature = "npu")] +pub mod mel; +#[cfg(feature = "npu")] +pub mod npu; +#[cfg(feature = "npu")] +pub mod onnx_models; +#[cfg(feature = "npu")] +pub use npu::OnnxNpuTranscriber; /// Streaming window worker (Phase 1, T1.5/T1.6): accumulates raw 16kHz-mono /// chunks from the `audio` service into fixed-size, **non-overlapping** windows