Downloads · 30 days
265
14% of all-time downloads
Joakim/kokoro-sv-g2p
kokoro-sv-g2p is a text-to-speech model from Joakim. Use it when you need text read aloud. It is set up for kokoro. The card lists the license as apache-2.0.
A fine-tune of Kokoro-82M (StyleTTS2, 82 M params) that adds a Swedish voice while keeping Kokoro's native languages. Kokoro's KModel is language-blind (it maps IPA → audio), so the same weights serve every language;…
Downloads · 30 days
265
14% of all-time downloads
All-time downloads
1.9K
Public
Repo size
1 GB
Likes
3
Public
Click a slice to open those files.
.pth327 MB · 46%
From the Hugging Face model README
A fine-tune of Kokoro-82M (StyleTTS2,
82 M params) that adds a Swedish voice while keeping Kokoro's native languages.
Kokoro's KModel is language-blind (it maps IPA → audio), so the same weights
serve every language; the language lives in the G2P front-end you feed it.
sv_female) trained via TTS distillation.| file | what |
|---|---|
kokoro_sv.pth | PyTorch weights (5 inference modules), best checkpoint (pre-adversarial) |
kokoro_sv.onnx | ONNX export (fp32) for torch-free / CPU / edge inference |
sv_female.pt | Swedish voicepack [510, 1, 256] |
config.json | Kokoro config (178-token IPA vocab) |
g2p/g2p_model.pt | neural Swedish G2P model (NST-trained; better loanword/name pronunciation than espeak) |
g2p/lexicon.tsv | NST pronunciation lexicon for the neural G2P |
PyTorch (best on NVIDIA GPU / Apple Silicon) — via the
kokoro_svml.py wrapper from the project repo:
from kokoro_svml import KokoroSVML
tts = KokoroSVML() # auto-downloads these weights
sv = tts.generate("Hej, jag pratar svenska!", lang="sv")
en = tts.generate("And English, from the same model.", lang="en")
import soundfile as sf; sf.write("sv.wav", sv, 24000)
ONNX (torch-free, CPU/edge) — onnxruntime + numpy only:
import json, numpy as np, onnxruntime as ort
from huggingface_hub import hf_hub_download
from misaki import espeak # Swedish G2P (espeak 'sv')
sess = ort.InferenceSession(hf_hub_download("Joakim/swedish-kokoro", "kokoro_sv.onnx"))
voice = ... # load sv_female.pt -> [510,1,256] numpy
vocab = json.load(open(hf_hub_download("Joakim/swedish-kokoro", "config.json")))["vocab"]
ipa, _ = espeak.EspeakG2P(language="sv")("Hej världen!")
ids = [vocab[p] for p in ipa if p in vocab]
audio, pred_dur = sess.run(None, {"input_ids": np.array([[0,*ids,0]], np.int64),
"ref_s": voice[len(ids)-1]})
Output is 24 kHz mono. Trim the EOS tail using pred_dur (see the repo's
trim_eos_tail). For Swedish, set SV_NEURAL_G2P=nst_g2p for the higher-quality
neural G2P (else espeak sv).
language_id="sv") cloning one clean reference clip —
~3.8 h of consistent single-speaker Swedish (TTS distillation).Apache-2.0, inheriting Kokoro-82M. The Swedish reference voice derives from a public-domain LibriVox recording.