feat(npu): catalog the merged Whisper decoder (decoder_model_merged.onnx) for KV-cache decode (T3.4)

This commit is contained in:
iamdoubz committed 2026-07-15 19:35:16 -05:00
1 parent 21f3d76ed0
commit 177f1f7d90
1 file changed
+10 -3
+10 -3
View File
@@ -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"));
}
}