Faster-Whisper: Install and Transcribe Locally on Linux with GPU

Female IT engineer configuring faster-whisper speech recognition on a Linux server
Faster-Whisper: Install and Transcribe Locally on Linux with GPU 3

To run faster-whisper on Linux with NVIDIA GPU acceleration, you install the package within a dedicated Python virtual environment alongside the required cuBLAS and cuDNN 9 runtime libraries. Because faster-whisper reimplements OpenAI’s speech recognition architecture using the high-performance CTranslate2 engine, it delivers up to four times faster transcription speed and substantially lower VRAM usage through FP16 and INT8 quantization. This step-by-step guide walks you through system prerequisites, dependency management, library linking, production script deployment, and voice activity filtering on local Linux servers.

Why Choose Faster-Whisper Over Standard OpenAI Whisper?

OpenAI’s original Whisper model transformed automated speech recognition (ASR), but its default PyTorch implementation is notorious for heavy memory consumption and relatively slow sequential execution. When transcribing large audio libraries, customer calls, or podcasts, vanilla Whisper can easily monopolize a high-end graphics card and struggle to achieve real-time latency.

faster-whisper solves these bottlenecks by wrapping the Whisper model weights inside CTranslate2, a dedicated C++ inference engine designed specifically for Transformer architectures. CTranslate2 provides custom kernel optimizations, efficient memory layout management, and native 8-bit quantization. Furthermore, faster-whisper handles media decoding using the bundled PyAV library rather than relying on external system-wide FFmpeg binaries, simplifying containerized and headless deployments.

FeatureStandard openai/whisperfaster-whisper
Backend EnginePyTorch / Hugging FaceCTranslate2 (C++ optimized)
Inference SpeedBaseline (1x)Up to 4x faster (sequential), even faster with batching
VRAM Footprint (large-v3, FP16)~4.7 GB to 6.5 GB~4.5 GB (FP16) / ~2.9 GB (INT8)
Quantization SupportLimited / complex setupNative FP16, INT8, and INT8_FLOAT16
Audio DecodingRequires external FFmpeg CLIPyAV (bundled FFmpeg libraries)
Voice Activity Detection (VAD)Basic thresholdingIntegrated Silero VAD filter

Prerequisites and Hardware Requirements

Before installing faster-whisper with hardware acceleration, ensure your host environment meets the following specifications:

  • Operating System: Ubuntu 22.04 LTS, Ubuntu 24.04 LTS, Debian 12, or comparable modern Linux distribution.
  • GPU Hardware: NVIDIA graphics card with Turing, Ampere, Ada Lovelace, or Hopper architecture (RTX 2000 series or newer recommended, minimum 4 GB VRAM for small/medium models, 8 GB+ for large-v3).
  • NVIDIA Driver: Version 535 or higher supporting CUDA 12. If you need to prepare your base environment, follow our detailed walkthrough on how to install CUDA on Ubuntu.
  • Python Runtime: Python 3.9 through Python 3.12 (Python 3.10 or 3.11 is ideal for stability).

Step 1: Set Up the Linux Environment and Virtualenv

Modern Linux distributions enforce PEP 668, preventing direct pip install commands into the system Python environment. Always isolate machine learning dependencies within a clean virtual environment.

Update your package repositories and install the required build tools and Python venv module:

sudo apt update && sudo apt install -y python3-venv python3-pip python3-dev build-essential

Create a dedicated workspace directory and initialize the virtual environment:

mkdir -p ~/apps/whisper-transcribe && cd ~/apps/whisper-transcribe
python3 -m venv venv
source venv/bin/activate

Upgrade pip, setuptools, and wheel inside the active virtual environment:

pip install --upgrade pip setuptools wheel

Step 2: Install CUDA Libraries and faster-whisper

Recent releases of CTranslate2 and faster-whisper require CUDA 12 and cuDNN 9 runtime libraries. Rather than compiling complex shared objects system-wide, you can install the official NVIDIA binary wheels directly inside your Python virtual environment using pip.

Execute the following command to install the required cuBLAS, cuDNN 9 packages, and faster-whisper:

pip install nvidia-cublas-cu12 "nvidia-cudnn-cu12>=9.0.0"
pip install faster-whisper

This approach keeps all shared libraries self-contained within your project’s venv/lib/python3.X/site-packages/nvidia/ directory without modifying global system configurations or risking conflicts with other AI frameworks like PyTorch or TensorFlow.

