Po

Port of OpenAI's Whisper model in C/C++

Hacker News

Port of OpenAI's Whisper model in C/C++

Hi HN, OpenAI recently released a model for automatic speech recognition called Whisper [0]. I decided to reimplement the inference of the model from scratch using C/C++. To achieve this I implemented a minimalistic tensor library in C and ported the high-level architecture of the model in C++. The entire code is less than 8000 lines of code and is contained in just 2 source files without any third-party dependencies. The Github project is here: https://github.com/ggerganov/whisper.cpp With this implementation I can very easily build and run the model - “make base.en” . It also allows me to run it on a wide range of devices. For example, I have provided examples of running the model on an iPhone, Raspberry Pi 4 and even in a web page via WebAssembly! The implementation runs fully on the CPU and utilizes FP16, AVX intrinsics on x86 architectures and NEON + Accelerate framework on Apple Silicon. The latter is especially efficient and I observe that the inference is about 2-3 times faster compared to the current PyTorch implementation provided by OpenAI when running it on my MacBook M1 Pro. The WASM port utilizes SIMD 128-bit intrinsics - a feature supported in some modern web browsers [1]. I am very happy with the performance that I observe on Apple Silicon devices. I didn’t expect that the Accelerate framework [2] (i.e. CBLAS) offers such a dramatic performance boost for matrix multiplications so I was very pleasantly surprised! To enable the framework in your C/C++ projects, all you have to do is add `-framework Accelerate` to your clang command-line flags. This entire exercise of implementing the Whisper model was very interesting to me and helped me understand a lot about how the transformer architecture works. I also got a lot of positive feedback from people finding and using my project. We brainstormed on a lot of interesting tools that can potentially be created with this library (such as speech-to-text plugin for Vim, RPi4 voice assistant, WASM chat bot, etc). If interested, checkout the “Examples” section and the “Show and tell” discussions for some ideas! Would love to know what you think about this project and about your experience with using the Accelerate framework in any of your projects. Cheers! [0] https://github.com/openai/whisper [1] https://chromestatus.com/feature/6533147810332672 [2] https://developer.apple.com/documentation/accelerate

Share card

Actual performance

399points
87comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: mac, model, apple · Missing: agents, macos, agent
94%94% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Strong signals: created · Missing: supports, reddit linkedin, podcasting
93%93% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: ide, 000, io · Missing: https docs, excited, just released
74%74% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRFits verified-revenue profile · Missing: mobile apps, ios, personal
54%54% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: efficient · Missing: plus, platform, intuitive
43%43% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
11%11% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Strong signals: chat · Missing: web3, crypto, cryptocurrency
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Wi
Windows port of OpenAI's Whisper automatic speech recognition model71%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Windows port of OpenAI's Whisper automatic speech recognition model

Hacker News43
I
I made a GUI for OpenAI's Whisper58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

I made a GUI for OpenAI's Whisper

Hacker News6
Ru
Run OpenAI Whisper on a Free API62%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Run OpenAI Whisper on a Free API

Hacker News1
Dj
Djoom3 – a doom 3 java port43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Djoom3 – a doom 3 java port

Hacker News1
Op
Opening the Tesla charging port with WebUSB and HackRF37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Opening the Tesla charging port with WebUSB and HackRF

Hacker News2
Bo
BookML – a bookdown flavoured GitBook port for LaTeXML37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

BookML – a bookdown flavoured GitBook port for LaTeXML

Hacker News3
HT
HTML5 port of Civilization 2: MGE60%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

HTML5 port of Civilization 2: MGE

Hacker News4
Cu
CuTile for Java Port30%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

CuTile for Java Port

Hacker News4
Ga
Gameboy port of 204841%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Gameboy port of 2048

Hacker News7
XM
XMoto Port in HTML5/CoffeeScript52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

XMoto Port in HTML5/CoffeeScript

Hacker News1