diff --git a/src-tauri/src/transcription/onnx_models.rs b/src-tauri/src/transcription/onnx_models.rs index 083d935..a799b63 100644 --- a/src-tauri/src/transcription/onnx_models.rs +++ b/src-tauri/src/transcription/onnx_models.rs @@ -15,9 +15,16 @@ const REPO: &str = "onnx-community/whisper-base.en"; pub const DEFAULT_ONNX_MODEL: &str = "base.en"; /// The four artifacts the `OnnxTranscriber` needs, relative to the repo root. +/// The decoder is Optimum's *merged* export — both the no-past and with-past +/// branches in one graph, selected by a `use_cache_branch` input — which is +/// what enables the KV-cache decode loop (the plain `decoder_model.onnx` +/// re-ran the whole prefix every step). Existing installs migrate for free: +/// swapping this entry flips `is_installed` to false, the startup background +/// fetch re-runs `download`, and `download` skips the three files already on +/// disk, fetching only the merged decoder. const FILES: &[(&str, &str)] = &[ ("encoder_model.onnx", "onnx/encoder_model.onnx"), - ("decoder_model.onnx", "onnx/decoder_model.onnx"), + ("decoder_model_merged.onnx", "onnx/decoder_model_merged.onnx"), ("tokenizer.json", "tokenizer.json"), ("generation_config.json", "generation_config.json"), ]; @@ -45,7 +52,7 @@ pub fn model_files(id: &str) -> OnnxModelFiles { let dir = onnx_dir(id); OnnxModelFiles { encoder: dir.join("encoder_model.onnx"), - decoder: dir.join("decoder_model.onnx"), + decoder: dir.join("decoder_model_merged.onnx"), tokenizer: dir.join("tokenizer.json"), generation_config: dir.join("generation_config.json"), } @@ -125,6 +132,6 @@ mod tests { fn catalog_lists_the_four_required_artifacts() { assert_eq!(FILES.len(), 4); assert!(FILES.iter().any(|(n, _)| *n == "encoder_model.onnx")); - assert!(FILES.iter().any(|(n, _)| *n == "decoder_model.onnx")); + assert!(FILES.iter().any(|(n, _)| *n == "decoder_model_merged.onnx")); } }