🦄 Upload NPU+iGPU kokoro-npu-quantized model
Browse files- README.md +20 -183
- kokoro-npu-fp16.onnx +2 -2
- kokoro-npu-quantized-int8.onnx +2 -2
- voices-v1.0.bin +2 -2
README.md
CHANGED
|
@@ -2,210 +2,47 @@
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
license: apache-2.0
|
| 5 |
-
library_name:
|
| 6 |
tags:
|
| 7 |
-
-
|
| 8 |
- kokoro
|
| 9 |
- npu
|
| 10 |
-
- amd-ryzen-ai
|
| 11 |
- quantized
|
| 12 |
-
- onnx
|
| 13 |
-
- magic-unicorn-tts
|
| 14 |
pipeline_tag: text-to-speech
|
| 15 |
---
|
| 16 |
|
| 17 |
-
#
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
-
-
|
| 27 |
-
-
|
| 28 |
-
- 🎭 **54 Voice Support**: Complete voice library included
|
| 29 |
-
- 🛠️ **Ready-to-Use**: Compatible with Magic Unicorn TTS interface
|
| 30 |
-
|
| 31 |
-
## Model Variants
|
| 32 |
-
|
| 33 |
-
| Model | Precision | Size | NPU Performance | Use Case |
|
| 34 |
-
|-------|-----------|------|----------------|----------|
|
| 35 |
-
| `kokoro-npu-quantized-int8.onnx` | INT8 | 128 MB | RTF 0.213 | Maximum speed with turbo |
|
| 36 |
-
| `kokoro-npu-fp16.onnx` | FP16 | 178 MB | RTF 0.225 | Balanced quality/speed |
|
| 37 |
-
|
| 38 |
-
*RTF = Real-Time Factor (lower is faster)*
|
| 39 |
|
| 40 |
## Hardware Requirements
|
| 41 |
|
| 42 |
-
- **NPU**:
|
| 43 |
-
- **
|
| 44 |
-
- **
|
| 45 |
-
- **OS**: Ubuntu 25.04 with KDE Plasma, Linux kernel 6.14.0+
|
| 46 |
|
| 47 |
## Quick Start
|
| 48 |
|
| 49 |
-
### Using Magic Unicorn TTS (Recommended)
|
| 50 |
-
```bash
|
| 51 |
-
# One-click installation
|
| 52 |
-
curl -fsSL https://raw.githubusercontent.com/Unicorn-Commander/magic-unicorn-tts/main/install.sh | bash
|
| 53 |
-
|
| 54 |
-
# Launch interface
|
| 55 |
-
cd magic-unicorn-tts
|
| 56 |
-
./launch_enhanced.sh
|
| 57 |
-
```
|
| 58 |
-
|
| 59 |
-
### Direct Usage with ONNX Runtime
|
| 60 |
-
```python
|
| 61 |
-
import onnxruntime as ort
|
| 62 |
-
import numpy as np
|
| 63 |
-
|
| 64 |
-
# Load NPU-optimized model
|
| 65 |
-
session = ort.InferenceSession(
|
| 66 |
-
"kokoro-npu-quantized-int8.onnx",
|
| 67 |
-
providers=['VitisAIExecutionProvider', 'CPUExecutionProvider']
|
| 68 |
-
)
|
| 69 |
-
|
| 70 |
-
# Example usage (simplified)
|
| 71 |
-
# For complete integration, see Magic Unicorn TTS repository
|
| 72 |
-
```
|
| 73 |
-
|
| 74 |
-
## Performance Benchmarks
|
| 75 |
-
|
| 76 |
-
Tested on AMD Ryzen 9 8945HS with NPU Phoenix (AIE-ML) in **TURBO MODE** on NucBox K11:
|
| 77 |
-
|
| 78 |
-
| Method | Generation Time | Audio Length | RTF | Speedup |
|
| 79 |
-
|--------|-----------------|--------------|-----|---------|
|
| 80 |
-
| CPU Baseline | 1.395s | 7.34s | 0.190 | 1.0x |
|
| 81 |
-
| **NPU Phoenix Basic** | **1.262s** | 8.22s | **0.153** | **1.11x** |
|
| 82 |
-
| NPU Phoenix MLIR-AIE | 1.532s | 8.22s | 0.186 | 0.91x |
|
| 83 |
-
|
| 84 |
-
## Audio Quality
|
| 85 |
-
|
| 86 |
-
- **Sample Rate**: 24kHz
|
| 87 |
-
- **Format**: 16-bit PCM
|
| 88 |
-
- **Quality**: Identical to original Kokoro TTS
|
| 89 |
-
- **Voices**: All 54 voices fully supported
|
| 90 |
-
|
| 91 |
-
## Files in this Repository
|
| 92 |
-
|
| 93 |
-
- `kokoro-npu-quantized-int8.onnx` - INT8 quantized model (maximum speed)
|
| 94 |
-
- `kokoro-npu-fp16.onnx` - FP16 optimized model (balanced performance)
|
| 95 |
-
- `voices-v1.0.bin` - Voice embeddings for all 54 voices
|
| 96 |
-
|
| 97 |
-
## Usage Examples
|
| 98 |
-
|
| 99 |
-
### Magic Unicorn TTS Integration
|
| 100 |
-
```python
|
| 101 |
-
from huggingface_hub import hf_hub_download
|
| 102 |
-
|
| 103 |
-
# Download models
|
| 104 |
-
int8_model = hf_hub_download(
|
| 105 |
-
repo_id="magicunicorn/kokoro-npu-quantized",
|
| 106 |
-
filename="kokoro-npu-quantized-int8.onnx"
|
| 107 |
-
)
|
| 108 |
-
|
| 109 |
-
voices = hf_hub_download(
|
| 110 |
-
repo_id="magicunicorn/kokoro-npu-quantized",
|
| 111 |
-
filename="voices-v1.0.bin"
|
| 112 |
-
)
|
| 113 |
-
|
| 114 |
-
# Use with Magic Unicorn TTS
|
| 115 |
-
# (See complete examples in Magic Unicorn TTS repository)
|
| 116 |
-
```
|
| 117 |
-
|
| 118 |
-
### Performance Monitoring
|
| 119 |
```python
|
| 120 |
-
import
|
| 121 |
-
|
| 122 |
-
# Time the generation process
|
| 123 |
-
start_time = time.time()
|
| 124 |
-
# ... run TTS inference ...
|
| 125 |
-
generation_time = time.time() - start_time
|
| 126 |
-
|
| 127 |
-
# Calculate Real-Time Factor
|
| 128 |
-
audio_duration = len(audio) / sample_rate
|
| 129 |
-
rtf = generation_time / audio_duration
|
| 130 |
-
|
| 131 |
-
print(f"Real-Time Factor: {rtf:.3f}")
|
| 132 |
-
print(f"Performance: {'Real-time' if rtf < 1.0 else 'Slower than real-time'}")
|
| 133 |
-
```
|
| 134 |
-
|
| 135 |
-
## Technical Details
|
| 136 |
-
|
| 137 |
-
### Quantization Process
|
| 138 |
-
- **Method**: Post-training quantization with calibration dataset
|
| 139 |
-
- **Calibration Data**: 500+ diverse text samples across all voices
|
| 140 |
-
- **Target Hardware**: AMD NPU Phoenix (AIE-ML) architecture
|
| 141 |
-
- **Optimization**: MLIR-AIE kernel compilation
|
| 142 |
-
|
| 143 |
-
### NPU Architecture Support
|
| 144 |
-
- **Phoenix (AIE-ML)**: Primary target, fully optimized on NucBox K11
|
| 145 |
-
- **Strix Point (AIE2)**: Compatible with enhanced performance
|
| 146 |
-
- **Future NPUs**: Forward compatibility planned
|
| 147 |
-
|
| 148 |
-
## Installation & Setup
|
| 149 |
|
| 150 |
-
#
|
| 151 |
-
|
| 152 |
-
# Install complete TTS application with NPU support
|
| 153 |
-
curl -fsSL https://raw.githubusercontent.com/Unicorn-Commander/magic-unicorn-tts/main/install.sh | bash
|
| 154 |
-
```
|
| 155 |
-
|
| 156 |
-
### Manual Model Usage
|
| 157 |
-
```bash
|
| 158 |
-
# Install dependencies
|
| 159 |
-
pip install onnxruntime huggingface_hub
|
| 160 |
|
| 161 |
-
#
|
| 162 |
-
|
| 163 |
-
from huggingface_hub import hf_hub_download
|
| 164 |
-
hf_hub_download('Unicorn-Commander/kokoro-npu-quantized', 'kokoro-npu-quantized-int8.onnx')
|
| 165 |
-
hf_hub_download('Unicorn-Commander/kokoro-npu-quantized', 'voices-v1.0.bin')
|
| 166 |
-
"
|
| 167 |
```
|
| 168 |
|
| 169 |
-
## Related Projects
|
| 170 |
-
|
| 171 |
-
- [Magic Unicorn TTS](https://github.com/Unicorn-Commander/magic-unicorn-tts) - Complete TTS application with web interface
|
| 172 |
-
- [NPU Prebuilds](https://github.com/Unicorn-Commander/npu-prebuilds) - Pre-compiled NPU components
|
| 173 |
-
- [AMD NPU Utils](https://github.com/Unicorn-Commander/amd-npu-utils) - NPU development tools
|
| 174 |
-
|
| 175 |
-
## Citation
|
| 176 |
-
|
| 177 |
-
```bibtex
|
| 178 |
-
@software{magic_unicorn_kokoro_npu,
|
| 179 |
-
title={Kokoro TTS NPU-Optimized Models},
|
| 180 |
-
author={Magic Unicorn Technologies},
|
| 181 |
-
organization={Unicorn Commander},
|
| 182 |
-
year={2025},
|
| 183 |
-
url={https://huggingface.co/Unicorn-Commander/kokoro-npu-quantized},
|
| 184 |
-
note={World's first NPU-accelerated TTS models}
|
| 185 |
-
}
|
| 186 |
-
```
|
| 187 |
-
|
| 188 |
-
## License
|
| 189 |
-
|
| 190 |
-
Based on original Kokoro TTS model with additional NPU optimizations.
|
| 191 |
-
See individual component licenses for specific terms.
|
| 192 |
-
|
| 193 |
-
## Acknowledgments
|
| 194 |
-
|
| 195 |
-
- **Kokoro TTS**: Original high-quality text-to-speech model
|
| 196 |
-
- **AMD**: Ryzen AI NPU platform and development tools
|
| 197 |
-
- **VitisAI**: Quantization and optimization framework
|
| 198 |
-
- **MLIR-AIE**: NPU kernel compilation infrastructure
|
| 199 |
-
|
| 200 |
---
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
<strong>Powered by Magic Unicorn Technologies 🦄</strong><br>
|
| 205 |
-
<em>Where AI meets magic</em>
|
| 206 |
-
</p>
|
| 207 |
-
<p>
|
| 208 |
-
<a href="https://unicorncommander.com">Unicorn Commander</a> •
|
| 209 |
-
<a href="https://magicunicorn.tech">Magic Unicorn Tech</a>
|
| 210 |
-
</p>
|
| 211 |
-
</div>
|
|
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
license: apache-2.0
|
| 5 |
+
library_name: onnx
|
| 6 |
tags:
|
| 7 |
+
- tts
|
| 8 |
- kokoro
|
| 9 |
- npu
|
| 10 |
+
- amd-ryzen-ai
|
| 11 |
- quantized
|
|
|
|
|
|
|
| 12 |
pipeline_tag: text-to-speech
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# 🎵 Kokoro NPU Quantized TTS Models
|
| 16 |
|
| 17 |
+
🎵 NPU-Optimized Text-to-Speech Models
|
| 18 |
|
| 19 |
+
NPU-optimized text-to-speech models for AMD Ryzen AI hardware.
|
| 20 |
|
| 21 |
+
## Models Included
|
| 22 |
|
| 23 |
+
- **kokoro-npu-quantized-int8.onnx** (121.9 MB) - INT8 quantized for NPU
|
| 24 |
+
- **kokoro-npu-fp16.onnx** (169.8 MB) - FP16 for quality
|
| 25 |
+
- **voices-v1.0.bin** (26.9 MB) - Voice embeddings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
## Hardware Requirements
|
| 28 |
|
| 29 |
+
- **NPU**: NPU Phoenix
|
| 30 |
+
- **Memory**: 1GB+ available
|
| 31 |
+
- **Framework**: Unicorn Execution Engine
|
|
|
|
| 32 |
|
| 33 |
## Quick Start
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
```python
|
| 36 |
+
from unicorn_execution_engine import UnicornTTS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
# Initialize NPU-accelerated TTS
|
| 39 |
+
tts = UnicornTTS(model="kokoro-npu-quantized")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
# Generate speech with NPU acceleration
|
| 42 |
+
audio = tts.synthesize("Hello, this is NPU-accelerated speech!")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
```
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
---
|
| 46 |
|
| 47 |
+
*🎵 NPU-Accelerated Text-to-Speech*
|
| 48 |
+
*⚡ Powered by Unicorn Execution Engine*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kokoro-npu-fp16.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1773ebbe4e1ebca782320a6d5e334a03a47a4cd5f0c93283ce4a9e27943dabac
|
| 3 |
+
size 134
|
kokoro-npu-quantized-int8.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e63389b9eaa002fb116f00e5b4d4798ab7d8d7b2edaf6c88b0796096a2d95b8
|
| 3 |
+
size 134
|
voices-v1.0.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c29abef6993ac4cc7a06c64ffdeec944fc4bf29ed2c687f7b7138011b83188bb
|
| 3 |
+
size 133
|