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.1.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.1-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.1.tar.gz.

File metadata

  • Download URL: moss_tts_local_mnn_cli-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 10743214ae27472e476574c0002b7cc7baad2e4be1734a0ad6be5c660cdeaeb9
MD5 0184d3265df4f18993cbb6e767d5b0f0
BLAKE2b-256 4cbb881715b041e10b627f9625f439086536bf9637eff55861c5c9915c3bf32c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moss_tts_local_mnn_cli-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75cc7052f83c23c69d0e789f71ac5fb020ae401914f643105845790ef6e4f0b9
MD5 aa7977ac34c81ac96c52f8c913dc83d3
BLAKE2b-256 8c5be6b65957218fe7197293941b34bf8282a9514699a753e5b62b2812f25288

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