Skip to main content

A nearly-live implementation of OpenAI's Whisper.

Project description

WhisperLive

WhisperLive

A nearly-live implementation of OpenAI's Whisper.

This project is a real-time transcription application that uses the OpenAI Whisper model to convert speech input into text output. It can be used to transcribe both live audio input from microphone and pre-recorded audio files.

Installation

  • Install PyAudio and ffmpeg
 bash scripts/setup.sh
  • Install whisper-live from pip
 pip install whisper-live

Setting up NVIDIA/TensorRT-LLM for TensorRT backend

Getting Started

The server supports two backends faster_whisper and tensorrt. If running tensorrt backend follow TensorRT_whisper readme

Running the Server

python3 run_server.py --port 9090 \
                      --backend faster_whisper

# running with custom model
python3 run_server.py --port 9090 \
                      --backend faster_whisper
                      -fw "/path/to/custom/faster/whisper/model"
  • TensorRT backend. Currently, we recommend to only use the docker setup for TensorRT. Follow TensorRT_whisper readme which works as expected. Make sure to build your TensorRT Engines before running the server with TensorRT backend.
# Run English only model
python3 run_server.py -p 9090 \
                      -b tensorrt \
                      -trt /home/TensorRT-LLM/examples/whisper/whisper_small_en

# Run Multilingual model
python3 run_server.py -p 9090 \
                      -b tensorrt \
                      -trt /home/TensorRT-LLM/examples/whisper/whisper_small \
                      -m

Running the Client

  • Initializing the client:
from whisper_live.client import TranscriptionClient
client = TranscriptionClient(
  "localhost",
  9090,
  lang="en",
  translate=False,
  model="small",
  use_vad=False,
)

It connects to the server running on localhost at port 9090. Using a multilingual model, language for the transcription will be automatically detected. You can also use the language option to specify the target language for the transcription, in this case, English ("en"). The translate option should be set to True if we want to translate from the source language to English and False if we want to transcribe in the source language.

  • Trancribe an audio file:
client("tests/jfk.wav")
  • To transcribe from microphone:
client()
  • To transcribe from a HLS stream:
client(hls_url="http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_1xtra/bbc_1xtra.isml/bbc_1xtra-audio%3d96000.norewind.m3u8") 

Browser Extensions

Whisper Live Server in Docker

  • GPU

    • Faster-Whisper
    docker run -it --gpus all -p 9090:9090 ghcr.io/collabora/whisperlive-gpu:latest
    
    • TensorRT. Follow TensorRT_whisper readme in order to setup docker and use TensorRT backend. We provide a pre-built docker image which has TensorRT-LLM built and ready to use.
  • CPU

docker run -it -p 9090:9090 ghcr.io/collabora/whisperlive-cpu:latest

Note: By default we use "small" model size. To build docker image for a different model size, change the size in server.py and then build the docker image.

Future Work

  • Add translation to other languages on top of transcription.
  • TensorRT backend for Whisper.

Contact

We are available to help you with both Open Source and proprietary AI projects. You can reach us via the Collabora website or vineet.suryan@collabora.com and marcus.edel@collabora.com.

Citations

@article{Whisper
  title = {Robust Speech Recognition via Large-Scale Weak Supervision},
  url = {https://arxiv.org/abs/2212.04356},
  author = {Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
  publisher = {arXiv},
  year = {2022},
}
@misc{Silero VAD,
  author = {Silero Team},
  title = {Silero VAD: pre-trained enterprise-grade Voice Activity Detector (VAD), Number Detector and Language Classifier},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/snakers4/silero-vad}},
  email = {hello@silero.ai}
}

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

whisper-live-0.4.1.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

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

whisper_live-0.4.1-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

Details for the file whisper-live-0.4.1.tar.gz.

File metadata

  • Download URL: whisper-live-0.4.1.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for whisper-live-0.4.1.tar.gz
Algorithm Hash digest
SHA256 f0e57de964d70c2b2d10a7dddd40d4a458f62c928872d0449cdf0c7bffee3304
MD5 c35e1ced223efc044a4995200cf7307b
BLAKE2b-256 f50ce6690d13a8d2cec0b3c9b0e4cef1d723a9541635d4810daecd18893a5b62

See more details on using hashes here.

File details

Details for the file whisper_live-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: whisper_live-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for whisper_live-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eea0089b8d8570d3e61a377d88614e25be2ee893596e08f00f47c03906ffacc9
MD5 201504a2aae0967e989800a87a3e9e4e
BLAKE2b-256 40579f26ad6bcb07284effeefa7053567606a1183f6032e1838aaa5555368d6a

See more details on using hashes here.

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