whispercpp Python Bindings

repository·main·Indexed 43 days ago

https://github.com/aarnphm/whispercpp

High-performance Pybind11 bindings for whisper.cpp, providing efficient speech-to-text transcription in Python. It features a high-level Whisper class for loading models via from_pretrained() and performing transcription from NumPy arrays or WAV files, as well as a low-level api module for direct access to whisper.cpp structures like Context and Params.

Tokens
4.6K
Snippets
21
Records
28
Agent score
54%

What's inside whispercpp

  1. Build and install whispercpp from source

    main

    For local development or custom builds, first initialize the submodules. You can then build the wheel using either pypa/build or bazel, and install the resulting wheel.

    # Initialize submodules
    git submodule update --init --recursive
    
    # Option 1: using pypa/build
    python3 -m build -w
    pip install dist/*.whl
    
    # Option 2: using bazel
    ./tools/bazel build //:whispercpp_wheel
    pip install $(./tools/bazel info bazel-bin)/*.whl
  2. Install whispercpp via pip

    main

    You can install the prebuilt package using pip. For platforms without prebuilt wheels, a hermetic toolchain will be used during installation, which may take longer. Use the -vv flag to monitor progress.

    To install the latest version directly from the GitHub repository, use the following command:

    # Standard installation
    pip install whispercpp
    
    # Install latest version from source
    pip install git+https://github.com/aarnphm/whispercpp.git -vv
  3. Build whispercpp from source

    main

    To build the project locally, first initialize all submodules:

    git submodule update --init --recursive

    Then, you can build the wheel using one of two methods:

    Option 1: Using pypa/build

    python3 -m build -w

    Option 2: Using Bazel

    ./tools/bazel build //:whispercpp_wheel

    After building, install the resulting wheel:

    Via pypa/build:

    pip install dist/*.whl

    Via Bazel:

    pip install $(./tools/bazel info bazel-bin)/*.whl
    git submodule update --init --recursive
    python3 -m build -w
    pip install dist/*.whl