--- license: apache-2.0 language: - en pipeline_tag: text-to-speech library_name: executorch base_model: sahilmahendrakar/Paradee-8M-v1.0 tags: - text-to-speech - executorch - xnnpack - react-native-executorch - kokoro --- # Paradee-8M for ExecuTorch [Paradee-8M v1.0](https://huggingface.co/sahilmahendrakar/Paradee-8M-v1.0) exported to ExecuTorch (`.pte`, XNNPACK, fp32), in the two-program shape that [react-native-executorch](https://github.com/software-mansion/react-native-executorch)'s Kokoro text-to-speech pipeline loads. Paradee is [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) distilled to 8 million parameters by Sahil Mahendrakar. It speaks one voice, Kokoro's `af_heart`, in US English at 24 kHz. These files change how the model is packaged, not the model. ## Files | File | Size | What it is | |---|---|---| | `duration_predictor_paradee_xnnpack_fp32.pte` | 9.0 MB | Tokens to durations and features | | `synthesizer_paradee_xnnpack_fp32.pte` | 39.7 MB | Features to audio, with Paradee's phase filter | | `voices/pd_heart.bin` | 1 KB | A row of zeros. The voice is in the weights; the pipeline still asks for a voice file | Both programs carry a `get_model_schema` method, which the pipeline reads for their dynamic shapes: 3 to 128 tokens and 16 to 296 frames (7.4 s of speech) a chunk. ## Use With `react-native-executorch` 0.10, as a Kokoro model with the library's own US English phonemizer: ```ts import { createKokoroTextToSpeech, models } from 'react-native-executorch'; const ROOT = 'https://huggingface.co/dr33m/paradee-8m-executorch/resolve/main'; const tts = await createKokoroTextToSpeech({ name: 'kokoro', modelPaths: { durationPredictor: `${ROOT}/duration_predictor_paradee_xnnpack_fp32.pte`, synthesizer: `${ROOT}/synthesizer_paradee_xnnpack_fp32.pte`, }, phonemizer: models.textToSpeech.KOKORO.EN_US.DEFAULT.phonemizer, voices: { pd_heart: `${ROOT}/voices/pd_heart.bin` }, }); ``` ## How it was made Exported with `executorch==1.4.1` (`torch.export`, then `to_edge_transform_and_lower` with the XNNPACK partitioner), following Software Mansion's [Kokoro export](https://github.com/NorbertKlockiewicz/kokoro-export). Checked against Paradee's own ONNX file on six sentences: the frame counts are identical, and the audio is as close to the reference as two runs of the reference are to each other. Three things differ from the original graph, none of them audible in that check: - The Gaussian noise in the harmonic source is a fixed buffer, so a chunk always comes out the same. - The LSTMs are unrolled and padded to the chunk bounds. - The phase filter's 1024-tap transforms are a matrix product over windows rather than convolutions. As convolutions they made XNNPACK allocate gigabytes on a phone. ## Measured On a Samsung Galaxy A33 (Exynos 1280, sold as 6 GB), in a development build, it makes speech in about half the time the speech lasts, and adds about 370 MB to the app at its peak. ## License and credit Apache 2.0, the same as Paradee and Kokoro. Paradee is by Sahil Mahendrakar ([code](https://github.com/sahilmahendrakar/paradee), [model](https://huggingface.co/sahilmahendrakar/Paradee-8M-v1.0)); Kokoro-82M is by hexgrad.