diff --git a/Cargo.lock b/Cargo.lock index 39a72ac..bbf980b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -611,9 +611,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b25655df2c3cdd83c5e5b293b88acd880332b2ddadd7c30ac43144fdc0033da9" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" [[package]] name = "base64-simd" @@ -784,7 +784,7 @@ version = "0.1.0" dependencies = [ "async-trait", "axum", - "base64 0.23.0", + "base64 0.23.1", "bytes", "chrono", "conduit-anthropic", @@ -923,7 +923,7 @@ version = "0.1.0" dependencies = [ "async-trait", "axum", - "base64 0.23.0", + "base64 0.23.1", "bytes", "conduit-core", "conduit-http", @@ -1153,7 +1153,7 @@ dependencies = [ "conduit-provider", "futures-util", "hound", - "ndarray 0.16.1", + "ndarray", "ort", "tokio", "tokio-stream", @@ -1828,6 +1828,12 @@ dependencies = [ "digest 0.11.3", ] +[[package]] +name = "hmac-sha256" +version = "1.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec9d92d097f4749b64e8cc33d924d9f40a2d4eb91402b458014b781f5733d60f" + [[package]] name = "hound" version = "3.5.1" @@ -1927,7 +1933,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "smallvec 1.15.2", + "smallvec", "tokio", "want", ] @@ -2033,7 +2039,7 @@ dependencies = [ "icu_normalizer_data", "icu_properties", "icu_provider", - "smallvec 1.15.2", + "smallvec", "zerovec", ] @@ -2085,7 +2091,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", - "smallvec 1.15.2", + "smallvec", "utf8_iter", ] @@ -2211,6 +2217,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "lzma-rust2" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e20f57f9918e5bd7bc58c22cdd70a6afc7375d4dd9683af5f2b34bd3d2bba619" + [[package]] name = "maplit" version = "1.0.2" @@ -2337,21 +2349,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ndarray" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841" -dependencies = [ - "matrixmultiply", - "num-complex", - "num-integer", - "num-traits", - "portable-atomic", - "portable-atomic-util", - "rawpointer", -] - [[package]] name = "ndarray" version = "0.17.2" @@ -2561,26 +2558,25 @@ dependencies = [ [[package]] name = "ort" -version = "2.0.0-rc.10" +version = "2.0.0-rc.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa7e49bd669d32d7bc2a15ec540a527e7764aec722a45467814005725bcd721" +checksum = "4336a1e2b38848325241c72889086886004e589b7c74f335e60a8e8db5138a0b" dependencies = [ - "ndarray 0.16.1", + "ndarray", "ort-sys", - "smallvec 2.0.0-alpha.10", + "smallvec", "tracing", + "ureq", ] [[package]] name = "ort-sys" -version = "2.0.0-rc.10" +version = "2.0.0-rc.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2aba9f5c7c479925205799216e7e5d07cc1d4fa76ea8058c60a9a30f6a4e890" +checksum = "cf211e3776eea6aec988552fa118dd746d70e1b1e5e244058d1c98015f3e5872" dependencies = [ - "flate2", - "pkg-config", - "sha2 0.10.9", - "tar", + "hmac-sha256", + "lzma-rust2", "ureq", ] @@ -2615,7 +2611,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "smallvec 1.15.2", + "smallvec", "windows-link", ] @@ -3064,7 +3060,7 @@ dependencies = [ "num-traits", "once_cell", "rhai_codegen", - "smallvec 1.15.2", + "smallvec", "smartstring", "thin-vec", "web-time", @@ -3439,12 +3435,6 @@ dependencies = [ "serde", ] -[[package]] -name = "smallvec" -version = "2.0.0-alpha.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d44cfb396c3caf6fbfd0ab422af02631b69ddd96d2eff0b0f0724f9024051b" - [[package]] name = "smartstring" version = "1.0.1" @@ -3532,7 +3522,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.9", - "smallvec 1.15.2", + "smallvec", "thiserror", "tokio", "tokio-stream", @@ -3635,7 +3625,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.11.0", - "smallvec 1.15.2", + "smallvec", "sqlx-core", "stringprep", "thiserror", @@ -4092,7 +4082,7 @@ checksum = "adbc64cba7137545b8044cb1fe9814f7aacf3c6b5f9b45be8bb5db538befdb26" dependencies = [ "js-sys", "opentelemetry", - "smallvec 1.15.2", + "smallvec", "tracing", "tracing-core", "tracing-log", @@ -4123,7 +4113,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec 1.15.2", + "smallvec", "thread_local", "tracing", "tracing-core", @@ -4149,14 +4139,14 @@ dependencies = [ "lazy_static", "log", "maplit", - "ndarray 0.17.2", + "ndarray", "num-complex", "num-integer", "num-traits", "pastey", "rustfft", "serde", - "smallvec 1.15.2", + "smallvec", "tract-data", "tract-linalg", ] @@ -4178,14 +4168,14 @@ dependencies = [ "lazy_static", "libm", "maplit", - "ndarray 0.17.2", + "ndarray", "nom", "nom-language", "num-integer", "num-traits", "parking_lot", "scan_fmt", - "smallvec 1.15.2", + "smallvec", "string-interner", ] @@ -4269,7 +4259,7 @@ dependencies = [ "memmap2", "num-integer", "prost", - "smallvec 1.15.2", + "smallvec", "tract-extra", "tract-hir", "tract-nnef", diff --git a/crates/conduit-vad/Cargo.toml b/crates/conduit-vad/Cargo.toml index 9d8ece6..1fc7353 100644 --- a/crates/conduit-vad/Cargo.toml +++ b/crates/conduit-vad/Cargo.toml @@ -32,8 +32,8 @@ tracing.workspace = true # different output shapes, so neither one alone is the model. Every published # export fails the same way, including the one named `ifless`. `conduit-wake` # keeps `tract`, which loads openWakeWord fine. -ort = { version = "=2.0.0-rc.10", optional = true } -ndarray = { version = "0.16", optional = true } +ort = { version = "=2.0.0-rc.13", optional = true } +ndarray = { version = "0.17", optional = true } [dev-dependencies] bytes.workspace = true diff --git a/crates/conduit-vad/src/onnx.rs b/crates/conduit-vad/src/onnx.rs index 910888e..a10184b 100644 --- a/crates/conduit-vad/src/onnx.rs +++ b/crates/conduit-vad/src/onnx.rs @@ -128,17 +128,23 @@ impl Model { // of audio at a time on a thread Conduit already set aside for it, and a // backend spawning its own pool per session would contend with every other // stage for no gain on a workload this small. - let session = Session::builder() - .and_then(|builder| builder.with_optimization_level(GraphOptimizationLevel::Level3)) - .and_then(|builder| builder.with_intra_threads(1)) - .and_then(|builder| builder.with_inter_threads(1)) - .and_then(|builder| builder.commit_from_file(path)) - .map_err(|error| { - Error::Config(format!( - "cannot load the Silero VAD model `{}`: {error}", - path.display() - )) - })?; + // `ort` 2.0-rc.13 parameterises each builder-step error by the builder + // state, so chaining with `and_then` on a single `Result` + // no longer type-checks. Threading each step through `?` and mapping the + // final error the same way keeps behaviour identical. + let build = || -> ort::Result { + Session::builder()? + .with_optimization_level(GraphOptimizationLevel::Level3)? + .with_intra_threads(1)? + .with_inter_threads(1)? + .commit_from_file(path) + }; + let session = build().map_err(|error| { + Error::Config(format!( + "cannot load the Silero VAD model `{}`: {error}", + path.display() + )) + })?; Ok(Self { session: Mutex::new(session), window, sample_rate: i64::from(sample_rate) }) }