Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ORT version #21

Merged
merged 3 commits into from
Sep 11, 2024
Merged
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ edition = "2021"

[dependencies]
anyhow = "1.0.86"
ndarray = "0.15.6"
ort = "=2.0.0-rc.4"
ndarray = "0.16"
ort = "=2.0.0-rc.6"
serde = { version = "1.0.208", features = ["derive"], optional = true }

[features]
Expand Down
26 changes: 12 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ impl VadSession {
.unwrap()
.try_extract_tensor::<f32>()?
.to_owned()
.into_shape((2, 1, 64))
.into_shape_with_order((2, 1, 64))
.context("Shape mismatch for h_tensor")?;

self.c_tensor = result
.get("cn")
.unwrap()
.try_extract_tensor::<f32>()?
.to_owned()
.into_shape((2, 1, 64))
.into_shape_with_order((2, 1, 64))
.context("Shape mismatch for h_tensor")?;

let prob_tensor = result.remove("output").unwrap();
Expand Down Expand Up @@ -232,19 +232,17 @@ impl VadSession {
if prob < self.config.negative_speech_threshold {
if !*redemption_passed {
self.state = VadState::Silence;
} else {
if current_silence > self.config.redemption_time {
if *redemption_passed {
let speech_end = (self.processed_samples + samples
- self.silent_samples)
/ (self.config.sample_rate / 1000);
vad_change = Some(VadTransition::SpeechEnd {
timestamp_ms: speech_end,
});
self.speech_end = Some(speech_end);
}
self.state = VadState::Silence
} else if current_silence > self.config.redemption_time {
if *redemption_passed {
let speech_end = (self.processed_samples + samples
- self.silent_samples)
/ (self.config.sample_rate / 1000);
vad_change = Some(VadTransition::SpeechEnd {
timestamp_ms: speech_end,
});
self.speech_end = Some(speech_end);
}
self.state = VadState::Silence
}
}
}
Expand Down
Loading