Skip to main content

MOSS-TTS-Local-Transformer-v1.5 voice cloning via MNN

Project description

moss-tts-local-mnn-cli

MOSS-TTS-Local-Transformer-v1.5 voice cloning via MNN (Mobile Neural Network). Converted from the original PyTorch model (4.13B params, Qwen3 global + GPT2 local transformer).

MNN provides optimized CPU inference on ARM (Apple Silicon, Android) with fp16/int8 quantization support.

Quick Start

uvx moss-tts-local-mnn-cli --text "你好,这是一段测试语音合成。" --reference ref.wav --output output.wav

Installation

uv pip install moss-tts-local-mnn-cli

# For ModelScope download support (China mainland):
pip install "moss-tts-local-mnn-cli[modelscope]"

CLI Usage

# Voice cloning with fp16 (default)
moss-tts-local-mnn-cli --text "你好" --reference speaker.wav --output output.wav

# Use int8 quantization (smaller, faster)
moss-tts-local-mnn-cli --text "你好" --reference speaker.wav --quantization int8 --output output.wav

# Download from ModelScope (China)
moss-tts-local-mnn-cli --text "你好" --reference speaker.wav --source modelscope --output output.wav

Python API

from moss_tts_local_mnn_cli import MossTTS

# Initialize once
tts = MossTTS(quantization="fp16")

# Generate multiple times without reloading
audio = tts.generate("你好,这是第一段。", reference="ref.wav", language="Chinese")
tts.save(audio, "output1.wav")

audio2 = tts.generate("这是第二段。", reference="ref.wav")
tts.save(audio2, "output2.wav")

Audio Codec

The audio codec (MOSS-Audio-Tokenizer-v2) is required for decoding. Download it:

pip install modelscope
python -c "from modelscope import snapshot_download; snapshot_download('OpenMOSS/MOSS-Audio-Tokenizer-v2')"

Model Conversion

Convert ONNX models to MNN:

# Prerequisites: build MNNConvert from https://github.com/alibaba/MNN

# fp16
MNNConvert -f ONNX --modelFile global_prefill.onnx --MNNModel global_prefill_fp16.mnn --fp16 --saveExternalData
MNNConvert -f ONNX --modelFile global_decode.onnx --MNNModel global_decode_fp16.mnn --fp16 --saveExternalData
MNNConvert -f ONNX --modelFile local_transformer_first.onnx --MNNModel local_transformer_first_fp16.mnn --fp16
MNNConvert -f ONNX --modelFile local_transformer.onnx --MNNModel local_transformer_fp16.mnn --fp16

# int8
MNNConvert -f ONNX --modelFile global_prefill.onnx --MNNModel global_prefill_int8.mnn --weightQuantBits 8 --saveExternalData
MNNConvert -f ONNX --modelFile global_decode.onnx --MNNModel global_decode_int8.mnn --weightQuantBits 8 --saveExternalData
MNNConvert -f ONNX --modelFile local_transformer_first.onnx --MNNModel local_transformer_first_int8.mnn --weightQuantBits 8
MNNConvert -f ONNX --modelFile local_transformer.onnx --MNNModel local_transformer_int8.mnn --weightQuantBits 8

Benchmark (Apple M3 Max, 36GB)

Engine ms/step vs PyTorch
PyTorch fp32 338 1.00x
ONNX fp32 374 0.90x
MNN fp16 274 1.24x
MNN int8 277 1.22x

Requirements

  • Python >= 3.10
  • ~20GB RAM (fp16) or ~16GB RAM (int8)
  • ~14GB disk (fp16) or ~11GB disk (int8)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moss_tts_local_mnn_cli-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moss_tts_local_mnn_cli-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file moss_tts_local_mnn_cli-0.1.0.tar.gz.

File metadata

  • Download URL: moss_tts_local_mnn_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for moss_tts_local_mnn_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d61b37a0caeaa744011086ba1013b5a7e1a7fd9d6bdb3888460af128cfeb0a4
MD5 a93da14cfb139a09f6422fe2890d34ea
BLAKE2b-256 730a3bfdc879dafc572bf56d745adceee5cf9a64135a566bea0e8d874f6a9b17

See more details on using hashes here.

File details

Details for the file moss_tts_local_mnn_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: moss_tts_local_mnn_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for moss_tts_local_mnn_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db3bbd7a64a95ff749db6ab63674f97c1ddd61fbe90a8f52c533a00175a31291
MD5 aee7fe95725ae7f34fe1efc01cb84c88
BLAKE2b-256 1bce104e43aa4c2d3f5defa682443ce66d9e36e34aacb756f2cb6d27cba0c0ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page