Skip to content
Draft
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
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<!-- Dependencies for Onnx-->
<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" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding these 2 different versions for the same package?

<PackageVersion Include="WebRtcVadSharp" Version="1.3.2" />
<!-- Dependencies for Whisper.net -->
<PackageVersion Include="Whisper.net" Version="1.9.0" />
Expand Down
6 changes: 5 additions & 1 deletion components/EchoSharp.Onnx.SileroVad/SileroVadOnnxModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed under the MIT license: https://opensource.org/licenses/MIT

using Microsoft.ML.OnnxRuntime;
using Microsoft.ML.OnnxRuntime.Tensors;

namespace EchoSharp.Onnx.SileroVad;
internal class SileroVadOnnxModel : IDisposable
Expand Down Expand Up @@ -44,7 +45,10 @@ public SileroInferenceState CreateInferenceState()
var state = new SileroInferenceState(session.CreateIoBinding());

state.Binding.BindInput("state", OrtValue.CreateTensorValueFromMemory(state.State, stateShape));
state.Binding.BindInput("sr", OrtValue.CreateTensorValueFromMemory(sampleRateInput, [1]));
// Fix: Explicitly create Int64 tensor for sample rate input
// The Silero VAD ONNX model expects tensor(int64) for the 'sr' input
// Using generic method to ensure proper type inference
state.Binding.BindInput("sr", OrtValue.CreateTensorValueFromMemory<long>(sampleRateInput, [1]));

state.Binding.BindOutput("output", OrtValue.CreateTensorValueFromMemory(state.Output, [1, SileroConstants.OutputSize]));
state.Binding.BindOutput("stateN", OrtValue.CreateTensorValueFromMemory(state.PendingState, stateShape));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a transitive dependency from Whisper.net already for the required frameworks.

<PackageReference Include="Whisper.net" />
</ItemGroup>

Expand Down
5 changes: 4 additions & 1 deletion src/EchoSharp/EchoSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.IO.Compression" />
</ItemGroup>
Expand All @@ -16,4 +15,8 @@
<InternalsVisibleTo Include="EchoSharp.AzureAI.SpeechServices" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

</ItemGroup>

</Project>