Órë TTS

Órë TTS is Kokoro-82M with its slow parts replaced by smaller ones distilled from it. It reads the same phonemes with the same voices, in the same nine language settings, and is meant to sound the same while running several times faster and starting without a long compile.

Órë is Quenya for "heart", after the voice it was tuned by ear on, af_heart.

Status: work in progress. v0.2 is the first complete model: the distilled front with a decoder fine-tuned behind it. Nothing here has had a formal listening test, and there has been no adversarial training.

What changed from Kokoro-82M

Kokoro-82M is a StyleTTS 2 model with an iSTFTNet decoder. Three things were replaced, each trained to imitate the original with the rest of the model frozen:

Part Kokoro-82M Órë TTS
Sequence layers six bidirectional LSTMs (10.8M parameters) small ConvNeXt blocks (11.4M)
Pitch and energy predictor normalizes over the whole sentence (instance norm) normalizes each frame on its own (layer norm), so sentences batch by padding
Decoder 53M parameters; upsamples 300-fold through convolutions at up to 4,800 frames per second 19.5M (or 12.3M) parameters of ConvNeXt blocks at 80 frames per second, then one inverse STFT

Everything else is Kokoro-82M's and is not in this repository: ALBERT, the text encoder's convolutions, the duration predictor's other layers, and the voice packs. Load them from hexgrad/Kokoro-82M.

The decoder

It is a Vocos-style decoder with three changes that mattered:

  • Three short spectra per frame. Each 12.5 ms frame's output is three spectra of 16.7 ms windows (n_fft 400, hop 100) instead of one of a 50 ms window. Over 50 ms a voice's pitch moves enough to make the upper harmonics' phase hard to predict.
  • A hybrid head. The output spectrum is the network's own plus two filtered sources: Kokoro's harmonic source (the sines at the pitch and eight overtones, plus noise) and a source with every harmonic up to 11.5 kHz, in phase with it. The network predicts a gain and a phase shift per frequency bin for each.
  • Phase losses. The student is given the exact harmonic source and noise the teacher used, so the teacher's waveform is one definite target, and the loss can compare phase as well as magnitude: mel at seven resolutions, a multi-resolution STFT loss, a phase loss on unit phasors (the phase and its steps across frequency and time) and an L1 loss on compressed complex spectra.

No adversarial training was used.

Versions

Each release is a git tag on this repository; pin one with revision=, for example hf_hub_download("brendanlong/ore-tts", "decoder/original-front-512.pt", revision="v0.1"). main moves as new checkpoints are added.

Tag What it holds
v0.2 Adds decoder/distilled-front-{512,384}.pt: the decoders fine-tuned behind the distilled front. With the front/ files this is the full model.
v0.1 The multilingual front, and decoders trained on the original Kokoro-82M's decoder inputs (not yet fine-tuned behind the distilled front).

Files

Torch checkpoints; load with torch.load(path, weights_only=True).

File What it is
front/lstm-replacements.pt The six LSTM replacements, trained on multilingual text.
front/pitch-energy-predictor.pt The per-frame pitch and energy predictor, multilingual. The file also holds an unused decoder from an earlier experiment (decoder.* keys); ignore it.
decoder/distilled-front-512.pt The decoder to use with the front/ files (width 512, 19.5M parameters): original-front-512.pt fine-tuned on the distilled front's decoder inputs.
decoder/distilled-front-384.pt The same at width 384 (12.3M parameters).
decoder/original-front-512.pt The decoder (width 512, 19.5M parameters), trained on the original Kokoro-82M's decoder inputs. It replaces only Kokoro's decoder: the rest of the model can be the unmodified original.
decoder/original-front-384.pt The same at width 384 (12.3M parameters).

The code that defines and runs these is in brendanlong/kokoro (branch brendanlong/vocos-review, experiments/vocos/model.py, experiments/lstm_swap, experiments/batch_first), and a serving worker is being built in brendanlong/optimized-kokoro. There is no pip-installable package yet.

Training data

All training audio was generated by Kokoro-82M itself; no recordings of people were used.

  • Text: sentences from public-domain English novels (Project Gutenberg) and paragraphs of Wikipedia (dump of 2023-11-01) in English, Spanish, French, Hindi, Italian, Japanese, Portuguese and Chinese, turned into phonemes by optimized-kokoro's text pipeline.
  • The distilled-front decoders: fine-tuned from the original-front ones for 100,000 steps on 78 hours of audio from Kokoro-82M's decoder behind the distilled front, same text sources.
  • The original-front decoders: 50 hours (nominal) of Kokoro-82M's audio with its decoder inputs, in all nine language settings (American and British English count separately), each passage read by a random voice of its language, 150,000 steps.

Measurements

Each decoder against Kokoro-82M's own decoder on the same inputs, 180 held-out passages (20 per language setting). Lower is better except voiced/unvoiced agreement. Random phase scores about 1.27 on the phase error. "Distilled front" is the full model; "original front" replaces only the decoder of an otherwise unmodified Kokoro-82M.

Measure Distilled front, 512 Distilled front, 384 Original front, 512 Original front, 384
Mel error, seven resolutions (log10) 0.215 0.221 0.214 0.219
Multi-resolution STFT error 0.800 0.798 0.804 0.809
Phase error 0.536 0.550 0.546 0.561
Loudness error per frame 1.09 dB 1.12 dB 0.92 dB 0.94 dB
Periodicity error (CREPE) 0.110 0.120 0.119 0.120
Voiced/unvoiced agreement (F1) 0.946 0.939 0.941 0.941

By language (distilled front, width 512) the mel error runs from 0.19 (Japanese) to 0.23 (Spanish and Portuguese); periodicity error is worst for Chinese (0.149) and Hindi (0.135).

The multilingual front against the original Kokoro-82M, 25 passages per language: speech length within 1% in every language, duration error 0.10 to 0.25 frames per phoneme, pitch error 8 to 15 Hz (11 to 21 Hz with the per-frame predictor). Japanese is the weakest.

Speed, decoder only, on 4 CPU threads without compiling: about 11 ms per second of audio at width 512, against about 234 ms for Kokoro-82M's decoder. In a serving worker on an RTX 3060 Ti, the full distilled model ran at about 570 times real time under load uncompiled, against about 220 for Kokoro-82M compiled, with a cold start of about a minute instead of about ten.

Limitations

  • It imitates Kokoro-82M and inherits its limits; it does not try to beat it.
  • The decoder's phase is still measurably different from the teacher's, and its noise is smoother than the teacher's. By ear, on one listener, the result was "mostly indistinguishable"; that is not a listening test.
  • The original-front decoders are slightly worse behind the distilled front than the distilled-front ones (mel error 0.230 against 0.215 at width 512); use the matching pair.
  • Quality outside English has been measured but only lightly listened to.

License and credit

Apache-2.0, as Kokoro-82M is. Órë TTS is a derivative of Kokoro-82M by hexgrad, which builds on StyleTTS 2 (Li et al.) and iSTFTNet. The decoder follows Vocos (Siuzdak); the phase losses follow APNet2. Paradee, an earlier distillation of Kokoro-82M, informed the approach.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for brendanlong/ore-tts

Finetuned
(102)
this model

Papers for brendanlong/ore-tts