SuperAPI AI Directory

whisper

Open-source AI subtitle generator by OpenAI. Free, runs locally.

Open website

About this tool

Whisper is an open-source general-purpose speech recognition model released by OpenAI, with the related paper titled "Robust Speech Recognition via Large-Scale Weak Supervision." It is trained on large-scale, diverse audio datasets and is a multi-task model capable of multilingual speech recognition, speech translation, and language identification.

Main capabilities Whisper uses a Transformer sequence-to-sequence model trained on a variety of speech processing tasks, including multilingual speech recognition, speech translation, spoken language identification, and voice activity detection. These tasks are unified as a sequence of tokens that the decoder must predict, allowing a single model to replace multiple stages in a traditional speech processing pipeline. The multi-task training format uses a set of special tokens as task specifiers or classification targets.

Models and languages Whisper offers six model sizes, four of which have English-only versions, providing a trade-off between speed and accuracy. The English-only .en models generally perform better in English applications, especially tiny.en and base.en; for small.en and medium.en, the difference becomes less noticeable. The turbo model is an optimized version of large-v3, with faster transcription speed and minimal accuracy degradation. Whisper's performance varies by language; the paper provides the WER (word error rate) or CER (character error rate) performance of large-v3 and large-v2 by language on the Common Voice 15 and Fleurs datasets, while metrics for other models and datasets can be found in Appendix D.1, D.2, and D.4 of the paper, and BLEU scores for translation can be found in Appendix D.3.

Usage Whisper was trained and tested using Python 3.9.9 and PyTorch 1.10.1, and the codebase is expected to be compatible with Python 3.8-3.11 and newer PyTorch versions. The codebase depends on several Python packages, most notably OpenAI's tiktoken fast tokenizer implementation. You can install or update to the latest release via pip, or pull and install the latest commit of the repository and its Python dependencies, or update the package to the latest version of the repository. The system also requires the command-line tool ffmpeg to be installed, which is available from most package managers. If tiktoken does not provide prebuilt wheels for your platform, you may also need to install Rust; if an error occurs during pip installation, please install the Rust development environment according to the Rust getting started page, and you may need to configure the PATH environment variable, for example export PATH="$HOME/.cargo/bin:$PATH". If the installation fails with the message No module named 'setuptools_rust', you need to install setuptools_rust.

Command-line usage The following command uses the turbo model to transcribe speech from an audio file. The default settings (selecting the turbo model) are suitable for transcribing English. However, the turbo model was not trained for translation tasks. If you need to translate non-English speech into English, use a multilingual model (tiny, base, small, medium, large) instead of turbo. For example, to transcribe an audio file containing non-English speech, you can specify the language; to translate into English, use the corresponding command. Note: even if --task translate is specified, the turbo model will return the original language. Translation works best with medium or large. Run the corresponding command to see all available options. The list of available languages can be found in tokenizer.py.

Using in Python Transcription can also be performed in Python. Internally, the transcribe() method reads the entire file and processes the audio in 30-second sliding windows, performing autoregressive sequence-to-sequence prediction for each window. whisper.detect_language() and whisper.decode() provide lower-level access to the model.

Use cases and limitations Whisper is suitable for scenarios such as speech transcription, multilingual speech recognition, speech translation, and language identification, and can be run locally. Its performance varies significantly depending on factors such as language, speaking rate, and available hardware. The turbo model is not suitable for translation tasks; for translation, it is recommended to use medium or large. The code and model weights are released under the MIT license, see LICENSE for details.