Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: upgrade ort 2.0.0-rc.6 → rc.12 for CoreML MLProgram + ANE support

Louis Beaumontb5ac585459ee
diff --git a/Cargo.lock b/Cargo.lock
index 969a02444..dfc579bb5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -242,7 +242,7 @@ dependencies = [
[[package]]
name = "antirez-asr-sys"
version = "0.1.0"
-source = "git+https://github.com/screenpipe/audiopipe.git?rev=2a093f1#2a093f183abbd0eb5c000cf9a213e6735785ca69"
+source = "git+https://github.com/screenpipe/audiopipe.git?rev=c88ee22#c88ee229dcc441e93cac4acf43fbd06035252209"
dependencies = [
"cc",
]
@@ -540,12 +540,12 @@ dependencies = [
[[package]]
name = "audiopipe"
version = "0.2.0"
-source = "git+https://github.com/screenpipe/audiopipe.git?rev=2a093f1#2a093f183abbd0eb5c000cf9a213e6735785ca69"
+source = "git+https://github.com/screenpipe/audiopipe.git?rev=c88ee22#c88ee229dcc441e93cac4acf43fbd06035252209"
dependencies = [
"antirez-asr-sys",
"half",
"hf-hub 0.4.3",
- "ndarray",
+ "ndarray 0.17.2",
"ort",
"ort-sys",
"qwen3-asr-sys",
@@ -768,7 +768,7 @@ dependencies = [
"bitflags 2.11.0",
"cexpr",
"clang-sys",
- "itertools 0.10.5",
+ "itertools 0.12.1",
"lazy_static",
"lazycell",
"log",
@@ -792,7 +792,7 @@ dependencies = [
"bitflags 2.11.0",
"cexpr",
"clang-sys",
- "itertools 0.10.5",
+ "itertools 0.12.1",
"log",
"prettyplease",
"proc-macro2",
@@ -1177,7 +1177,7 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [
"glob",
"libc",
- "libloading",
+ "libloading 0.8.9",
]
[[package]]
@@ -1961,7 +1961,7 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
dependencies = [
- "libloading",
+ "libloading 0.8.9",
]
[[package]]
@@ -3010,6 +3010,12 @@ dependencies = [
"digest 0.10.7",
]
+[[package]]
+name = "hmac-sha256"
+version = "1.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec9d92d097f4749b64e8cc33d924d9f40a2d4eb91402b458014b781f5733d60f"
+
[[package]]
name = "home"
version = "0.5.12"
@@ -3179,7 +3185,7 @@ dependencies = [
"hyper",
"libc",
"pin-project-lite",
- "socket2 0.6.3",
+ "socket2 0.5.10",
"tokio",
"tower-service",
"tracing",
@@ -3620,7 +3626,7 @@ checksum = "15ebe7cf9eae245a44ab76cabdd06c0b3769972fd06050ed9aea6a22ff0d682f"
dependencies = [
"eyre",
"knf-rs-sys",
- "ndarray",
+ "ndarray 0.16.1",
]
[[package]]
@@ -3780,6 +3786,16 @@ dependencies = [
"windows-link 0.2.1",
]
+[[package]]
+name = "libloading"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
+dependencies = [
+ "cfg-if",
+ "windows-link 0.2.1",
+]
+
[[package]]
name = "libm"
version = "0.2.16"
@@ -3978,6 +3994,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
+[[package]]
+name = "lzma-rust2"
+version = "0.15.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1670343e58806300d87950e3401e820b519b9384281bbabfb15e3636689ffd69"
+
[[package]]
name = "lzma-sys"
version = "0.1.20"
@@ -4239,6 +4261,21 @@ dependencies = [
"rawpointer",
]
+[[package]]
+name = "ndarray"
+version = "0.17.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
+dependencies = [
+ "matrixmultiply",
+ "num-complex",
+ "num-integer",
+ "num-traits",
+ "portable-atomic",
+ "portable-atomic-util",
+ "rawpointer",
+]
+
[[package]]
name = "ndk"
version = "0.8.0"
@@ -5034,28 +5071,28 @@ dependencies = [
[[package]]
name = "ort"
-version = "2.0.0-rc.6"
+version = "2.0.0-rc.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5f95fe501e1cb81dec2f66ee3129025759b602817aa2c77ff421390c418cc34"
+checksum = "d7de3af33d24a745ffb8fab904b13478438d1cd52868e6f17735ef6e1f8bf133"
dependencies = [
"half",
- "libloading",
- "ndarray",
+ "libloading 0.9.0",
+ "ndarray 0.17.2",
"ort-sys",
+ "smallvec",
"tracing",
+ "ureq 3.2.0",
]
[[package]]
name = "ort-sys"
-version = "2.0.0-rc.6"
+version = "2.0.0-rc.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4174960a7b93a17564a05b26e05889f0dea9ee70e68db5841f27b40c0c9804e"
+checksum = "d7b497d21a8b6fbb4b5a544f8fadb77e801a09ae0add9e411d31c6f89e3c1e90"
dependencies = [
- "flate2",
- "pkg-config",
- "sha2 0.10.9",
- "tar",
- "ureq 2.12.1",
+ "hmac-sha256",
+ "lzma-rust2",
+ "ureq 3.2.0",
]
[[package]]
@@ -5681,7 +5718,7 @@ dependencies = [
"quinn-udp",
"rustc-hash 2.1.1",
"rustls 0.23.37",
- "socket2 0.6.3",
+ "socket2 0.5.10",
"thiserror 2.0.18",
"tokio",
"tracing",
@@ -5718,7 +5755,7 @@ dependencies = [
"cfg_aliases",
"libc",
"once_cell",
- "socket2 0.6.3",
+ "socket2 0.5.10",
"tracing",
"windows-sys 0.60.2",
]
@@ -5741,7 +5778,7 @@ checksum = "640c9bd8497b02465aeef5375144c26062e0dcd5939dfcbb0f5db76cb8c17c73"
[[package]]
name = "qwen3-asr-sys"
version = "0.1.0"
-source = "git+https://github.com/screenpipe/audiopipe.git?rev=2a093f1#2a093f183abbd0eb5c000cf9a213e6735785ca69"
+source = "git+https://github.com/screenpipe/audiopipe.git?rev=c88ee22#c88ee229dcc441e93cac4acf43fbd06035252209"
dependencies = [
"cc",
"cmake",
@@ -6570,7 +6607,7 @@ dependencies = [
"libsamplerate-sys",
"log",
"mp3lame-encoder",
- "ndarray",
+ "ndarray 0.17.2",
"oasgen",
"objc",
"once_cell",
@@ -8820,13 +8857,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdc97a28575b85cfedf2a7e7d3cc64b3e11bd8ac766666318003abbacc7a21fc"
dependencies = [
"base64 0.22.1",
+ "der 0.7.10",
"flate2",
"log",
+ "native-tls",
"percent-encoding",
"rustls 0.23.37",
"rustls-pki-types",
+ "socks",
"ureq-proto",
"utf-8",
+ "webpki-root-certs",
"webpki-roots 1.0.6",
]
@@ -8899,10 +8940,10 @@ dependencies = [
[[package]]
name = "vad-rs"
version = "0.2.0"
-source = "git+https://github.com/screenpipe/vad-rs-1.git#3af3b1829ab4d8f018f271fe53c6f382f15ca3a6"
+source = "git+https://github.com/screenpipe/vad-rs-1.git#592ae9170def450ab0d26a4fe9da6346cdbe3492"
dependencies = [
"eyre",
- "ndarray",
+ "ndarray 0.17.2",
"ort",
"ort-sys",
"ringbuffer",
@@ -9195,6 +9236,15 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "webpki-root-certs"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "804f18a4ac2676ffb4e8b5b5fa9ae38af06df08162314f96a68d2a363e21a8ca"
+dependencies = [
+ "rustls-pki-types",
+]
+
[[package]]
name = "webpki-roots"
version = "0.24.0"
diff --git a/crates/screenpipe-audio/Cargo.toml b/crates/screenpipe-audio/Cargo.toml
index 638c183fc..25a1606f3 100644
--- a/crates/screenpipe-audio/Cargo.toml
+++ b/crates/screenpipe-audio/Cargo.toml
@@ -77,13 +77,13 @@ dirs = "5.0.1"
sysinfo = "0.29.0"
lazy_static = { version = "1.4.0" }
realfft = "3.4.0"
-ndarray = "0.16"
+ndarray = "0.17"
# Base ort dep — each platform overrides with specific features below
-ort = { version = "=2.0.0-rc.6", default-features = false, features = ["ndarray", "half"] }
-ort-sys = { version = "=2.0.0-rc.6", default-features = false }
+ort = { version = "=2.0.0-rc.12", default-features = false, features = ["ndarray", "half"] }
+ort-sys = { version = "=2.0.0-rc.12", default-features = false }
knf-rs = "0.3.2"
futures = "0.3.31"
-audiopipe = { git = "https://github.com/screenpipe/audiopipe.git", rev = "2a093f1", default-features = false, features = ["qwen3-asr-antirez-blas", "parakeet"], optional = true }
+audiopipe = { git = "https://github.com/screenpipe/audiopipe.git", rev = "c88ee22", default-features = false, features = ["qwen3-asr-antirez-blas", "parakeet"], optional = true }
bytes = { version = "1.9.0", features = ["serde"] }
rand = "0.9.0"
@@ -92,7 +92,7 @@ libpulse-binding = { version = "2.28", optional = true }
libpulse-simple-binding = { version = "2.28", optional = true }
# Bundle ONNX Runtime on Linux (same as macOS). load-dynamic was tried but
# broke systems without a system-installed libonnxruntime.so (see #2506).
-ort = { version = "=2.0.0-rc.6", features = ["download-binaries"] }
+ort = { version = "=2.0.0-rc.12", features = ["download-binaries"] }
# Windows COM API for querying the "Default Communications Device" role.
# MS Teams/Zoom route audio to the eCommunications endpoint, which may
@@ -106,7 +106,7 @@ windows = { version = "0.58", features = [
] }
[target.'cfg(all(target_os = "windows", target_arch = "x86_64"))'.dependencies]
-ort = { version = "=2.0.0-rc.6", features = [
+ort = { version = "=2.0.0-rc.12", features = [
"download-binaries",
"copy-dylibs",
] }
@@ -116,8 +116,8 @@ libsamplerate-sys = "0.1.10"
# Windows ARM64: use our own ONNX Runtime DLL at runtime (load-dynamic); no compile-time link, no ort.pyke.io cache
[target.'cfg(all(target_os = "windows", target_arch = "aarch64"))'.dependencies]
-ort = { version = "=2.0.0-rc.6", default-features = false, features = ["load-dynamic"] }
-ort-sys = { version = "=2.0.0-rc.6", default-features = false, features = ["load-dynamic"] }
+ort = { version = "=2.0.0-rc.12", default-features = false, features = ["load-dynamic"] }
+ort-sys = { version = "=2.0.0-rc.12", default-features = false }
esaxx-rs = "0.1.10"
samplerate = { version = "0.2.4" }
libsamplerate-sys = "0.1.10"
@@ -125,7 +125,7 @@ libsamplerate-sys = "0.1.10"
[target.'cfg(target_os = "macos")'.dependencies]
once_cell = "1.17.1"
objc = "0.2.7"
-ort = { version = "=2.0.0-rc.6", features = ["download-binaries"] }
+ort = { version = "=2.0.0-rc.12", features = ["download-binaries"] }
[dev-dependencies]
tempfile = "3.3.0"
diff --git a/crates/screenpipe-audio/src/speaker/embedding.rs b/crates/screenpipe-audio/src/speaker/embedding.rs
index 65d94d158..91d1d8fb9 100644
--- a/crates/screenpipe-audio/src/speaker/embedding.rs
+++ b/crates/screenpipe-audio/src/speaker/embedding.rs
@@ -1,6 +1,6 @@
use anyhow::{Context, Result};
use ndarray::Array2;
-use ort::Session;
+use ort::session::Session;
use std::path::Path;
#[derive(Debug)]
@@ -14,17 +14,23 @@ impl EmbeddingExtractor {
Ok(Self { session })
}
pub fn compute(&mut self, samples: &[f32]) -> Result<impl Iterator<Item = f32>> {
- let features: Array2<f32> = knf_rs::compute_fbank(samples)
+ let fbank = knf_rs::compute_fbank(samples)
.map_err(anyhow::Error::msg)
.context("compute_fbank failed")?;
+ // knf-rs uses ndarray 0.16, convert to ndarray 0.17 by extracting raw data
+ let shape = fbank.shape();
+ let (rows, cols) = (shape[0], shape[1]);
+ let raw_data: Vec<f32> = fbank.iter().copied().collect();
+ let features = Array2::from_shape_vec((rows, cols), raw_data)
+ .context("failed to reconstruct fbank array")?;
let features = features.insert_axis(ndarray::Axis(0)); // Add batch dimension
- let inputs = ort::inputs! ["feats" => features.view()]?;
+ let inputs = ort::inputs! ["feats" => ort::value::TensorRef::from_array_view(features.view())?];
let ort_outs = self.session.run(inputs)?;
let ort_out = ort_outs
.get("embs")
.context("Output tensor not found")?
- .try_extract_tensor::<f32>()
+ .try_extract_array::<f32>()
.context("Failed to extract tensor")?;
// Collect the tensor data into a Vec to own it
diff --git a/crates/screenpipe-audio/src/speaker/mod.rs b/crates/screenpipe-audio/src/speaker/mod.rs
index 3c310dbc5..21d37a0c9 100644
--- a/crates/screenpipe-audio/src/speaker/mod.rs
+++ b/crates/screenpipe-audio/src/speaker/mod.rs
@@ -3,14 +3,17 @@ pub mod embedding;
use std::path::Path;
use anyhow::Result;
-use ort::{GraphOptimizationLevel, Session};
+use ort::session::{builder::GraphOptimizationLevel, Session};
pub fn create_session<P: AsRef<Path>>(path: P) -> Result<Session> {
- let session = Session::builder()?
- .with_optimization_level(GraphOptimizationLevel::Level3)?
- .with_intra_threads(1)?
- .with_inter_threads(1)?
- .commit_from_file(path.as_ref())?;
+ let mut builder = Session::builder()?
+ .with_optimization_level(GraphOptimizationLevel::Level3)
+ .map_err(|e| anyhow::anyhow!("{e}"))?
+ .with_intra_threads(1)
+ .map_err(|e| anyhow::anyhow!("{e}"))?
+ .with_inter_threads(1)
+ .map_err(|e| anyhow::anyhow!("{e}"))?;
+ let session = builder.commit_from_file(path.as_ref())?;
Ok(session)
}
pub mod embedding_manager;
diff --git a/crates/screenpipe-audio/src/speaker/segment.rs b/crates/screenpipe-audio/src/speaker/segment.rs
index 30fc852f6..06c13ec9c 100644
--- a/crates/screenpipe-audio/src/speaker/segment.rs
+++ b/crates/screenpipe-audio/src/speaker/segment.rs
@@ -121,7 +121,7 @@ fn handle_new_segment(
pub struct SegmentIterator {
samples: Vec<f32>,
sample_rate: u32,
- session: ort::Session,
+ session: ort::session::Session,
embedding_extractor: Arc<Mutex<EmbeddingExtractor>>,
embedding_manager: Arc<Mutex<EmbeddingManager>>,
current_position: usize,
@@ -176,7 +176,7 @@ impl SegmentIterator {
.insert_axis(Axis(1))
.to_owned();
- let inputs = ort::inputs![array].context("Failed to prepare inputs")?;
+ let inputs = ort::inputs![ort::value::Tensor::from_array(array)?];
let ort_outs = self
.session
.run(inputs)
@@ -184,7 +184,7 @@ impl SegmentIterator {
let ort_out = ort_outs.get("output").context("Output tensor not found")?;
let ort_out = ort_out
- .try_extract_tensor::<f32>()
+ .try_extract_array::<f32>()
.context("Failed to extract tensor")?;
let mut result = None;