OpenAI Whisper is a general-purpose automatic speech recognition (ASR) model, developed by OpenAI. It is trained on a large dataset of diverse audio and is capable of multilingual speech recognition, speech translation, and language identification. Releases are somewhat irregular, with multiple updates typically published each year, often in dated version formats (e.g., YYYYMMDD).
pip install -U openai-whisperVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load a Whisper model and transcribe an audio file. It will download the chosen model on the first run. Ensure you have FFmpeg installed on your system for audio file processing. A dummy audio file is generated if `scipy` is available, otherwise, please provide your own.
Install FFmpeg on your system. Verify its installation by running `ffmpeg -version` in your terminal.
If you intend to use OpenAI's hosted Whisper API, you need to install `pip install openai` and follow their API documentation. This library is for running the model locally.
Choose a smaller model size (e.g., 'tiny', 'base', 'small') if you have limited resources. Ensure your system meets the memory requirements, or consider using optimized Whisper variants like `Faster Whisper` or `whisper.cpp` for lower resource consumption.
Ensure you have a Rust compiler and C++ build tools installed. For Windows, install 'Desktop development with C++' workload from Visual Studio Installer. For macOS, install Xcode Command Line Tools (`xcode-select --install`).
Consider using the `no_speech_prob` parameter (if available in your wrapper) to filter outputs, pre-process audio to reduce noise, or use prompting techniques to guide the model towards specific vocabulary or style. For API users, ensure audio file sizes are within limits (e.g., typically <25MB for OpenAI API).
For translation tasks, use multilingual models such as `tiny`, `base`, `small`, `medium`, or `large`. The `medium` or `large` models are generally recommended for the best translation accuracy.