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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- text-to-speech
|
| 7 |
+
- tts
|
| 8 |
+
- audio-language-model
|
| 9 |
+
- voice-cloning
|
| 10 |
+
- zero-shot-tts
|
| 11 |
+
- neurovoice
|
| 12 |
+
- qwen2.5
|
| 13 |
+
- mimi-codec
|
| 14 |
+
- pytorch
|
| 15 |
+
- deep-learning
|
| 16 |
+
datasets:
|
| 17 |
+
- parler-tts/libritts_r_filtered
|
| 18 |
+
pipeline_tag: text-to-speech
|
| 19 |
+
inference: false
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# 🎙️ NeuroVoice-0.5B (v0.1 Alpha)
|
| 23 |
+
|
| 24 |
+
<p align="center">
|
| 25 |
+
<img src="https://img.shields.io/badge/Model-NeuroVoice--0.5B-7928CA?style=for-the-badge&logo=openai" alt="Model">
|
| 26 |
+
<img src="https://img.shields.io/badge/Architecture-Two--Stage%20Audio%20LM-blue?style=for-the-badge" alt="Architecture">
|
| 27 |
+
<img src="https://img.shields.io/badge/Backbone-Qwen2.5--0.5B-green?style=for-the-badge" alt="Backbone">
|
| 28 |
+
<img src="https://img.shields.io/badge/Audio%20Codec-Kyutai%20Mimi%2024kHz-orange?style=for-the-badge" alt="Codec">
|
| 29 |
+
<img src="https://img.shields.io/badge/Hardware-4x%20NVIDIA%20H100-red?style=for-the-badge" alt="Hardware">
|
| 30 |
+
<img src="https://img.shields.io/badge/License-Apache%202.0-yellow?style=for-the-badge" alt="License">
|
| 31 |
+
</p>
|
| 32 |
+
|
| 33 |
+
**NeuroVoice-0.5B (v0.1 Alpha)** is an original, autoregressive **Neural Audio Language Model** built from the ground up for expressive text-to-speech and zero-shot voice cloning. It couples the deep linguistic reasoning of **Qwen2.5-0.5B** with the high-compression **Kyutai Mimi** 24 kHz neural audio codec (12.5 Hz frame rate, 8 codebooks).
|
| 34 |
+
|
| 35 |
+
The model was developed, optimized, and trained on **4x NVIDIA H100 GPUs** (DistributedDataParallel) using PyTorch FlashAttention-2 / SDPA, delivering over **99,800 tokens/sec** training throughput.
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## 🏗️ NeuroVoice Architecture
|
| 40 |
+
|
| 41 |
+
NeuroVoice operates through a **Two-Stage Autoregressive Backbone + Depth Decoder** hierarchy:
|
| 42 |
+
|
| 43 |
+
```
|
| 44 |
+
[Text Prompt + Reference Audio]
|
| 45 |
+
│
|
| 46 |
+
▼
|
| 47 |
+
┌─────────────────────────────────────────────────────────────┐
|
| 48 |
+
│ Stage 1: Main Audio Transformer (Qwen2.5-0.5B Backbone) │
|
| 49 |
+
│ - 24 Transformer Layers (d_model=896, 14 Heads, 2 KV Heads)│
|
| 50 |
+
│ - SwiGLU MLP (d_ff=4864), RoPE, RMSNorm │
|
| 51 |
+
│ - Autoregressively predicts Codebook 0 (Semantic & Pitch) │
|
| 52 |
+
└─────────────────────────────────────────────────────────────┘
|
| 53 |
+
│
|
| 54 |
+
▼ (Audio Hidden States + CB0 Tokens)
|
| 55 |
+
┌─────────────────────────────────────────────────────────────┐
|
| 56 |
+
│ Stage 2: 4-Layer Depth Decoder (Acoustic Hierarchy) │
|
| 57 |
+
│ - Hierarchically generates Codebooks 1..7 │
|
| 58 |
+
│ - Reconstructs high-frequency acoustics & vocal timbre │
|
| 59 |
+
└─────────────────────────────────────────────────────────────┘
|
| 60 |
+
│
|
| 61 |
+
▼ (Full 8-Codebook Matrix @ 12.5 Hz)
|
| 62 |
+
┌─────────────────────────────────────────────────────────────┐
|
| 63 |
+
│ Kyutai Mimi Neural Audio Codec Decoder │
|
| 64 |
+
│ - Synthesizes 24 kHz Hi-Fi Audio Waveform │
|
| 65 |
+
└─────────────────────────────────────────────────────────────┘
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
* **Codec Details:** Kyutai Mimi compresses 24,000 samples/sec audio into **12.5 frames per second** with **8 codebooks** (vocabulary size 2048 per codebook), achieving an extreme 1920x temporal compression.
|
| 69 |
+
* **Stage 1 (Main Backbone):** Autoregressively predicts the speech backbone (Codebook 0).
|
| 70 |
+
* **Stage 2 (Depth Decoder):** Takes backbone hidden representations and CB0 to hierarchically generate the remaining 7 acoustic codebooks (CB1 to CB7) with soft acoustic sampling.
|
| 71 |
+
|
| 72 |
+
---
|
| 73 |
+
|
| 74 |
+
## 🍳 Training Recipe & Hyperparameters
|
| 75 |
+
|
| 76 |
+
Trained on MareNostrum 5 using PyTorch DistributedDataParallel (DDP):
|
| 77 |
+
|
| 78 |
+
| Hyperparameter | Value |
|
| 79 |
+
| :--- | :--- |
|
| 80 |
+
| **Compute Hardware** | 1 Node / 4x NVIDIA H100 (80GB HBM3) |
|
| 81 |
+
| **Dataset** | `parler-tts/libritts_r_filtered` (Clean subset, 21,000 samples, ~35.2 hours) |
|
| 82 |
+
| **Global Batch Size** | 48 (12 per GPU x 4 GPUs) |
|
| 83 |
+
| **Optimizer** | AdamW ($\beta_1=0.9, \beta_2=0.95, \text{weight\_decay}=0.1$) |
|
| 84 |
+
| **Learning Rate** | $2.0 \times 10^{-4}$ (Cosine Annealing schedule) |
|
| 85 |
+
| **Warmup Steps** | 200 steps (Linear warmup from $1.0 \times 10^{-6}$) |
|
| 86 |
+
| **Precision** | `bfloat16` Mixed Precision (`torch.autocast`) |
|
| 87 |
+
| **Attention Kernel** | PyTorch `F.scaled_dot_product_attention` (FlashAttention-2) |
|
| 88 |
+
| **Total Epochs / Steps** | 15 Epochs / 6,555 Steps |
|
| 89 |
+
| **Training Duration** | **23 minutes 52 seconds** |
|
| 90 |
+
| **Peak Throughput** | **~99,800 tokens / second** |
|
| 91 |
+
|
| 92 |
+
### 📉 Loss Trajectory Across Training
|
| 93 |
+
|
| 94 |
+
```
|
| 95 |
+
Step 0000: Total Loss: 25.1857 | CB0 Loss: 17.3926 | Depth Loss: 7.7931
|
| 96 |
+
Step 1000: Total Loss: 3.1959 | CB0 Loss: 0.6863 | Depth Loss: 2.5096
|
| 97 |
+
Step 3000: Total Loss: 2.2011 | CB0 Loss: 0.1136 | Depth Loss: 2.0875
|
| 98 |
+
Step 5000: Total Loss: 1.4281 | CB0 Loss: 0.0029 | Depth Loss: 1.4252
|
| 99 |
+
Step 6555: Total Loss: 1.0407 | CB0 Loss: 0.0034 | Depth Loss: 1.0372 (Best Epoch Avg: 1.1138)
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
## 🚀 Quickstart & Inference
|
| 105 |
+
|
| 106 |
+
### 1. Installation
|
| 107 |
+
|
| 108 |
+
```bash
|
| 109 |
+
pip install torch transformers soundfile torchaudio
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
### 2. Loading with Hugging Face `AutoModel` (Recommended)
|
| 113 |
+
|
| 114 |
+
Thanks to `AutoConfig` and `AutoModel` integration (`trust_remote_code=True`), you can load NeuroVoice directly in Python without cloning the repository:
|
| 115 |
+
|
| 116 |
+
```python
|
| 117 |
+
import torch
|
| 118 |
+
from transformers import AutoConfig, AutoModel
|
| 119 |
+
|
| 120 |
+
repo_id = "TurkishCodeMan/NeuroVoice-0.5B"
|
| 121 |
+
|
| 122 |
+
# 1. Konfigürasyonu ve Modeli Yükle (Safetensors / bfloat16)
|
| 123 |
+
config = AutoConfig.from_pretrained(repo_id, trust_remote_code=True)
|
| 124 |
+
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True)
|
| 125 |
+
model = model.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 126 |
+
model.eval()
|
| 127 |
+
|
| 128 |
+
print(f"✅ {config.model_name} başarıyla yüklendi!")
|
| 129 |
+
print(f"Parametre Sayısı: {sum(p.numel() for p in model.parameters()) / 1e6:.2f}M")
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
---
|
| 133 |
+
|
| 134 |
+
### 3. Standalone CLI Inference (Cloned Repository)
|
| 135 |
+
|
| 136 |
+
You can also clone the repository and use the built-in `inference.py` script:
|
| 137 |
+
|
| 138 |
+
```bash
|
| 139 |
+
git clone https://huggingface.co/TurkishCodeMan/NeuroVoice-0.5B
|
| 140 |
+
cd NeuroVoice-0.5B
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
#### A. Standard Text-to-Speech
|
| 144 |
+
```bash
|
| 145 |
+
python inference.py \
|
| 146 |
+
--use_qwen_backbone \
|
| 147 |
+
--checkpoint model.pt \
|
| 148 |
+
--text "Artificial intelligence is creating the future of speech synthesis." \
|
| 149 |
+
--output output_tts.wav \
|
| 150 |
+
--temperature 0.6 \
|
| 151 |
+
--depth_temperature 0.6 \
|
| 152 |
+
--max_tokens 80
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
#### B. Zero-Shot Voice Cloning
|
| 156 |
+
Use a 3 to 4-second clean audio sample (`.wav`) as reference:
|
| 157 |
+
|
| 158 |
+
```bash
|
| 159 |
+
python inference.py \
|
| 160 |
+
--use_qwen_backbone \
|
| 161 |
+
--checkpoint model.pt \
|
| 162 |
+
--ref_audio reference_voice.wav \
|
| 163 |
+
--ref_max_sec 3.5 \
|
| 164 |
+
--text "Hello! This speech is synthesized using the NeuroVoice neural audio model." \
|
| 165 |
+
--output output_cloned.wav \
|
| 166 |
+
--temperature 0.5 \
|
| 167 |
+
--depth_temperature 0.5 \
|
| 168 |
+
--max_tokens 80
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
## 🔬 Dataset Analysis & Limitations
|
| 174 |
+
|
| 175 |
+
The v0.1 model was trained on **35.17 hours** of speech from the LibriTTS filtered clean subset:
|
| 176 |
+
* **Total Samples:** 21,000 audio-text pairs
|
| 177 |
+
* **Average Sentence Duration:** 6.03 seconds (18 words, ~4.2 codec frames per word)
|
| 178 |
+
* **Reference Audio Range in Training:** 2.0s to 4.0s (Average 3.71s)
|
| 179 |
+
|
| 180 |
+
### ⚠️ Known Limitations in v0.1 Alpha:
|
| 181 |
+
1. **Audiobook Monotony:** LibriTTS is narrated audiobook data; speech has a formal, studio-reader cadence rather than conversational prosody.
|
| 182 |
+
2. **Optimal Reference Audio:** The model was trained with 2-4 second reference clips. Use `--ref_max_sec 3.5` for optimal voice cloning quality.
|
| 183 |
+
3. **Acoustic Timbre:** Depth Decoder loss converged to ~1.0, which produces intelligible speech with a slightly synthetic timbre. Scaling up to larger multi-speaker datasets in v0.2 will address this.
|
| 184 |
+
|
| 185 |
+
---
|
| 186 |
+
|
| 187 |
+
## 🗺️ Roadmap (v0.2 & Beyond)
|
| 188 |
+
|
| 189 |
+
- [ ] **Scale Training Data:** Expand from 35 hours to 500+ hours with diverse conversational audio.
|
| 190 |
+
- [ ] **Enhanced Depth Decoder:** Increase Depth Decoder capacity from 4 to 8 layers for warmer human timbre.
|
| 191 |
+
- [ ] **Multilingual NeuroVoice:** Extend tokenization to Turkish and multilingual speech.
|
| 192 |
+
|
| 193 |
+
---
|
| 194 |
+
|
| 195 |
+
## 📜 Citation & License
|
| 196 |
+
|
| 197 |
+
This project is licensed under the **Apache 2.0 License**.
|
| 198 |
+
|
| 199 |
+
```bibtex
|
| 200 |
+
@misc{neurovoice-0.5b-2026,
|
| 201 |
+
author = {TurkishCodeMan},
|
| 202 |
+
title = {NeuroVoice-0.5B: An Autoregressive Neural Audio Language Model},
|
| 203 |
+
year = {2026},
|
| 204 |
+
publisher = {Hugging Face},
|
| 205 |
+
howpublished = {\url{https://huggingface.co/TurkishCodeMan/NeuroVoice-0.5B}}
|
| 206 |
+
}
|
| 207 |
+
```
|