on-device iOS client · MOSS-TTS-Nano (ONNX for iOS / macOS)

On-device text-to-speech assets derived from OpenMOSS-Team/MOSS-TTS-Nano-100M and OpenMOSS-Team/MOSS-Audio-Tokenizer-Nano.

This repo bundles everything the on-device iOS / macOS client needs to synthesize speech without any server component:

  • Split ONNX graphs (LM + audio decoder) exported with practical fixed shapes (see onnx/onnx_shapes.json).
  • The original SentencePiece tokenizer (tokenizer.model) plus a 1:1 verified fast tokenizer.json for swift-transformers.
  • The upstream config.json, exposing all token IDs and model-side constants used by the prompt builder.

Repo layout

.
├── onnx/
│   ├── moss_tts_nano_lm_fp32.onnx        # ~490 MiB — use on macOS (CoreML EP) / Mac-class iPad
│   ├── moss_tts_nano_lm_fp16.onnx        # ~250 MiB — default for iPhone
│   ├── moss_tts_nano_decode_fp32.onnx    # ~62 MiB
│   ├── moss_tts_nano_decode_fp16.onnx    # ~32 MiB
│   └── onnx_shapes.json                  # prompt_len / frames / sample rate / special tokens
├── tokenizer/
│   ├── tokenizer.json                    # fast tokenizer (BPE + byte fallback) verified 1:1 against SPM
│   ├── tokenizer.model                   # original SentencePiece model
│   ├── tokenizer_config.json
│   └── special_tokens_map.json
└── config/
    └── config.json                       # upstream MOSS-TTS-Nano config

Fixed shapes (baked into the ONNX graphs)

field value meaning
prompt_len 512 Max prompt_input_ids rows (text tokens + MOSS template overhead). Pad/truncate per chunk.
n_vq 16 Number of audio codebooks.
n_vq_plus_one 17 Columns in prompt_input_ids (1 text column + 16 audio codebook columns, all set to audio_pad_token_id at the text-only prompt stage).
max_new_frames 32 Frames the LM can emit per invocation.
max_audio_samples 1,920,000 (≈ 40 s @ 48 kHz) Upper bound on the decoder output length.
sample_rate 48,000 Hz Output WAV sample rate.
channels 2 Stereo output.

Long inputs must be split into prompt-budget-sized chunks in the client (sentence-aware, with a single MOSS prompt overhead per chunk) and the resulting WAV segments concatenated. The on-device iOS package does this via MossTTSNanoTextChunker.

Runtime contract (on-device iOS / macOS client)

  1. Build prompt_input_ids / attention_mask on-device using the fast tokenizer.json (no server roundtrip).
    • See MossTTSNanoPromptBuilder — Swift port of MossTTSNanoForCausalLM.build_inference_input_ids(mode="continuation").
    • Pads / truncates to prompt_len = 512 and fills audio codebook columns with audio_pad_token_id.
  2. Run moss_tts_nano_lm_*.onnx to produce audio_codes of shape [1, max_new_frames, n_vq].
  3. Run moss_tts_nano_decode_*.onnx on a sliding window of frames to obtain raw 48 kHz stereo PCM.
  4. Concatenate segment WAVs for multi-chunk inputs.

Export provenance

Exported via Notebooks/MOSS_TTS_Nano/export_moss_tts_nano_e2e_onnx.py (torchscript backend, opset 17) with:

python export_moss_tts_nano_e2e_onnx.py \
    --mode split \
    --prompt-len 512 \
    --max-new-frames 32 \
    --max-audio-samples 1920000 \
    --write-shapes-json

FP16 graphs produced with onnxconverter_common.float16.convert_float_to_float16(keep_io_types=False).

Token IDs in onnx_shapes.json reflect the upstream config at export time (OpenMOSS-Team/MOSS-TTS-Nano-100M commit 44502f80).

License

Apache-2.0, same as the upstream MOSS-TTS-Nano-100M and MOSS-Audio-Tokenizer-Nano releases.

Acknowledgements

Thanks to the OpenMOSS team for releasing the MOSS-TTS-Nano and MOSS-Audio-Tokenizer-Nano weights under a permissive license that makes on-device deployment feasible.

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 aoiandroid/moss-tts-nano-onnx-fp32

Quantized
(6)
this model

Collection including aoiandroid/moss-tts-nano-onnx-fp32