fix: Use explicit Int64 tensor type for Silero VAD sample rate input#35
fix: Use explicit Int64 tensor type for Silero VAD sample rate input#35EgilSandfeld wants to merge 4 commits intosandrohanea:mainfrom
Conversation
The Silero VAD ONNX model expects tensor(int64) for the 'sr' input, but was receiving tensor(float) due to implicit type inference issues. - Use OrtValue.CreateTensorValueFromMemory<long>() to explicitly create Int64 tensor - Add using directive for Microsoft.ML.OnnxRuntime.Tensors - Fixes ONNX Runtime input type mismatch error Fixes sandrohanea#1
…ts and adjust package versions
|
Hello @EgilSandfeld and thanks for the contribution! However, the standardize target framework to netstandard2.0 is breaking existing optimizations that are using preprocessor directives: e.g. Place: ` During build, now all code will use the else (DllImport code). This is just some small example without much perf improvements, but there are other optimizations that really make more sense: |
…s projects and adjust package versions" This reverts commit 0ae78b8.
- Added `Microsoft.Bcl.AsyncInterfaces` to `EchoSharp.Whisper.net.csproj` and `EchoSharp.csproj`. - Removed duplicate `Microsoft.Bcl.AsyncInterfaces` entry for `netstandard2.0` target. - Introduced `System.Threading.Channels` package versions in `Directory.Packages.props`.
| <PackageVersion Include="Microsoft.ML.OnnxRuntime" Version="1.23.2" /> | ||
| <PackageVersion Include="Microsoft.ML.OnnxRuntime.Extensions" Version="0.14.0" /> | ||
| <PackageVersion Include="System.Threading.Channels" Version="9.0.0" /> | ||
| <PackageVersion Include="System.Threading.Channels" Version="10.0.0" /> |
There was a problem hiding this comment.
Why adding these 2 different versions for the same package?
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" /> |
There was a problem hiding this comment.
this should be a transitive dependency from Whisper.net already for the required frameworks.
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" /> |
There was a problem hiding this comment.
Why is this needed on dotnet target frameworks (net8 / net9) as a dependency?
I think those already have support for the required IAsyncEnumerable and do not require additional dependency.
The Silero VAD ONNX model expects tensor(int64) for the 'sr' input, but was receiving tensor(float) due to implicit type inference issues.
Problem
The Silero VAD ONNX model expects
tensor(int64)for the 'sr' (sample rate) input, but was receivingtensor(float)due to implicit type inference issues in ONNX Runtime. This caused the following error:Solution
Use
OrtValue.CreateTensorValueFromMemory<long>()to explicitly create an Int64 tensor for the sample rate input.Changes
OrtValue.CreateTensorValueFromMemory<long>(sampleRateInput, [1])to explicitly create Int64 tensorMicrosoft.ML.OnnxRuntime.TensorsTesting