43 points · by Const-me · 3y ago · 20 comments
Which in turn is a C++ port of OpenAI's Whisper automatic speech recognition (ASR) model: https://github.com/openai/whisper
The implementation has no dependencies, usually much faster than realtime, and should hopefully work on most Windows computers in the world.
The original version only supports *.wav audio files with 16kHz sample rate, my version supports most audio and video codecs with any sample rate, because Windows comes with a built-in APIs to decode audio and convert the audio between sample rates.
My version can capture audio directly from microphones, again because Windows comes with a Microsoft-supported API to deal with audio capture devices.
This particular point is not true (at least not fully). The version publicly announced in 2022 had ffmpeg dependency for supporting any audio-containing format. For Windows I had just to drop the binary in Python script folder and enjoy converting from anything.
On a general note, I believe using ffmpeg or gstreamer on Windows is sloppy software engineering. Media Foundation is a part of the OS and is supported by Microsoft.
For software which deals with video (as opposed to just audio) it’s even more important because GPU vendors directly supporting MF. While installing their GPU drivers, they also installing DLLs which expose their hardware codecs as media foundation transforms. Examples of such transforms are NVIDIA H.264 Encoder MFT, NVIDIA HEVC Encoder MFT, AMD D3D11 Hardware MFT Playback Decoder, and AMDh265Encoder.
When I run this, it succeeds fine but I get the message "This build of the DLL doesn’t implement the reference CPU-running Whisper model."
What does this mean? Also very interested in the hybrid option, how do you get this working, and does this use both GPU and CPU simultaneously?
It probably means you flipped the combobox on the first screen. In the build on github, the only included model implementation is GPU. The other two implementations are disabled with macros, there: https://github.com/Const-me/Whisper/blob/1.1.0/Whisper/stdaf... These implementations are lacking some UX features like callbacks and cancellation, and I haven't tested them for a while, but they might still work.
> does this use both GPU and CPU simultaneously?
No, it's sequential. There's a data dependency between these two stages. The encode function computes some buffers (probably called "cross attention" but I'm not sure, not an ML expert), and then the decode function needs that data to generate the output text.
...anyway this is great, will check it out after work!
The logic is in that method: https://github.com/Const-me/Whisper/blob/15aea5bc/Whisper/Wh...
How long is “several seconds” controlled by these user-adjustable parameters: https://github.com/Const-me/Whisper/blob/8648d1d5/Whisper/AP...
Do you have a sample audio clip you would like to add to the repo for benchmarking purposes? I'm going to try it on my 3060ti tonight and could compare times...
The text files in that folder contain performance data from two computers: a desktop with nVidia 1080Ti, and a laptop with integrated AMD GPU.
If you want just a single number, look at the “RunComplete” value in these text files.
This is very cool, thanks for porting.