Skip to content

trial(tts/moss-tts-nano): MOSS-TTS-Nano-100M + Audio-Tokenizer-Nano to CoreML - #92

Open
Alex-Wengg wants to merge 2 commits into
mainfrom
feat/moss-tts-nano-coreml
Open

trial(tts/moss-tts-nano): MOSS-TTS-Nano-100M + Audio-Tokenizer-Nano to CoreML#92
Alex-Wengg wants to merge 2 commits into
mainfrom
feat/moss-tts-nano-coreml

Conversation

@Alex-Wengg

Copy link
Copy Markdown
Member

Summary

CoreML conversion of OpenMOSS-Team/MOSS-TTS-Nano-100M (0.1B multilingual streaming TTS with zero-shot voice cloning, 20 languages, 48 kHz stereo) and its codec MOSS-Audio-Tokenizer-Nano (22M). Apache-2.0 upstream.

Six mlpackages, all macOS 14 / iOS 17 (no StateType):

  • Prefill-T512-M1024, Step-M1024 — GPT-2 12L/768d global LM, pass-through KV [12,1,12,1024,64]
  • Frame — fused 1-layer local transformer (17 unrolled passes) + 16 codebook heads, with top-k / top-p / temperature / repetition-penalty sampling in-graph from host uniforms (inverse-CDF), greedy flag
  • CodecStep — streaming per-frame decoder, shift-window KV caches (500/800/1200/1600), constant relative-RoPE tables, no runtime trig
  • CodecDecoder — flexible-length batch decoder (≤125 frames)
  • CodecEncoder (fp32) — voice-prompt encoder; fp16 loses 34 % of codes through the residual LFQ

Validation

  • Wrappers vs upstream fp32: 1e-5 level; codec decoder SNR 234 dB; encoder 1584/1584 codes exact
  • CoreML fp16 greedy replay of the 375-frame PyTorch reference: 370/375 frames token-exact
  • Streaming codec step vs full decode: 78.9 dB (torch), 56.6 dB (CoreML GPU)
  • Parakeet ASR on two English phrases (voice-clone prompt en_2.wav): CoreML 8.3 % WER vs upstream PyTorch 10.1 %
  • Warm latency, M5 Pro: step 7.6 ms + frame 5.3 ms + codec step 5.2 ms per 80 ms frame (~4× RT streaming), prefill 11 ms, fp32 encoder 22 ms for a 7.9 s prompt

Notes

  • HF remote code differs from the GitHub repo: attention masks by input_lengths, apply_rope does 2 / D on a traced size (patched to static D for export). Details in TRIALS.md.
  • Upstream greedy decoding never emits the stop token; sampling is the quality mode, greedy is the parity oracle.
  • Weights go to FluidInference/moss-tts-nano-coreml; Swift backend follows in FluidAudio.

🤖 Generated with Claude Code

https://claude.ai/code/session_018UHoFANi4DcvU6TzyTPnHH

Alex-Wengg and others added 2 commits September 13, 2026 16:38
…o CoreML

Six mlpackages (macOS 14 / iOS 17): Prefill T512/M1024, Step M1024, fused
Frame (17 local-transformer passes + in-graph inverse-CDF sampling), streaming
CodecStep (shift-window KV, constant relative-RoPE tables), full CodecDecoder
(RangeDim <=125 frames) and fp32 CodecEncoder.

Parity: wrapper vs upstream 1e-5 level; fp16 greedy replay 370/375 frames
token-exact over 30 s; codec step 56.6 dB SNR (GPU); encoder exact only in
fp32. Warm latency on M5 Pro: step 7.6 + frame 5.3 + codec step 5.2 ms per
80 ms frame. Parakeet WER on two phrases 8.3 % (CoreML) vs 10.1 % (PyTorch).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UHoFANi4DcvU6TzyTPnHH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant