Installation

Python 3.10 or later, ffmpeg, and for every language other than English the espeak-ng program.

Linux

$ sudo apt install ffmpeg espeak-ng
$ pip install torch --index-url https://download.pytorch.org/whl/cpu
$ pip install openpronounce

The first pip line installs the CPU build of PyTorch, several times smaller than the default one. Skip it if you have an NVIDIA GPU.

macOS

$ brew install ffmpeg espeak-ng
$ pip install openpronounce

Docker

$ git clone https://github.com/OpenPronounce/OpenPronounce && cd OpenPronounce
$ docker build -t openpronounce .
$ docker run -p 8000:8000 openpronounce

The image holds the models, so the container starts fast and works offline. Dockerfile.gpu builds the same image for an NVIDIA GPU. On Windows, use Docker or WSL.

The first run

The first analysis downloads two Wav2Vec2 speech models of 1.2 GB each into the Hugging Face cache (~/.cache/huggingface, or $HF_HOME). Later runs read them from disk. To make sure nothing is fetched any more, set HF_HUB_OFFLINE=1.

Check it

$ openpronounce --models

It lists the scoring models it found, with their licence and their measured agreement. Then go to your first sentence.