Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 40 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/conduit-vad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 17 additions & 11 deletions crates/conduit-vad/src/onnx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SessionBuilder>`
// no longer type-checks. Threading each step through `?` and mapping the
// final error the same way keeps behaviour identical.
let build = || -> ort::Result<Session> {
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) })
}
Expand Down
Loading