Training a Tiny Piper TTS Model for Any Language Revisited

Neurlang

2026/06/25

Training a Tiny Piper TTS Model for Any Language Revisited

Updated June 2026 to reflect the new piper1-gpl repository and its revised CLI.

This guide will walk you through training your own tiny Piper text-to-speech model in any language. Piper has been successfully tested with languages like Hebrew, Korean, and Slovak, so it should work well for many languages.

What is Piper?

Piper is a neural text-to-speech system that can generate natural-sounding speech. We’ll be training a small version that can run efficiently on various devices.

Setting Up the Environment

First, install the basic system dependencies:

sudo apt install python3.14-venv python3-dev libasound2-dev libssl-dev

Then clone the Piper training repository:

git clone https://github.com/neurlang/piper1-gpl -b rebase-piper-inner
cd piper1-gpl

Now we’ll create a Python virtual environment. This keeps our project’s dependencies separate from other Python projects on your system:

python3 -m venv venv
venv/bin/pip install uv

UV is a fast Python package manager that we’ll use to handle dependencies.

Create another virtual environment using UV, then activate it:

venv/bin/uv venv
source .venv/bin/activate

Install the required Python packages for training:

venv/bin/uv pip install -e .

The -e flag means we’re installing in “editable” mode, so changes to the source code will be immediately reflected.

Finally, build the monotonic alignment algorithm used during training:

./build_monotonic_align.sh

This compiles C++ code that helps align text with audio during training.

Preparing Your Dataset

You need a dataset of audio files with their corresponding text transcripts. The dataset should be in LJSpeech format, which is a common format for TTS datasets.

If you already have a dataset, you can create a symbolic link to it:

ln -s -T ~/your/dataset/path/ dataset

This creates a shortcut called “dataset” that points to your actual dataset folder.

Preprocessing Your Data

Before training, we need to convert your dataset into a format Piper can understand:

./venv/bin/uv run --with pygoruut===0.8.1 --with librosa --with torch \
    python -m piper.train.preprocess \
    --language=sk \
    --input-dir ./dataset \
    --output-dir ./train \
    --dataset-format ljspeech \
    --single-speaker \
    --sample-rate 48000 \
    --phoneme-type pygoruut \
    --max-workers 1

Let’s break down what each option does:

Choosing the right language code: You can use:

Dataset format options:

Example of LJSpeech format in metadata.csv:

audio_file_001|This is the text that will be spoken.|This is the text that will be spoken.

This preprocessing step creates the ./train folder with config.json and training files.

Starting the Training

Now we begin the actual training process. Note the new fit subcommand and trainer flags compared to older versions:

./venv/bin/uv run \
    --with pygoruut \
    --with "jsonargparse[signatures]>=4.27.7" \
    --with librosa \
    --with lightning \
    --with torch \
    python -m piper.train fit \
    --trainer.accelerator gpu \
    --trainer.devices 1 \
    --trainer.precision 32 \
    --trainer.max_epochs 990000 \
    --trainer.default_root_dir . \
    --data.batch_size 1 \
    --data.validation_split 0 \
    --data.num_test_examples 0 \
    --data.config_path fit/config.json \
    --data.csv_path dataset/metadata.csv \
    --data.cache_dir fit/cache \
    --data.espeak_voice Slovak \
    --data.voice_name slovak \
    --data.phoneme_type pygoruut

Key settings to adjust:

Training will take time — potentially hours or days depending on your dataset size and hardware.

Monitoring Training Progress

You can monitor training with TensorBoard, which shows graphs of training progress:

./venv/bin/uv run tensorboard --logdir ./lightning_logs/

Then open your web browser to the address shown in the output (usually http://localhost:6006).

Exporting Your Trained Model

Once training is complete, convert your model to ONNX format for use in applications:

./venv/bin/uv run \
    --with onnxscript \
    --with torch \
    --with lightning \
    --with librosa \
    python -m piper.train.export_onnx \
    --checkpoint ./lightning_logs/version_0/checkpoints/*.ckpt \
    --output-file ./output_model.onnx

This creates output_model.onnx — your final trained text-to-speech model, ready to use! Distribute it along with train/config.json.

Tips for Success

Congratulations! You now have the knowledge to train your own text-to-speech model.

For inference you can use the Piper Rust code as demonstrated in this model: https://huggingface.co/neurlang/piper-onnx-slovakspeech-female-slovak-0.8.0