collabora / WhisperLive

A nearly-live implementation of OpenAI's Whisper.
MIT License
1.54k stars 209 forks source link
dictation obs openai tensorrt tensorrt-llm text-to-speech translation voice-recognition whisper whisper-tensorrt

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

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

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](https://github.com/collabora/WhisperLive/blob/main/TensorRT_whisper.md) which works as expected. Make sure to build your TensorRT Engines before running the server with TensorRT backend.
```bash
# 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

Controlling OpenMP Threads

To control the number of threads used by OpenMP, you can set the OMP_NUM_THREADS environment variable. This is useful for managing CPU resources and ensuring consistent performance. If not specified, OMP_NUM_THREADS is set to 1 by default. You can change this by using the --omp_num_threads argument:

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

Single model mode

By default, when running the server without specifying a model, the server will instantiate a new whisper model for every client connection. This has the advantage, that the server can use different model sizes, based on the client's requested model size. On the other hand, it also means you have to wait for the model to be loaded upon client connection and you will have increased (V)RAM usage.

When serving a custom TensorRT model using the -trt or a custom faster_whisper model using the -fw option, the server will instead only instantiate the custom model once and then reuse it for all client connections.

If you don't want this, set --no_single_model.

Running the Client

Browser Extensions

Whisper Live Server in Docker

Future Work

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}
}