sandrohanea / whisper.net

Whisper.net. Speech to text made simple using Whisper Models
MIT License
547 stars 84 forks source link

Using Whisper.net.Runtime #149

Closed terezatodova closed 8 months ago

terezatodova commented 9 months ago

Hello, I have an issue when trying to include the Whisper.net.Runtime.

My .csproj file looks like this image

and the dotnet restore operation seems to run without issues. However the "using Whisper.net.Runtime" always throws an error image

Using Whisper, Whisper.net,... shows no error image

I've also tried different versions of Whisper.net as well as Whisper.net.runtime, but nothing seems to work.

Thank you for your help

sandrohanea commented 9 months ago

Hello @terezatodova , You don't need to add using Whisper.net.Runtime. That package doesn't have any published namespaces, but will just copy the native library in runtimes directory when you build your app.

terezatodova commented 9 months ago

Thank you very much for the quick response. I've tried copying the whisper.dll from git (Whisper.net.runtime/win-x64) to my Runtime folder. Seems like there is an error when calling using var whisperFactory = WhisperFactory.FromPath("ggml-base.bin");

void Whisper.net.Native.NativeMethods.whisper_log_set(nint, nint): System.EntryPointNotFoundException: Unable to find an entry point named 'whisper_log_set' in DLL 'whisper'.

Not sure if I'm missing something / doing something incorrectly in setting up the .dll or if there is another issue. I'm using the example code to download the ggml-base.bin file, which seems to be downloaded correctly.

sandrohanea commented 9 months ago

You don't need to copy the dll manually, just install both Whisper.net 1.5.0 and Whisper.net.Runtime 1.5.0 (which will copy the correct dll to your runtimes).

That error that you got was most likely because the dll that you copied was not compatible with the Whisper.net version that you were using (1.5.0), while the DLL was older.

fgather commented 8 months ago

Do you have by any chance another whisper.dll in your output directory? Maybe your project is named whisper?

sandrohanea commented 8 months ago

Closing due to inactivity.