MiraTTS ONNX INT4
This is an INT4 quantized ONNX version of YatharthS/MiraTTS, optimized for efficient CPU and GPU inference using ONNX Runtime with the GenAI extension.
Key Benefits
- ~2x faster inference compared to FP32 ONNX
- ~15x less memory usage (857MB vs 2.5GB+ for original)
- CPU-friendly: Runs efficiently on CPU without GPU
- Same quality: Negligible quality loss from quantization
Model Details
| Property | Value |
|---|---|
| Original Model | YatharthS/MiraTTS |
| Quantization | INT4 (4-bit weights) |
| Format | ONNX with GenAI extension |
| Size | ~857 MB |
| Sample Rate | 48 kHz |
Usage
Installation
pip install onnxruntime-genai torch soundfile
For GPU support:
pip install onnxruntime-genai-cuda torch soundfile
Python API
from huggingface_hub import snapshot_download
from mira.model import MiraTTS
import soundfile as sf
# Download model
model_path = snapshot_download("uetuluk2/MiraTTS-onnx-int4")
# Load model (use device="cuda" for GPU)
tts = MiraTTS(model_path, device="cpu")
# Encode reference audio for voice cloning
context = tts.encode_audio("reference.wav")
# Generate speech
audio = tts.generate("Hello, this is a test!", context)
# Save output
sf.write("output.wav", audio.cpu().numpy(), 48000)
With the MiraTTS-onnx Repository
git clone https://github.com/uetuluk/MiraTTS-onnx
cd MiraTTS-onnx
pip install -e .
# Download model
huggingface-cli download uetuluk2/MiraTTS-onnx-int4 --local-dir ./models/int4
# Run example
python examples/generate_int4.py --text "Hello world!" --reference your_voice.wav
Performance
Tested on various hardware configurations:
| Device | Generation Speed | Memory |
|---|---|---|
| CPU (Intel i7) | ~0.5x realtime | ~1.5 GB RAM |
| GPU (RTX 3080) | ~10x realtime | ~1 GB VRAM |
Quantization
This model was quantized using onnxruntime-genai with INT4 weight quantization:
python -m onnxruntime_genai.models.builder \
-m YatharthS/MiraTTS \
-e cpu \
-p int4 \
-o ./mira_onnx_int4
License
This model inherits the CC BY-NC-SA 4.0 license from the original MiraTTS model.
Credits
- Original model by YatharthS
- INT4 quantization by uetuluk2
- ONNX conversion code: MiraTTS-onnx
- Downloads last month
- 72
Model tree for uetuluk2/MiraTTS-onnx-int4
Base model
YatharthS/MiraTTS