An ExecuTorch 1.5.1 export of hexgrad/Kokoro-82M
(revision f3ff357) for XNNPACK, the CPU backend. For everything about the model itself,
see the original model card. This card only
covers the export.
| file | weights | size |
|---|---|---|
xnnpack_fp32/kokoro.pte |
fp32 | 325 MB |
voices/*.bin |
the 28 English voices (af_, am_, bf_, bm_) |
15 MB |
One program with two methods. The phoneme axis and the frame axis are both dynamic, and nothing is padded: Kokoro's bidirectional LSTMs and its instance norms over time both change their output under padding.
predict(input_ids [1,N] int64, ref_s [1,256], speed [1])
-> d [1,N,640], t_en [1,512,N], duration [N] int64
vocode(d, t_en, aln [1,N,F], ref_s, rand_ini [1,9], sine_noise [1,9,600F])
-> waveform [600F], float32 at 24 kHz
Text to phonemes, outside the program. Use misaki,
or espeak-ng, then map the phonemes through config.json's vocabulary, dropping any
character it does not have, and wrap the ids in 0: [0, *ids, 0]. Up to 512 ids.
Pick the style row. voices/<name>.bin is little-endian float32 [510, 256]. The row is
len(phonemes) - 1, counted on the phoneme string, as upstream does.
Run predict.
Build the alignment. aln[n, f] = 1 where frame f falls within phoneme n's
duration, starting at the cumulative sum of the earlier durations. There are exactly
F = sum(duration) frames, at most 2400. This is why there are two methods: the
vocoder's input size is the predictor's output.
Run vocode with noise you supply.
rand_ini is uniform in [0, 1).sine_noise is standard normal.Upstream draws both inside the model. To reproduce it exactly, draw
torch.rand(1, 9), then
torch.empty_strided((1, 600F, 9), (5400F, 1, 600F)).normal_().transpose(1, 2).
get_sample_rate, get_samples_per_frame, get_max_phonemes, get_max_frames and
get_style_dim are constant methods.
All of these are numerically equivalent to upstream:
scan loops, both directions in one loop, so their
length stays dynamic. nn.LSTM exports with its length pinned.vocode is partitioned without XNNPACK's PermuteConfig. A permute that
feeds two consumers produces a partition XNNPACK rejects.metadata.json records the export, including what XNNPACK delegated. ops.txt lists
the portable kernels a selective ExecuTorch build needs. export/ holds the scripts.
The program was compared with eager PyTorch on 10 held-out English sentences, in af_heart
and bm_george, using the same noise:
Apache-2.0, as Kokoro-82M (see LICENSE). The program and voice files are
converted from hexgrad's Kokoro-82M weights and voice packs.
voices/af_alloy.bin 522.2 kBvoices/af_aoede.bin 522.2 kBvoices/af_bella.bin 522.2 kBvoices/af_heart.bin 522.2 kBvoices/af_jessica.bin 522.2 kBvoices/af_kore.bin 522.2 kBvoices/af_nicole.bin 522.2 kBvoices/af_nova.bin 522.2 kBvoices/af_river.bin 522.2 kBvoices/af_sarah.bin 522.2 kBvoices/af_sky.bin 522.2 kBvoices/am_adam.bin 522.2 kBvoices/am_echo.bin 522.2 kBvoices/am_eric.bin 522.2 kBvoices/am_fenrir.bin 522.2 kBvoices/am_liam.bin 522.2 kBvoices/am_michael.bin 522.2 kBvoices/am_onyx.bin 522.2 kBvoices/am_puck.bin 522.2 kBvoices/am_santa.bin 522.2 kBvoices/bf_alice.bin 522.2 kBvoices/bf_emma.bin 522.2 kBvoices/bf_isabella.bin 522.2 kBvoices/bf_lily.bin 522.2 kBvoices/bm_daniel.bin 522.2 kBvoices/bm_fable.bin 522.2 kBvoices/bm_george.bin 522.2 kBvoices/bm_lewis.bin 522.2 kBhexgrad/Kokoro-82M