Instructions to use Thorsten-Voice/Piper-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Piper
How to use Thorsten-Voice/Piper-Base with Piper:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Thorsten-Voice Piper Base (German, male, CC0)
A German male Piper base model trained exclusively on my Thorsten-Voice CC0 data, with no lessac checkpoint or any other third-party model anywhere in its history.
This model is primarily meant as a starting point for fine-tuning. If you want to train your own Piper voice and need to be sure that no restrictively licensed data is hidden somewhere in the model's ancestry, this is what it was made for. You can use it directly as a voice (see Using the model directly), but the main part of this documentation explains how to fine-tune your own Piper voice on top of it.
Why does this exist? Most Piper voices are fine-tuned from the
lessaccheckpoint, whose dataset license is unclear for commercial use. This base model offers a fully CC0 alternative for German male voices.
Contents
- Provenance
- Files in this repository
- Audio samples
- Fine-tuning guide ← main part
- Using the model directly with Piper
- Training details
- Training curves
- Limitations
- License
Provenance
Every step of this chain uses only Thorsten Müller's own recordings, released as CC0:
1. Piper-Scratch trained from scratch (random init, no lessac, no warmstart)
on Thorsten-Voice 2022.10-Neutral, ~10 h, 1800 epochs
→ https://huggingface.co/Thorsten-Voice/Piper-Scratch
│
▼ warmstart (weights only, epoch 1799)
2. This base trained on Thorsten-Voice 2021.02-Neutral + 2022.10-Neutral,
~32.4 h, 1000 epochs
All training data: Thorsten-Voice/TV-44kHz-Full (CC0).
Files in this repository
| Path | Purpose |
|---|---|
checkpoints/epoch=961-val_mel=0.3871.ckpt |
Recommended base for fine-tuning. Best validation mel loss of the whole run. |
checkpoints/epoch=751-val_mel=0.3883.ckpt |
Alternative base from an earlier stage of the run. Equivalent in blind listening tests. |
config.json |
Piper config (phoneme map, audio settings), required for training and inference |
onnx/ |
Exported ONNX models + .onnx.json for direct use with Piper |
samples/ |
Audio samples (identical texts for every model) |
runs/ |
TensorBoard event file and hparams.yaml of the full training run |
data/stats.csv |
Per-utterance statistics (subset, style, microphone, duration) of the training data |
prep_tv44k_piper.py |
The data preparation script used for this model |
The .ckpt files (≈ 800 MB each) contain generator and discriminator weights. Use them for fine-tuning: starting with a trained discriminator makes fine-tuning considerably more stable. The ONNX files are for inference only and cannot be used for training.
Audio samples
All samples use the same texts. samples/absatz.txt contains the long paragraph; testsaetze/ contains 20 short test sentences.
| Model | Paragraph |
|---|---|
| Piper-Scratch (epoch 1799, ~10 h) | |
| Base, epoch 961 (recommended) | |
| Base, epoch 751 |
Fine-tuning guide
This guide shows how to fine-tune your own Piper voice on top of this base model. The example uses the CC0 dataset Thorsten-Voice 2022.10-Neutral. The same steps apply to your own recordings.
0. A note on licensing
The base model is CC0. The license of your fine-tuned voice depends on the data you fine-tune with. If you use only CC0 data (or your own recordings that you release as CC0), the whole chain stays CC0. If you use data under other licenses, those terms apply to your result.
1. Requirements
- Linux with an NVIDIA GPU. 24 GB VRAM is comfortable; this base was trained on a 48 GB A40 with batch size 32 using ~39 GB. Reduce
batch_sizeon smaller cards. - piper1-gpl, installed for training as described in its training documentation.
This model was trained with commit
COMMIT_HASH(COMMIT_DATE). piper1-gpl is under active development, so if something in this guide no longer works, check out this commit:git clone https://github.com/OHF-Voice/piper1-gpl && cd piper1-gpl && git checkout COMMIT_HASHThe only local change wasdynamo=Falsein the ONNX export (see step 7). espeak-ng.- Additional Python packages that are not always pulled in by
[train]:torchaudio: needed for the UTMOS-basedval_mosmetric. Without it, training can crash after the first epoch.onnxscript: needed for ONNX export.
- Disk space: the training cache needs roughly 1 GB per hour of audio (audio and spectrograms are cached as tensors), plus about 9 GB for checkpoints. Lightning keeps the 5 best checkpoints per metric plus
last.ckpt, each ≈ 800 MB.
2. Prepare your data
piper1-gpl expects:
- a folder with WAV files: 22,050 Hz, mono, 16-bit PCM
- a
metadata.csvwith one line per file, in the formfilename.wav|Text of the utterance
Recommendations for good results:
- One speaker, consistent recording setup, little background noise.
- Trim leading and trailing silence and leave a short pad (~0.15 s).
- Normalize loudness across all files (for example to −23 LUFS). Mixed loudness gets learned as unwanted variation.
- Remove clips with clipping, cut-off endings, or text that doesn't match the audio.
- Keep utterances roughly between 1 and 15 seconds.
- More data helps, but even a few hours of clean recordings work well on top of a base model.
Example: Thorsten-Voice 2022.10 (CC0). The script in this repository downloads the dataset from Hugging Face, filters it, resamples it to 22,050 Hz and writes metadata.csv:
pip install datasets soundfile soxr librosa pyloudnorm
python prep_tv44k_piper.py --out ./tv_2022 --subsets TV-2022.10-Neutral
It prints how many hours were written and how many clips were discarded for which reason, and writes per-clip statistics to stats.csv. For your own recordings, adapt the loading part or apply the same steps with tools of your choice.
3. Download the base checkpoint
hf download Thorsten-Voice/Piper-Base \
"checkpoints/epoch=961-val_mel=0.3871.ckpt" config.json \
--local-dir ./base
(Older installations use huggingface-cli download with the same arguments.)
4. Start the fine-tuning
python3 -m piper.train fit \
--data.voice_name "de_DE-myvoice-medium" \
--data.csv_path ./tv_2022/metadata.csv \
--data.audio_dir ./tv_2022/wavs \
--data.espeak_voice "de" \
--data.cache_dir ./tv_2022/cache \
--data.config_path ./tv_2022/config.json \
--data.batch_size 32 \
--data.num_workers 8 \
--data.validation_split 0.02 \
--model.sample_rate 22050 \
--model.warmstart_ckpt "./base/checkpoints/epoch=961-val_mel=0.3871.ckpt" \
--trainer.default_root_dir ./runs \
--trainer.max_epochs 300
What the important options do:
| Option | Notes |
|---|---|
--model.warmstart_ckpt |
Loads the base model's weights only. Optimizer, learning-rate schedule and epoch counter start fresh, which is what you want for fine-tuning. The log should report all parameters as copied and none skipped. |
--trainer.max_epochs |
Also controls the learning-rate schedule: the learning rate is annealed to 5 % of its initial value over exactly this many epochs. Set it to what you actually intend to run. Stopping early leaves the learning rate high. |
--data.num_workers |
The default is 1, which starves the GPU. 8–12 workers took GPU utilization from ~40 % to ~75–100 % in this project. |
--data.batch_size |
32 used ~39 GB VRAM. Reduce if you run out of memory; avoid changing the utterance length limits instead. |
--data.espeak_voice |
de for German. The base model has only seen German phonemes (see Limitations). |
--data.config_path |
Written by the training run. Copy this file next to your exported ONNX model later. |
How many epochs? There is no single right answer. It depends on how much data you have and how far your voice is from Thorsten's. A practical approach is to set a moderate max_epochs, listen to intermediate checkpoints, and resume with --ckpt_path <run>/checkpoints/last.ckpt if you want to continue. A resumed run continues the learning-rate schedule seamlessly.
Run the training inside tmux or screen so it survives a closed SSH session.
Expected warning: piper1-gpl may warn about low "vocoder coverage" (fewer than ~150 passes over the training waveform). With a warmstarted decoder this is much less of a concern than when training from scratch. Judge by listening.
5. Monitor the training
tensorboard --logdir ./runs/lightning_logs --port 6006
# on your local machine:
ssh -L 6006:localhost:6006 user@server → open http://localhost:6006
The metrics worth watching:
val_mel: the main metric, and the one checkpoints are named after. It should fall steadily and flatten out over time.val_mos: automatic quality estimate (UTMOS). It is noisy, so look at the trend and don't pick checkpoints by it alone.val_kl,val_fm: slowly rising values are common with VITS and were harmless in this run, as long asval_meland the actual sound keep improving.
New epoch=…-val_mel=…ckpt files keep appearing as long as the model is still improving.
6. Listen and choose a checkpoint
Metrics only tell half the story. Synthesize the same set of sentences with several checkpoints and compare them, ideally blind (randomized A/B order, key opened only afterwards). In this project, differences that looked meaningful in the curves were often inaudible, and vice versa.
7. Export to ONNX
python3 -m piper.train.export_onnx \
--checkpoint "./runs/lightning_logs/version_0/checkpoints/epoch=XXX-val_mel=X.XXXX.ckpt" \
--output-file de_DE-myvoice-medium.onnx
cp ./tv_2022/config.json de_DE-myvoice-medium.onnx.json
Known issue with recent PyTorch versions: the new dynamo-based ONNX exporter fails on VITS' spline flows (a data-dependent assert in
transforms.py). Passingdynamo=Falsetotorch.onnx.exportin piper1-gpl'sexport_onnx.pyfixes it. The export also requiresonnxscript. Tracer warnings during export are normal.
8. Test your voice
echo "Hallo, das ist meine eigene Piper-Stimme." | \
python3 -m piper -m de_DE-myvoice-medium.onnx -f test.wav
Piper looks for the config automatically as <model>.onnx.json next to the .onnx file.
Using the model directly with Piper
The base model is a complete, working voice and can be used as-is, even though it was not primarily designed for that. Download an ONNX model together with its .onnx.json and use it like any other Piper voice:
hf download Thorsten-Voice/Piper-Base \
onnx/base_e961.onnx onnx/base_e961.onnx.json --local-dir .
echo "Guten Morgen! Wie geht es dir heute?" | \
python3 -m piper -m onnx/base_e961.onnx --length-scale 0.85 -f output.wav
Recommendation: length_scale ≈ 0.82–0.85. About 70 % of the training data comes from the 2021 recordings, which were spoken slowly and very carefully. The base model inherits that tempo. To make this the default for every application, including Home Assistant, set it in the .onnx.json:
"inference": {
"noise_scale": 0.667,
"length_scale": 0.85,
"noise_w": 0.8
}
For the best quality of my own voice, use the dedicated Thorsten-Voice Piper models, or fine-tune this base on the 2022.10 dataset as shown above.
Training details
Data
| Subset | Hours | Notes |
|---|---|---|
| TV-2021.02-Neutral | 22.7 h | slow, very clear articulation; partly recorded with a "bad" USB headset |
| TV-2022.10-Neutral | 9.7 h | studio microphone (Rode Podcaster), more natural tempo |
| Total | 32.4 h | 34,345 utterances, single speaker |
Not used: 2021.06-Emotional (extreme styles such as whispering, drunk and sleepy were excluded; all remaining clips were flagged as possibly cut off at the end) and 2023.09-Hessisch (dialect).
Preprocessing (prep_tv44k_piper.py): silence trimming with 0.15 s padding, loudness normalization to −23 LUFS, peak limiting to −1 dBFS, resampling 44.1 kHz → 22.05 kHz (soxr VHQ). Discarded clips: those with comments in the dataset, durations outside 0.8–15 s, implausible characters per second (outside 6–25, a hint at text/audio mismatches) or clipping.
Training
| Setting | Value |
|---|---|
| Framework | piper1-gpl (VITS), quality medium |
| Sample rate | 22,050 Hz |
| Initialization | warmstart from Piper-Scratch, epoch 1799 (784/784 parameters copied) |
| Epochs | 1000 (1051 steps per epoch) |
| Batch size | 32 |
| Validation split | 2 % |
| Learning rate | annealed to 5 % of the initial value over 1000 epochs |
| Hardware | 1 × NVIDIA A40 (48 GB), ~12–15 min per epoch, ~10 days total |
The full TensorBoard log is included in runs/.
Results
| Checkpoint | val_mel |
Notes |
|---|---|---|
| epoch 1 | 0.4579 | start of the run |
| epoch 751 | 0.3883 | best value of the middle phase |
| epoch 961 | 0.3871 | best value of the entire run |
| epoch 999 | ~0.388 | final state |
Best val_mos (UTMOS estimate): 3.67 at epoch 892.
Blind A/B listening tests with 20 sentences each:
- epoch 615 vs. 751: 10 : 10. No audible difference.
- epoch 961 vs. 999: 12 : 8 in favour of 961. Slight tendency, not statistically significant.
Compared with Piper-Scratch (10 h only), the base model pronounces and stresses less common words clearly more naturally. That was the purpose of the additional data.
Training curves
The complete TensorBoard log is in runs/ (also available in the Training metrics tab). The most important curves at a glance:
Limitations
- German only. The base has only seen German phonemes from espeak-ng. Fine-tuning for other languages may work for shared sounds but has not been tested.
- Slower speaking tempo inherited from the 2021 recordings (see above). Fine-tuning adopts the tempo of the target voice.
- Recording quality: most of the data was recorded with a headset, so the base sounds somewhat duller than studio recordings. Fine-tuning on clean data recovers clarity.
- Phonemization errors come from espeak-ng, not from the model. Example: "Intendantin" is stressed incorrectly. These can be fixed with custom espeak-ng dictionary entries, without retraining.
- Quality level
mediumonly.
License
CC0 1.0 Universal. Model, checkpoints, configuration, samples and scripts are dedicated to the public domain. No attribution is required, but it is always appreciated.
Credits
- Voice, recordings, datasets and training: Thorsten Müller / Thorsten-Voice
- Piper by Michael Hansen and the Open Home Foundation
- Downloads last month
- 78
Model tree for Thorsten-Voice/Piper-Base
Base model
Thorsten-Voice/Piper-Scratch
