MOSS-TTS-Nano icon indicating copy to clipboard operation
MOSS-TTS-Nano copied to clipboard

Apple Silicon (M2) Benchmark & Optimization Notes — ONNX CPU is ~3-5x faster than PyTorch

Open calpa opened this issue 7 months ago • 2 comments

Thank You!

First of all, huge thanks to the OpenMOSS team for this amazing project! A 0.1B param TTS model that produces quality 48kHz stereo audio and runs on CPU is genuinely impressive. The ONNX version is a game-changer for local deployment.

Setup

  • Machine: Mac mini (M2, 8GB)
  • macOS: Sequoia
  • Python: 3.13 via Homebrew + venv
  • Environment: No conda; installed openfst via Homebrew to build pynini==2.1.7, then WeTextProcessing via pip install --no-deps

Benchmark Results

Short text (~19 chars, 六國論 first sentence)

Method Time
PyTorch CPU fp32 ~19s
PyTorch MPS fp16 ~118s (slower!)
ONNX CPU 2 threads ~3.7s

Long text (~459 chars, 岳陽樓記 full text)

Method Time
PyTorch CPU fp32 ~218s
ONNX CPU 2 threads ~67s

Key Findings

  1. ONNX CPU is the fastest path on Apple Silicon — ~3-5x faster than PyTorch
  2. MPS (Apple GPU) does NOT help — the 0.1B model is too small; data transfer overhead between CPU and GPU dominates
  3. CoreML EP fails — ONNX models use external .data files which are incompatible with CoreMLExecutionProvider
  4. Thread count matters — ONNX with 2 threads is optimal on M2 (4 performance + 4 efficiency cores); more threads cause contention
  5. WeTextProcessing works on Apple Silicon — built pynini==2.1.7 from source after brew install openfst

Minor Issues Found

  • app.py hardcodes device=cpu even when --device auto is passed (ignoring MPS/CUDA)
  • resolve_device() does not check torch.backends.mps — falls through to CPU on Apple Silicon
  • No CoreMLExecutionProvider option in ONNX path
  • Default --cpu-threads 4 may not be optimal for Apple Silicon (2 threads was faster in our tests)

Successful Generations

  • ✅ 六國論 (full text, 655 chars) — male voice clone
  • ✅ 岳陽樓記 (full text, 459 chars) — male voice clone
  • ✅ Web demo (app.py) working with all features

Thanks again for open-sourcing this wonderful project! Looking forward to MOSS-TTS 2.0

calpa avatar May 02 '26 03:05 calpa

Thanks a lot for the detailed optimization notes! The Apple Silicon results are very helpful. Your observation that ONNX Runtime CPU is the best path on M2 is consistent with our expectations for this model size. Thanks again for testing and sharing the setup details.

alpacaking avatar May 07 '26 03:05 alpacaking

Try https://huggingface.co/mlx-community/MOSS-TTS-Nano-100M in MLX-Audio

gaoyang07 avatar May 07 '26 04:05 gaoyang07