nkeenan38 / voice_activity_detector

A Voice Activity Detector rust library using the Silero VAD model.
https://crates.io/crates/voice_activity_detector
MIT License
26 stars 6 forks source link

Does not build on Rust 1.80.1 #38

Open eutampieri opened 2 months ago

eutampieri commented 2 months ago

How to reproduce:

$ cargo new vad_test
$ cd vad_test/
$ cargo add voice_activity_detector

    Updating crates.io index
      Adding voice_activity_detector v0.1.0 to dependencies
             Features:
             - async
             - load-dynamic
    Updating crates.io index
     Locking 107 packages to latest compatible versions
      Adding generic-array v0.14.7 (latest: v1.1.0)
      Adding idna v0.5.0 (latest: v1.0.2)
      Adding linux-raw-sys v0.4.14 (latest: v0.6.5)
      Adding ndarray v0.15.6 (latest: v0.16.1)
      Adding typed-builder v0.18.2 (latest: v0.20.0)
      Adding typed-builder-macro v0.18.2 (latest: v0.20.0)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.13.2+wasi-0.2.1)
      Adding windows-sys v0.52.0 (latest: v0.59.0)
$ cargo check
[...]
    Checking voice_activity_detector v0.1.0
error[E0277]: the trait bound `Value: From<ArrayBase<ViewRepr<&f32>, Dim<[usize; 2]>>>` is not satisfied
  --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/voice_activity_detector-0.1.0/src/vad.rs:51:22
   |
51 |           let inputs = ort::inputs![
   |  ______________________^
52 | |             "input" => input.view(),
53 | |             "sr" => sample_rate.view(),
54 | |             "h" => self.h.view(),
55 | |             "c" => self.c.view(),
56 | |         ]
   | |_________^ the trait `From<ArrayBase<ViewRepr<&f32>, Dim<[usize; 2]>>>` is not implemented for `Value`, which is required by `Value: TryFrom<ArrayBase<ViewRepr<&f32>, Dim<[usize; 2]>>>`
   |
   = help: the following other types implement trait `From<T>`:
             <Value as From<Value<DynTensorValueType>>>
             <Value as From<Value<TensorValueType<T>>>>
   = note: required for `ArrayBase<ViewRepr<&f32>, Dim<[usize; 2]>>` to implement `Into<Value>`
   = note: required for `Value` to implement `TryFrom<ArrayBase<ViewRepr<&f32>, Dim<[usize; 2]>>>`
   = note: this error originates in the macro `ort::inputs` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Value: From<ArrayBase<ViewRepr<&i64>, Dim<[usize; 1]>>>` is not satisfied
  --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/voice_activity_detector-0.1.0/src/vad.rs:51:22
   |
51 |           let inputs = ort::inputs![
   |  ______________________^
52 | |             "input" => input.view(),
53 | |             "sr" => sample_rate.view(),
54 | |             "h" => self.h.view(),
55 | |             "c" => self.c.view(),
56 | |         ]
   | |_________^ the trait `From<ArrayBase<ViewRepr<&i64>, Dim<[usize; 1]>>>` is not implemented for `Value`, which is required by `Value: TryFrom<ArrayBase<ViewRepr<&i64>, Dim<[usize; 1]>>>`
   |
   = help: the following other types implement trait `From<T>`:
             <Value as From<Value<DynTensorValueType>>>
             <Value as From<Value<TensorValueType<T>>>>
   = note: required for `ArrayBase<ViewRepr<&i64>, Dim<[usize; 1]>>` to implement `Into<Value>`
   = note: required for `Value` to implement `TryFrom<ArrayBase<ViewRepr<&i64>, Dim<[usize; 1]>>>`
   = note: this error originates in the macro `ort::inputs` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Value: From<ArrayBase<ViewRepr<&f32>, Dim<[usize; 3]>>>` is not satisfied
  --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/voice_activity_detector-0.1.0/src/vad.rs:51:22
   |
51 |           let inputs = ort::inputs![
   |  ______________________^
52 | |             "input" => input.view(),
53 | |             "sr" => sample_rate.view(),
54 | |             "h" => self.h.view(),
55 | |             "c" => self.c.view(),
56 | |         ]
   | |_________^ the trait `From<ArrayBase<ViewRepr<&f32>, Dim<[usize; 3]>>>` is not implemented for `Value`, which is required by `Value: TryFrom<ArrayBase<ViewRepr<&f32>, Dim<[usize; 3]>>>`
   |
   = help: the following other types implement trait `From<T>`:
             <Value as From<Value<DynTensorValueType>>>
             <Value as From<Value<TensorValueType<T>>>>
   = note: required for `ArrayBase<ViewRepr<&f32>, Dim<[usize; 3]>>` to implement `Into<Value>`
   = note: required for `Value` to implement `TryFrom<ArrayBase<ViewRepr<&f32>, Dim<[usize; 3]>>>`
   = note: this error originates in the macro `ort::inputs` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/voice_activity_detector-0.1.0/src/vad.rs:73:23
     |
73   |         self.h.assign(&hn.view());
     |                ------ ^^^^^^^^^^ expected `&ArrayBase<_, _>`, found `&ArrayBase<ViewRepr<&f32>, Dim<IxDynImpl>>`
     |                |
     |                arguments to this method are incorrect
     |
     = note: `ArrayBase<ViewRepr<&f32>, Dim<IxDynImpl>>` and `ArrayBase<_, _>` have similar names, but are actually distinct types
note: `ArrayBase<ViewRepr<&f32>, Dim<IxDynImpl>>` is defined in crate `ndarray`
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.16.1/src/lib.rs:1280:1
     |
1280 | pub struct ArrayBase<S, D>
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `ArrayBase<_, _>` is defined in crate `ndarray`
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.15.6/src/lib.rs:1268:1
     |
1268 | pub struct ArrayBase<S, D>
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ndarray` are being used?
note: method defined here
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.15.6/src/impl_methods.rs:2349:12
     |
2349 |     pub fn assign<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>)
     |            ^^^^^^

error[E0308]: mismatched types
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/voice_activity_detector-0.1.0/src/vad.rs:74:23
     |
74   |         self.c.assign(&cn.view());
     |                ------ ^^^^^^^^^^ expected `&ArrayBase<_, _>`, found `&ArrayBase<ViewRepr<&f32>, Dim<IxDynImpl>>`
     |                |
     |                arguments to this method are incorrect
     |
     = note: `ArrayBase<ViewRepr<&f32>, Dim<IxDynImpl>>` and `ArrayBase<_, _>` have similar names, but are actually distinct types
note: `ArrayBase<ViewRepr<&f32>, Dim<IxDynImpl>>` is defined in crate `ndarray`
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.16.1/src/lib.rs:1280:1
     |
1280 | pub struct ArrayBase<S, D>
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `ArrayBase<_, _>` is defined in crate `ndarray`
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.15.6/src/lib.rs:1268:1
     |
1268 | pub struct ArrayBase<S, D>
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ndarray` are being used?
note: method defined here
    --> /home/eugenio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.15.6/src/impl_methods.rs:2349:12
     |
2349 |     pub fn assign<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>)
     |            ^^^^^^

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `voice_activity_detector` (lib) due to 5 previous errors
nkeenan38 commented 2 months ago

Looks like there was a breaking change in the ort crate. I can work on patching it up right now.

nkeenan38 commented 2 months ago

In the meantime, I've pinned the ort crate to the last successful release (2.0.0-rc.4)