Skip to main content

Faster Whisper transcription with CTranslate2

Project description

Faster Whisper 2 - transcription with CTranslate2

faster-whisper2 is a reimplementation of OpenAI's Whisper model using CTranslate2, which is a fast inference engine for Transformer models.

This implementation is up to 4 times faster than openai/whisper for the same accuracy while using less memory. The efficiency can be further improved with 8-bit quantization on both CPU and GPU.

Requirements

  • Python 3.9 or greater

Unlike openai-whisper, FFmpeg does not need to be installed on the system. The audio is decoded with the Python library PyAV which bundles the FFmpeg libraries in its package.

GPU

GPU execution requires the following NVIDIA libraries to be installed:

Note: The latest versions of ctranslate2 only support CUDA 12 and cuDNN 9. For CUDA 11 and cuDNN 8, the current workaround is downgrading to the 3.24.0 version of ctranslate2, for CUDA 12 and cuDNN 8, downgrade to the 4.4.0 version of ctranslate2, (This can be done with pip install --force-reinstall ctranslate2==4.4.0 or specifying the version in a requirements.txt).

There are multiple ways to install the NVIDIA libraries mentioned above. The recommended way is described in the official NVIDIA documentation, but we also suggest other installation methods below.

Other installation methods (click to expand)

Note: For all these methods below, keep in mind the above note regarding CUDA versions. Depending on your setup, you may need to install the CUDA 11 versions of libraries that correspond to the CUDA 12 libraries listed in the instructions below.

Use Docker

The libraries (cuBLAS, cuDNN) are installed in this official NVIDIA CUDA Docker images: nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04.

Install with pip (Linux only)

On Linux these libraries can be installed with pip. Note that LD_LIBRARY_PATH must be set before launching Python.

pip install nvidia-cublas-cu12 nvidia-cudnn-cu12==9.*

export LD_LIBRARY_PATH=`python3 -c 'import os; import nvidia.cublas.lib; import nvidia.cudnn.lib; print(os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__))'`

Installation

The module can be installed from PyPI:

pip install faster-whisper2
Other installation methods (click to expand)

Install the master branch

pip install --force-reinstall "faster-whisper2 @ https://github.com/BBC-Esq/faster-whisper2/archive/refs/heads/master.tar.gz"

Install a specific commit

pip install --force-reinstall "faster-whisper2 @ https://github.com/BBC-Esq/faster-whisper2/archive/a4f1cc8f11433e454c3934442b5e1a4ed5e865c3.tar.gz"
Community integrations (click to expand)

Here is a non exhaustive list of open-source projects using faster-whisper. Feel free to add your project to the list!

  • speaches is an OpenAI compatible server using faster-whisper. It's easily deployable with Docker, works with OpenAI SDKs/CLI, supports streaming, and live transcription.
  • WhisperX is an award-winning Python library that offers speaker diarization and accurate word-level timestamps using wav2vec2 alignment
  • whisper-ctranslate2 is a command line client based on faster-whisper and compatible with the original client from openai/whisper.
  • whisper-diarize is a speaker diarization tool that is based on faster-whisper and NVIDIA NeMo.
  • whisper-standalone-win Standalone CLI executables of faster-whisper for Windows, Linux & macOS.
  • asr-sd-pipeline provides a scalable, modular, end to end multi-speaker speech to text solution implemented using AzureML pipelines.
  • Open-Lyrics is a Python library that transcribes voice files using faster-whisper, and translates/polishes the resulting text into .lrc files in the desired language using OpenAI-GPT.
  • wscribe is a flexible transcript generation tool supporting faster-whisper, it can export word level transcript and the exported transcript then can be edited with wscribe-editor
  • aTrain is a graphical user interface implementation of faster-whisper developed at the BANDAS-Center at the University of Graz for transcription and diarization in Windows (Windows Store App) and Linux.
  • Whisper-Streaming implements real-time mode for offline Whisper-like speech-to-text models with faster-whisper as the most recommended back-end. It implements a streaming policy with self-adaptive latency based on the actual source complexity, and demonstrates the state of the art.
  • WhisperLive is a nearly-live implementation of OpenAI's Whisper which uses faster-whisper as the backend to transcribe audio in real-time.
  • Faster-Whisper-Transcriber is a simple but reliable voice transcriber that provides a user-friendly interface.
  • Open-dubbing is open dubbing is an AI dubbing system which uses machine learning models to automatically translate and synchronize audio dialogue into different languages.
  • Whisper-FastAPI whisper-fastapi is a very simple script that provides an API backend compatible with OpenAI, HomeAssistant, and Konele (Android voice typing) formats.

Contributing

Pull requests are welcome! Before submitting, make sure your code passes the following checks. You can run them locally to catch issues early:

1. Black (code formatting)

Black enforces a consistent code style. It handles things like indentation, trailing commas, quote style, and line wrapping. The project uses a max line length of 100 characters.

black --check .     # check for issues
black .             # auto-fix formatting

2. isort (import sorting)

isort ensures imports are grouped (stdlib, third-party, local) and alphabetically sorted. It's configured to be compatible with Black.

isort --check-only .   # check for issues
isort .                # auto-fix import order

3. Flake8 (linting)

Flake8 catches common issues like unused imports, undefined names, and style violations. Max line length is 100 characters.

flake8 .

4. Pytest (tests)

The test suite must pass. Some tests require model downloads and may take a while on the first run.

pytest -v tests/

Quick setup

Install the dev dependencies and run all checks:

pip install -e ".[dev]"
black . && isort . && flake8 . && pytest -v tests/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faster_whisper2-2.0.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faster_whisper2-2.0.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file faster_whisper2-2.0.0.tar.gz.

File metadata

  • Download URL: faster_whisper2-2.0.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for faster_whisper2-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5939c1f5e8e2d7138386b406f12c39d9b973298028a08199bc62580eeb6856f4
MD5 689cd7ef67618326ebdacbc41e675590
BLAKE2b-256 5c7a4fe32c0c16dcac9524da22001637e17d363a8958ae14ecbd12204a401413

See more details on using hashes here.

Provenance

The following attestation bundles were made for faster_whisper2-2.0.0.tar.gz:

Publisher: publish.yml on BBC-Esq/faster-whisper2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file faster_whisper2-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for faster_whisper2-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9fd305fc9ef808d8860cc1db8c4c990af0ff609fe29bdd18948c148f04f87dc
MD5 252294deb9f6618a8cef9903732e4183
BLAKE2b-256 c24fbc84a6ba2ace5766b23dbc77872c791599146374a9c6409679954c205c8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for faster_whisper2-2.0.0-py3-none-any.whl:

Publisher: publish.yml on BBC-Esq/faster-whisper2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page