Instructions to use Pladdra/birgitta-sv with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Piper
How to use Pladdra/birgitta-sv 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
Birgitta – light, fast Swedish TTS (23 MB, CPU)
Svenska i korthet: en liten svensk talsyntes (VITS/Piper, ~17 M parametrar) som kör cirka 50 gånger snabbare än realtid på vanlig CPU. Den här sidan beskriver filerna, hur du använder modellen, hur den är tränad och hur du kan träna vidare.
Status: Voice rights and the warm-start chain are confirmed by the author (2026-11-18). Licence: Apache-2.0 for weights, checkpoint, training scripts and lexicons. The phonemiser dependency (espeak-ng via
piper-tts) is GPL-3, see the licence section.
Birgitta is a single Swedish voice inside a small multi-speaker Piper/VITS student model (speaker id 12). It is meant for devices and servers where a 300 MB model is too much: 22.05 kHz mono, runs in ONNX Runtime on CPU.
Files
File (weights/) |
Size | Notes |
|---|---|---|
birgitta-v24-pcdec.onnx |
23 MB | Recommended. int8 per channel, decoder kept in fp32 |
birgitta-v24-int8pc.onnx |
20 MB | smaller, ~+0.4 pp word error vs fp32 (not significant) |
birgitta-v24-fp32.onnx |
67 MB | reference |
*.onnx.json |
Piper config (phoneme map, sample rate) | |
checkpoint/birgitta-v24.ckpt |
288 MB | training checkpoint (fp32 weights, no optimizer) for fine-tuning |
Other folders: samples/ (audio), lexicon/ (hand-corrected pronunciations used by the phonemiser), training/ (scripts and the recipe).
Quality (automatic, 300 test sentences)
Word error rate with KB-Whisper-large (speech recognition), naturalness with UTMOS (1–5). These are diagnostics, not human ratings. Choices between versions were made with blind listening tests.
| Variant | Size | Word error | UTMOS |
|---|---|---|---|
| pcdec (recommended) | 23 MB | 4.1 % | 3.86 |
| int8 per channel | 20 MB | 4.3 % | 3.77 |
| int8 per tensor | 20 MB | 4.9 % | 3.78 |
| fp32 | 67 MB | 3.9 % | 3.86 |
| Kokoro-SV Ebba (reference, other model) | 114 MB int8 | 4.0 % | 3.98 |
On the author's 147 isolated hard words (names, sj/tj sounds) Birgitta is closer to the author's own reading than Kokoro-SV Ebba (word DTW 0.160 vs 0.180, lower is better). Noise between runs is about ±0.5 pp, so differences under ~1 pp are not reliable.
Known weaknesses: the melody is flatter than natural speech (pitch spread 2.3 vs about 3.6 semitones for a human reader, no word accent 2); fully English sentences are weaker than Swedish; unusual names may be mispronounced (fix them in the lexicon).
Speed (this CPU, ~25 s of text, best of 3; RTFx = times faster than real time)
| Variant | MB | 4 threads | 1 thread |
|---|---|---|---|
| fp32 | 67 | 49x | 16x |
| int8 | 20 | 81x | 34x |
| int8pc | 20 | 80x | 34x |
| pcdec | 23 | 56x | 19x |
(Measured on one Apple-silicon laptop with ONNX Runtime 1.31. Your numbers will differ. fp16 ONNX did not load on the CPU provider.) pcdec costs ~30 % speed versus int8 and buys back the quality the int8 decoder loses, mainly on English sentences.
Use
Quick start: copy 1-space/ (the Space) which contains the text front end, or:
pip install onnxruntime numpy num2words soundfile piper-tts==1.8.0 # piper-tts = espeak-ng phonemiser (GPL-3)
import os, sys
for k, v in (("PLADDRA_ENMAP", "0"), ("PLADDRA_AUTOFIX2", "1"), ("PLADDRA_GEM", "1"), ("PLADDRA_TJ", "1"), ("PLADDRA_WSPFIX", "1")):
os.environ.setdefault(k, v)
sys.path.insert(0, "src") # from the Space folder
from pladdra_speech.tts import Voice
import soundfile as sf
voice = Voice("models/birgitta-v24-pcdec.onnx", speaker_id=12, noise_scale=0.1, length_scale=1.15, noise_w=0.2)
sf.write("out.wav", voice.synthesize("Hej! Jag heter Birgitta."), voice.sample_rate)
Recommended settings: noise_scale 0.1, noise_w 0.2, length_scale 1.15 (slower than the default 1.0). They came from blind tests: the flat setting won over more variation. Higher noise_scale (0.5) gives livelier but less stable speech.
The text goes through normalize.py (numbers, units, abbreviations, maths) and an espeak-ng Swedish phonemiser with several correction layers (lexicon/). English words are detected and phonemised as English; or mark them yourself: Vi har ett [meeting] i dag.
Fixing a word
Add word<TAB>IPA to lexicon/user-fix.tsv (later files override: wsp-fix.tsv, name-approved.tsv). The IPA symbols must exist in phoneme_id_map of the config. Use ː repeated for longer vowels (ˈuːːr), ˈ/ˌ for stress.
How it was trained
Sequence-level distillation into a small VITS model, in four steps.
- Base: KB-Lab's Swedish Piper model (
kb-st-24000, CC0) as warm start. - Teachers: (a) Kokoro-SV (Apache-2.0, trained on CC0 data) for broad Swedish, hard names and English words, 12 voices; (b) Audio8-TTS-Realistic (Apache-2.0) cloning the Birgitta voice (speaker "A8", plus a livelier twin "A8L"). The student sees only audio, never the teachers' weights.
- Data: LLM-written Swedish sentences (several 10 000s) plus targeted waves of names, place names, loanwords, sj/tj words and English inserts. Every clip is transcribed by KB-Whisper-large and dropped if the word error is too high. The Audio8 part of the final mix is ≈140 h (A8/A8L clips); about 20 000 Kokoro Ebba clips are added for pronunciation.
- Training: plain VITS training from the warm start with the teacher mix; the last stage fine-tunes only the text encoder and duration predictor for 6 000 steps (
--train-only enc_p,dp, decoder frozen). Weights are averaged across checkpoints (avguw). Quantisation is post-training int8 (per channel) with the decoder left in fp32.
What did not help (so you can skip it): more Audio8 waves of the same kind (a plateau since v14, differences within noise); fine-tuning the flow or adding accent-shaped data to raise the pitch spread; mixing the livelier speaker into the normal one; ZONOS3, voice-conversion ideas were not pursued.
Train further
Environment: Python 3.12, PyTorch, Lightning and the Piper training package (piper.train.vits). See training/.
# 1. data: wavs (22.05 kHz) + train.csv rows: file.wav|speaker|text|phoneme_ids (build_mix.py shows how; phoneme ids come from pladdra_speech.phonemes.ids)
# 2. continue from the released checkpoint or from your own averaged one
python training/train.py --data data/my-mix --output runs/my-run --ids --speakers 14 \
--warm path/to/checkpoint.ckpt --train-only enc_p,dp --steps 6000 --batch-size 16 \
--lr 5e-5 --lr-d 1e-5 --decay 0.95 --checkpoint-every 3000
# 3. export (training/export.py) and quantise (training/quantize_mixed.py <onnx> pcdec dec.)
--train-only enc_p,dp freezes the rest of the generator (the discriminator keeps training); it is the cheapest way to fix pronunciation without disturbing the voice. training/pipeline_a8z.sh is the full recipe of the released model with its data paths; the audio data itself is not included. The training checkpoint is in checkpoint/birgitta-v24.ckpt (288 MB; weights only, generator and discriminator, 804 tensors, no optimizer state). Pass it as --warm; start-up was tested (warm start: 804/804 tensors). It uses the Piper/KB architecture (192 hidden, 6 layers, 768 filter, 256 decoder channels, 14 speakers, speaker id 12 = Birgitta).
Improving the model / Förbättra modellen
Birgitta is a 17 M-parameter student distilled from teachers, and it shows in two places: the melody is flatter than a human reader (pitch spread 2.3 vs ~3.6 semitones, no word accent 2), and unusual words are only as good as the lexicon and rules behind them. Two things would move it the most:
1. Train on natural, own-recorded speech. Record one speaker reading roughly 30 hours of varied Swedish (ideally with some spontaneous speech mixed in), with consistent mic and room and a transcript per clip, then train or fine-tune on that. This fixes prosody at the root instead of patching the output of a flat teacher — it is the only route to real word accents and a natural pitch range. The recipe in training/ applies as-is; start from the released checkpoint (--warm) rather than from scratch. It needs the speaker's written consent, and the voice rights must be as clear as they are for the current voice.
2. Work through pronunciation systematically. Most remaining errors are not model errors but data errors: a name that never appeared in training, a loanword whose stress the phonemiser guesses wrong, an sj/tj sound that only one wave of data covered. The fix is bookkeeping — build a curated pronunciation list (names, place names, loanwords, English inserts), review it against recordings by hand, turn the recurring patterns into lexicon entries and rules, and keep a regression set so a fix for one word does not break ten others. The lexicon/ files and the ASR-based word-error harness already support this way of working.
Report a mispronunciation. If a word comes out wrong, fill in the form — it is the fastest way to make the next version better, whether the fix ends up here or in someone else's fork:
https://forms.gle/38go6tVUG6ZsWsZt5
Smaller contributions are welcome too: a word<TAB>IPA line for lexicon/user-fix.tsv as a pull request, or a note about which variant and setting you used. Reports are collected as a list of words plus context, not as audio, so nothing you record or type is published by default.
På svenska
Birgitta är en liten studentmodell (17 M parametrar) distillerad från lärarmodeller, och det märks på två ställen: melodin är plattare än naturligt tal (tonhöjdsspridning 2,3 mot cirka 3,6 semitoner, ingen ordaccent 2), och ovanliga ord blir bara så bra som lexikonet och reglerna bakom dem. Två saker skulle lyfta modellen mest:
1. Träna på naturligt, egeninspelat tal. Spela in en röst som läser cirka 30 timmar varierad svenska (gärna med en del spontantal också), med samma mikrofon och rum och en transkription per klipp, och träna eller finjustera på det. Det åtgärdar prosodin vid roten i stället för att lappa ihop en platt lärarmodells utdata — det är enda vägen till riktiga ordaccenter och ett naturligt tonhöjdsomfång. Receptet i training/ fungerar som det är; utgå från den släppta checkpoints-filen (--warm) i stället för att börja om från noll. Det kräver skriftligt samtycke från talaren, och rättigheterna till rösten måste vara lika tydliga som för den nuvarande rösten.
2. Arbeta igenom uttalet systematiskt. De flesta kvarvarande felen är inte modellfel utan datafel: ett namn som aldrig funnits i träningsdatan, ett lånord där fonemiseringen gissar fel betoning, ett sj/tj-ljud som bara täckts av en enda datavåg. Lösningen är bokföring — bygg en granskad uttalslista (namn, ortnamn, lånord, engelska inslag), lyssna igenom den mot inspelningar för hand, gör återkommande mönster till lexikonposter och regler, och håll en regressionsmängd så att en fix för ett ord inte förstör tio andra. Filerna i lexicon/ och ASR-baserade ordelfelsmätningen stöder redan det arbetssättet.
Rapportera ett uttalsfel. Om ett ord blir fel, fyll i formuläret — det är det snabbaste sättet att göra nästa version bättre, oavsett om rättningen hamnar här eller i någon annans fork:
https://forms.gle/38go6tVUG6ZsWsZt5
Mindre bidrag uppskattas också: en rad ord<TAB>IPA till lexicon/user-fix.tsv som pull request, eller en kommentar om vilken variant och vilka inställningar du använde. Inskicken samlas som en lista med ord och kontext, inte som ljud, så det du spelar in eller skriver publiceras inte automatiskt.
Licence
This repository (weights, checkpoint, training scripts, lexicons, samples): Apache-2.0 (see LICENSE, attributions in NOTICE). Every upstream part listed below is permissive (CC0 / Apache-2.0), the voice is the author's own, so Apache-2.0 is the most permissive choice that is compatible with all of it: commercial use, modification and redistribution are allowed if you keep the licence and notice, and it carries an explicit patent grant. Not legal advice; the data chain is as stated by the author and not formally audited.
| Part | Licence / status |
|---|---|
| KB Piper base (NST data) | CC0 |
| Kokoro-SV teacher and its data | Apache-2.0 / CC0, attribution needed |
| Audio8-TTS-Realistic teacher | Apache-2.0, attribution needed |
| LLM-written training text (Wikipedia as prompt source) | CC BY-SA source, low risk, not legally reviewed |
| Voice rights | Confirmed by the author (2026-11-18): the reference clip (ref.wav, "clip 02") is the author's own voice. |
| Warm-start chain | The author states Supertonic (OpenRAIL-M) was excluded from the start. The scripts agree: the clean-* line starts from the KB base (kblab/compatible.ckpt) and continues through the Kokoro-SV Ebba runs (ebba2…ebba11) and the Audio8 runs to v24; no Supertonic data in the mixes. Not formally audited. |
Phonemiser: espeak-ng via piper-tts |
GPL-3. It applies to software that includes or links it, not to the ONNX weights or the audio they produce. Open-source release is fine if the code that ships with it is GPL-3 compatible (the Space code). It only blocks a closed, commercial product that bundles the phonemiser. A replacement (precomputed lexicon plus rules, or a small neural G2P) is needed for that, and for microcontrollers. |
Credits
KB-Lab (Swedish Piper base), Kokoro-SV and Audio8 authors (teachers), Piper/VITS, KB-Whisper, UTMOS.