whisper.net: Failed to load native whisper library

I can’t get it work, I keep getting error “Failed to load native whisper library”. Not sure if I’m supposed to do something rather then adding packages in project, downloading model and creating processor. I’m doing exactly what is done in Simple example. The error appears at following line: using var whisperFactory = WhisperFactory.FromPath("ggml-base.bin");

I’m integrating into dotnet core 5 application running on linux-x64 machine. Should I manually run whisper library or add it somewhere? Not sure that I understand the process at all…

`

    // This section detects whether the "ggml-base.bin" file exists in our project disk. If it doesn't, it downloads it from the internet
    if (!System.IO.File.Exists(modelFileName))
    {
      await DownloadModel(modelFileName, ggmlType);
    }

    // This section creates the whisperFactory object which is used to create the processor object.
    using var whisperFactory = WhisperFactory.FromPath("ggml-base.bin");

    // This section creates the processor object which is used to process the audio file, it uses language `auto` to detect the language of the audio file.
    using var processor = whisperFactory.CreateBuilder()
        .WithLanguage("auto")
        .Build();

`

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (7 by maintainers)

Most upvoted comments

For me, the demo with clblast GPU, one need to download and copy clblast.dll to the exe directory, or somewhere in path, download from https://github.com/CNugteren/CLBlast/releases/tag/1.6.0 .

The demo with cublas GPU on windows, one need to download https://developer.nvidia.com/cuda-toolkit , and only need to install CUBLAS, CUDART runtime. Then copy the dlls from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin. The 3 needed dlls are : cublas64_12.dll , cublasLt64_12.dll and cudart64_12.dll

BTW I was able to run whisper.net with CUDA support on Linux. Need to compile the whisper.cpp git submodule on the Linux box with make:

make clean
WHISPER_CUBLAS=1 make libwhisper.so -j

And then copy the shared library to ‘runtimes’ (renamed to whisper.so):

 cp ./libwhisper.so <path from root to runtimes>/runtimes/linux-x64/whisper.so

I also had to set the LD_LIBRARY_PATH variable to <path from root to runtimes>/runtimes/linux-x64/ to let the system find the shared library.

Note: don’t use the main whisper.cpp repo to compile whisper as that may not be compatible. Use the one referenced from the Whisper.net repo as a git submodule.

In working with containers, I found that I needed to be sure to include the latest GLIBC libraries, and using a base image of Ubuntu 22.04 (Jammy) solved this problem for me