Instructions to use sandyz1000/react-native-executorch-pocket-tts with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Pocket-TTS
How to use sandyz1000/react-native-executorch-pocket-tts with Pocket-TTS:
from pocket_tts import TTSModel import scipy.io.wavfile tts_model = TTSModel.load_model("sandyz1000/react-native-executorch-pocket-tts") voice_state = tts_model.get_state_for_audio_prompt( "hf://kyutai/tts-voices/alba-mackenna/casual.wav" ) audio = tts_model.generate_audio(voice_state, "Hello world, this is a test.") # Audio is a 1D torch tensor containing PCM data. scipy.io.wavfile.write("output.wav", tts_model.sample_rate, audio.numpy()) - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -12,25 +12,33 @@ tags:
|
|
| 12 |
An [ExecuTorch](https://pytorch.org/executorch/) (`.pte`) export of
|
| 13 |
[kyutai-labs/pocket-tts](https://github.com/kyutai-labs/pocket-tts) for
|
| 14 |
[react-native-executorch](https://github.com/software-mansion/react-native-executorch)
|
| 15 |
-
(RNE). Independent export, not affiliated with Kyutai or Software Mansion
|
| 16 |
-
and verification writeup in the `pocket-tts-export` project this was built from
|
| 17 |
-
(see its `notes/plan.md` and `notes/phase0-2-findings.md`), not yet published
|
| 18 |
-
publicly.
|
| 19 |
|
| 20 |
pocket-tts is licensed MIT by Kyutai; this repo redistributes derived model weights
|
| 21 |
under the same terms. Voice files are pocket-tts's own predefined voices
|
| 22 |
(`kyutai/tts-voices`) β check that repo for per-voice licensing before redistributing
|
| 23 |
further.
|
| 24 |
|
| 25 |
-
##
|
| 26 |
|
| 27 |
-
These
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
## Layout
|
| 36 |
|
|
@@ -39,8 +47,10 @@ v1/
|
|
| 39 |
text_conditioner.pte 16MB β text tokens -> embeddings (dynamic seq len)
|
| 40 |
flow_lm_prompt_step.pte 264MB β text embeddings -> primed KV cache (dynamic prompt len)
|
| 41 |
flow_lm_decode_step.pte 341MB β one autoregressive decode step (6-layer transformer)
|
| 42 |
-
|
|
|
|
| 43 |
state_manifest.json β exact state tensor shapes + emb_mean/emb_std, for the JS driver
|
|
|
|
| 44 |
voices/
|
| 45 |
alba.safetensors 12MB
|
| 46 |
george.safetensors 12MB
|
|
@@ -48,16 +58,14 @@ v1/
|
|
| 48 |
```
|
| 49 |
|
| 50 |
Voice files are the flow_lm KV cache pre-primed with `get_state_for_audio_prompt`,
|
| 51 |
-
padded to a fixed
|
| 52 |
-
|
| 53 |
-
done). Load, pad to the same capacity used at export time, and feed directly as the
|
| 54 |
-
`flow_lm_decode_step`/`flow_lm_prompt_step` graphs' initial cache state.
|
| 55 |
|
| 56 |
## Consuming these
|
| 57 |
|
| 58 |
`.pte` files here are **not** loadable through RNE's `TextToSpeechModule` β that's
|
| 59 |
hardcoded to Kokoro's graph shape. Load each file through RNE's generic
|
| 60 |
`ExecutorchModule` binding instead and drive the prompt β decode β Mimi loop
|
| 61 |
-
yourself
|
| 62 |
-
|
| 63 |
-
|
|
|
|
| 12 |
An [ExecuTorch](https://pytorch.org/executorch/) (`.pte`) export of
|
| 13 |
[kyutai-labs/pocket-tts](https://github.com/kyutai-labs/pocket-tts) for
|
| 14 |
[react-native-executorch](https://github.com/software-mansion/react-native-executorch)
|
| 15 |
+
(RNE). Independent export, not affiliated with Kyutai or Software Mansion.
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
pocket-tts is licensed MIT by Kyutai; this repo redistributes derived model weights
|
| 18 |
under the same terms. Voice files are pocket-tts's own predefined voices
|
| 19 |
(`kyutai/tts-voices`) β check that repo for per-voice licensing before redistributing
|
| 20 |
further.
|
| 21 |
|
| 22 |
+
## Status: XNNPACK-delegated, verified on-device
|
| 23 |
|
| 24 |
+
These `.pte` files are **XNNPACK-delegated** and verified end-to-end on an iPhone 17
|
| 25 |
+
simulator through RNE's generic `ExecutorchModule` binding (react-native-executorch
|
| 26 |
+
0.9.2, completely stock β no patches, no custom native modules): all three voices
|
| 27 |
+
generate real speech, with the model signaling its own EOS, ~0.33x realtime on the
|
| 28 |
+
simulator. Full pipeline, export scripts and the debugging writeup live in the
|
| 29 |
+
`pocket-tts-export` project this was built from
|
| 30 |
+
(`notes/plan.md`, `notes/phase0-2-findings.md`).
|
| 31 |
+
|
| 32 |
+
Export-side fixes that make the XNNPACK artifacts on-device-safe (see the export
|
| 33 |
+
project's notes for the whole story β the original failure was a broken `.pte`
|
| 34 |
+
serialization plus on-device-only XNNPACK kernel crashes, both fixed in the export):
|
| 35 |
+
- Mimi decode is **two graphs** (`mimi_latent_step` + `mimi_pcm_step`), split at the
|
| 36 |
+
sub-frame/PCM boundary β a single merged graph at this context does not survive a
|
| 37 |
+
fresh-process load.
|
| 38 |
+
- Every `.pte` is smoke-tested in a fresh process before shipping.
|
| 39 |
+
- Small streaming-tail op families (and the SEANet conv stack in `mimi_pcm_step`) are
|
| 40 |
+
kept off the XNNPACK delegate, where RNE's bundled XNNPACK build crashes; the bulk
|
| 41 |
+
linear/matmul work stays delegated.
|
| 42 |
|
| 43 |
## Layout
|
| 44 |
|
|
|
|
| 47 |
text_conditioner.pte 16MB β text tokens -> embeddings (dynamic seq len)
|
| 48 |
flow_lm_prompt_step.pte 264MB β text embeddings -> primed KV cache (dynamic prompt len)
|
| 49 |
flow_lm_decode_step.pte 341MB β one autoregressive decode step (6-layer transformer)
|
| 50 |
+
mimi_latent_step.pte 24MB β latent frame -> 16 decoder sub-frames + state
|
| 51 |
+
mimi_pcm_step.pte 16MB β sub-frames + conv state -> 1920 PCM samples
|
| 52 |
state_manifest.json β exact state tensor shapes + emb_mean/emb_std, for the JS driver
|
| 53 |
+
tokenizer.json β SentencePiece tokenizer (HF format)
|
| 54 |
voices/
|
| 55 |
alba.safetensors 12MB
|
| 56 |
george.safetensors 12MB
|
|
|
|
| 58 |
```
|
| 59 |
|
| 60 |
Voice files are the flow_lm KV cache pre-primed with `get_state_for_audio_prompt`,
|
| 61 |
+
padded to a fixed capacity (unoptimized β much of each file is NaN filler for
|
| 62 |
+
unwritten future slots). Feed them directly as the graphs' initial cache state.
|
|
|
|
|
|
|
| 63 |
|
| 64 |
## Consuming these
|
| 65 |
|
| 66 |
`.pte` files here are **not** loadable through RNE's `TextToSpeechModule` β that's
|
| 67 |
hardcoded to Kokoro's graph shape. Load each file through RNE's generic
|
| 68 |
`ExecutorchModule` binding instead and drive the prompt β decode β Mimi loop
|
| 69 |
+
yourself: text_conditioner β flow_lm_prompt_step (on the voice-primed caches) β
|
| 70 |
+
[flow_lm_decode_step + mimi_latent_step + mimi_pcm_step] per autoregressive step.
|
| 71 |
+
`pocket-tts-export`'s `mobile-demo/App.tsx` is a complete reference implementation.
|