Step 3: Configure the Shared Library Path (LD_LIBRARY_PATH)

Because the NVIDIA cuDNN and cuBLAS shared libraries reside inside the virtual environment rather than standard system paths (such as /usr/local/cuda/lib64), the dynamic linker must be informed where to locate them. Without this configuration, CTranslate2 will fail when initializing the CUDA device.

You can export the dynamic library path dynamically in your active shell:

export LD_LIBRARY_PATH=$(python3 -c 'import os, nvidia.cublas, nvidia.cudnn; print(os.path.dirname(nvidia.cublas.__path__[0]) + "/cublas/lib:" + os.path.dirname(nvidia.cudnn.__path__[0]) + "/cudnn/lib")'):$LD_LIBRARY_PATH

To persist this setting every time you activate your virtual environment, append the export command directly to your virtual environment’s activation script:

cat << 'EOF' >> venv/bin/activate

# Auto-configure NVIDIA library paths for CTranslate2 / faster-whisper
export LD_LIBRARY_PATH=$(python3 -c 'import os, nvidia.cublas, nvidia.cudnn; print(os.path.dirname(nvidia.cublas.__path__[0]) + "/cublas/lib:" + os.path.dirname(nvidia.cudnn.__path__[0]) + "/cudnn/lib")'):$LD_LIBRARY_PATH
EOF

Step 4: Create the Python Transcription Script

Now create a production-ready Python script that loads an optimized model, detects speech, and prints timestamps. Create a file named transcribe.py:

cat << 'EOF' > transcribe.py
import sys
import time
from faster_whisper import WhisperModel

def run_transcription(audio_path: str, model_name: str = "large-v3", compute: str = "float16"):
    print(f"Loading model '{model_name}' on GPU (compute_type={compute})...")
    start_load = time.time()
    
    # Initialize model on CUDA device
    model = WhisperModel(model_name, device="cuda", compute_type=compute)
    print(f"Model loaded in {time.time() - start_load:.2f} seconds.")

    print(f"Transcribing audio file: {audio_path}")
    start_transcribe = time.time()
    
    # Run transcription
    # Note: segments is a generator that computes on iteration
    segments, info = model.transcribe(
        audio_path,
        beam_size=5,
        vad_filter=True,
        vad_parameters=dict(min_silence_duration_ms=500)
    )

    print(f"Detected language: '{info.language}' with confidence {info.language_probability:.2%}")
    print(f"Audio duration: {info.duration:.2f} seconds\n--- Transcript Output ---")

    for segment in segments:
        print(f"[{segment.start:6.2f}s -> {segment.end:6.2f}s] {segment.text}")

    print(f"-------------------------\nFinished in {time.time() - start_transcribe:.2f} seconds.")

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python3 transcribe.py <audio_file.mp3|wav|m4a> [model_name] [compute_type]")
        sys.exit(1)
        
    audio_file = sys.argv[1]
    selected_model = sys.argv[2] if len(sys.argv) > 2 else "large-v3"
    selected_compute = sys.argv[3] if len(sys.argv) > 3 else "float16"
    
    run_transcription(audio_file, selected_model, selected_compute)
EOF

Notice the crucial vad_filter=True parameter. By integrating Silero Voice Activity Detection, faster-whisper strips out periods of silence or background room noise before forwarding audio packets to the neural network. This prevents hallucinations and repetitive loops during long pauses.

Step 5: Test Execution and Verify GPU Utilization

To verify the setup, run the script against an audio file. When you first execute the script with a model such as large-v3 or turbo, faster-whisper automatically downloads the pre-converted CTranslate2 model weights from Hugging Face into your ~/.cache/huggingface/hub/ directory:

python3 transcribe.py sample_recording.mp3 large-v3 float16

In a second terminal window, verify that the transcription process utilizes your NVIDIA hardware by monitoring GPU memory and computational load:

watch -n 0.5 nvidia-smi

You should observe the Python process allocating approximately 4.5 GB of VRAM for large-v3 in FP16 mode. If your GPU has limited memory (e.g. 6 GB or 8 GB total VRAM), switch the compute type to 8-bit integer quantization:

python3 transcribe.py sample_recording.mp3 large-v3 int8_float16

With int8_float16, memory usage drops to roughly 2.9 GB VRAM while preserving transcription accuracy, allowing you to run speech-to-text models alongside local LLMs deployed via tools like vLLM or Home Assistant automation stacks like our local voice assistant with Piper and Home Assistant.

High-Throughput Batched Transcription

If you need to process large batches of files or lengthy audio recordings, sequential processing leaves GPU cores idle during encoder-decoder step transitions. faster-whisper provides a specialized BatchedInferencePipeline class that batches audio chunks concurrently:

from faster_whisper import WhisperModel, BatchedInferencePipeline

# Load the base model
model = WhisperModel("large-v3", device="cuda", compute_type="float16")

# Wrap in batched inference pipeline
batched_model = BatchedInferencePipeline(model=model)

# Transcribe with batching (batch_size=8 or 16)
segments, info = batched_model.transcribe("long_interview.mp3", batch_size=16)

for segment in segments:
    print(f"[{segment.start:.2f}s -> {segment.end:.2f}s] {segment.text}")

Batched inference maximizes tensor core utilization, processing multi-hour recordings significantly faster than standard one-at-a-time decoding pipelines.

Troubleshooting Common Faster-Whisper Errors

When deploying faster-whisper on headless Linux systems, you may encounter one of three common issues:

1. Could Not Load Library libcudnn_ops_infer.so or libcublas.so

Symptom: Python crashes with RuntimeError: Library libcudnn_ops_infer.so.9 is not found or cannot be loaded.

Cause: The operating system dynamic linker cannot locate the pip-installed NVIDIA libraries at runtime.

Solution: Verify that nvidia-cudnn-cu12 version 9 is installed, and re-export the LD_LIBRARY_PATH variable within your active shell session before launching Python:

export LD_LIBRARY_PATH=$(python3 -c 'import os, nvidia.cublas, nvidia.cudnn; print(os.path.dirname(nvidia.cublas.__path__[0]) + "/cublas/lib:" + os.path.dirname(nvidia.cudnn.__path__[0]) + "/cudnn/lib")'):$LD_LIBRARY_PATH

2. CUDA Out of Memory (OOM) Errors

Symptom: The process terminates abruptly with CUDA failed with error out of memory.

Cause: The selected model (e.g. large-v3 in full FP16) exceeds the available video RAM on your card, particularly when processing long context windows or running concurrent workloads.

Solution: Apply INT8 quantization by setting compute_type="int8_float16" or switch to the highly efficient turbo or distil-large-v3 model weights, which cut memory demands roughly in half with negligible loss in accuracy.

3. Script Finishes Instantly Without Printing Transcripts

Symptom: Running model.transcribe(...) returns immediately, but no text appears or the script exits without processing the audio.

Cause: In faster-whisper, model.transcribe() returns a Python generator (segments). The actual inference computation only runs on demand as you iterate through the generator.

Solution: Ensure your code iterates over the generator with a for segment in segments: loop, or force full execution by consuming the generator into a list: segments = list(segments).

Frequently Asked Questions

Can faster-whisper run on CPU if no NVIDIA GPU is available?

Yes. Set device="cpu" and compute_type="int8" when instantiating WhisperModel. CTranslate2 utilizes AVX-512 and AVX2 vector instructions on modern Intel and AMD processors, transcribing speech substantially faster on standard CPUs than the reference PyTorch implementation.

Does faster-whisper require FFmpeg to be installed on Linux?

No. Unlike OpenAI’s original Whisper library, faster-whisper does not execute external FFmpeg command-line subprocesses. It utilizes the PyAV Python library, which packages pre-compiled FFmpeg decoding libraries directly inside the Python wheel, supporting MP3, WAV, FLAC, OGG, and MP4 out of the box.

How do I generate word-level timestamps with faster-whisper?

Enable word-level alignment by passing word_timestamps=True into model.transcribe(). You can then iterate over segment.words to access the exact start and end millisecond timestamps for each spoken word, which is ideal for subtitle generation (SRT/VTT) and automated video editing.

Conclusion

Deploying faster-whisper on Linux unlocks enterprise-grade speech-to-text throughput without ongoing cloud transcription bills or privacy exposures. By leveraging CTranslate2’s optimized execution graph, pip-installed cuDNN 9 libraries, and INT8 quantization, you can achieve lightning-fast local transcription on consumer GPUs. Combine it with Silero VAD to eliminate dead silence, and leverage batched inference pipelines to process massive audio archives reliably.