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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
language:
|
| 4 |
+
- bn
|
| 5 |
+
tags:
|
| 6 |
+
- text-to-speech
|
| 7 |
+
- bangla
|
| 8 |
+
- xtts
|
| 9 |
+
- coqui
|
| 10 |
+
- tts
|
| 11 |
+
- fine-tuned
|
| 12 |
+
- checkpoints
|
| 13 |
+
library_name: coqui
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# XTTS v2 Bangla — Training Checkpoints
|
| 17 |
+
|
| 18 |
+
# **Zero-shot voice cloning — provide just 5 seconds of any speaker's audio and the model will synthesize Bangla speech in that voice. No retraining required.**
|
| 19 |
+
|
| 20 |
+
This repository contains **5 training checkpoints** from the XTTS v2 Bangla fine-tuning run,
|
| 21 |
+
evenly spaced across steps 382,000–406,000.
|
| 22 |
+
|
| 23 |
+
For the **production-ready best model** (step 406,521), see:
|
| 24 |
+
👉 [EMTIAZZ/xtts-bangla-finetuned](https://huggingface.co/EMTIAZZ/xtts-bangla-finetuned)
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
## Checkpoints
|
| 29 |
+
|
| 30 |
+
| File | Step | Notes |
|
| 31 |
+
|------|------|-------|
|
| 32 |
+
| `checkpoint_382000.pth` | 382,000 | Earliest checkpoint in this set |
|
| 33 |
+
| `checkpoint_389000.pth` | 389,000 | |
|
| 34 |
+
| `checkpoint_395000.pth` | 395,000 | |
|
| 35 |
+
| `checkpoint_401000.pth` | 401,000 | |
|
| 36 |
+
| `checkpoint_406000.pth` | 406,000 | Latest regular checkpoint |
|
| 37 |
+
|
| 38 |
+
> These are full model checkpoints ready for inference (GPT + HiFi-GAN + mel stats).
|
| 39 |
+
> Use `checkpoint_406000.pth` for best results, or compare earlier steps to study the training progression.
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## Quick Start
|
| 44 |
+
|
| 45 |
+
### 1. Install dependencies
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
pip install "TTS==0.22.0" "transformers==4.36.0" "tokenizers==0.15.0" soundfile
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
> **Important:** Use these exact versions. Newer transformers versions break XTTS inference.
|
| 52 |
+
|
| 53 |
+
### 2. Run inference
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
python inference.py --text "আমি বাংলায় কথা বলতে পারি।" --checkpoint checkpoint_406000.pth --output output.wav
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
**Clone any voice with just 5 seconds of audio:**
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
python inference.py \
|
| 63 |
+
--text "আমি বাংলায় কথা বলতে পারি।" \
|
| 64 |
+
--checkpoint checkpoint_406000.pth \
|
| 65 |
+
--ref_audio your_speaker.wav \
|
| 66 |
+
--output output.wav
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
> The `--ref_audio` file can be as short as **5 seconds**. The model extracts a speaker
|
| 70 |
+
> embedding from it and generates speech in that voice. WAV or MP3 works.
|
| 71 |
+
|
| 72 |
+
---
|
| 73 |
+
|
| 74 |
+
## Python API
|
| 75 |
+
|
| 76 |
+
```python
|
| 77 |
+
import soundfile as sf
|
| 78 |
+
from huggingface_hub import snapshot_download
|
| 79 |
+
from TTS.tts.configs.xtts_config import XttsConfig
|
| 80 |
+
from TTS.tts.models.xtts import Xtts
|
| 81 |
+
|
| 82 |
+
# Download all files (~26 GB total)
|
| 83 |
+
model_dir = snapshot_download("EMTIAZZ/xtts-bangla-checkpoints")
|
| 84 |
+
|
| 85 |
+
# Choose a checkpoint — use checkpoint_406000.pth for best results
|
| 86 |
+
checkpoint_path = f"{model_dir}/checkpoint_406000.pth"
|
| 87 |
+
|
| 88 |
+
# Load model
|
| 89 |
+
config = XttsConfig()
|
| 90 |
+
config.load_json(f"{model_dir}/config.json")
|
| 91 |
+
model = Xtts.init_from_config(config)
|
| 92 |
+
model.load_checkpoint(
|
| 93 |
+
config,
|
| 94 |
+
checkpoint_dir=model_dir,
|
| 95 |
+
checkpoint_path=checkpoint_path,
|
| 96 |
+
vocab_path=f"{model_dir}/vocab.json",
|
| 97 |
+
use_deepspeed=False,
|
| 98 |
+
eval=True,
|
| 99 |
+
)
|
| 100 |
+
model.cpu() # or model.cuda() on GPU
|
| 101 |
+
|
| 102 |
+
# Speaker conditioning — just 5 seconds of audio is enough
|
| 103 |
+
gpt_cond_latent, speaker_embedding = model.get_conditioning_latents(
|
| 104 |
+
audio_path=f"{model_dir}/reference_audio.wav",
|
| 105 |
+
gpt_cond_len=config.gpt_cond_len,
|
| 106 |
+
max_ref_length=config.max_ref_len,
|
| 107 |
+
sound_norm_refs=config.sound_norm_refs,
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
# Generate speech — use language="en" (NOT "bn")
|
| 111 |
+
outputs = model.inference(
|
| 112 |
+
text="আমি বাংলায় কথা বলতে পারি।",
|
| 113 |
+
language="en",
|
| 114 |
+
gpt_cond_latent=gpt_cond_latent,
|
| 115 |
+
speaker_embedding=speaker_embedding,
|
| 116 |
+
temperature=0.1,
|
| 117 |
+
length_penalty=1.0,
|
| 118 |
+
repetition_penalty=10.0,
|
| 119 |
+
top_k=10,
|
| 120 |
+
top_p=0.3,
|
| 121 |
+
)
|
| 122 |
+
sf.write("output.wav", outputs["wav"], 24000)
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
## Important: Why `language="en"`?
|
| 128 |
+
|
| 129 |
+
This model was fine-tuned using `language="en"` to bypass XTTS's language-specific
|
| 130 |
+
tokenizer preprocessing. The Bangla text is encoded directly as Unicode characters.
|
| 131 |
+
|
| 132 |
+
**Using `language="bn"` will produce garbled/wrong audio.**
|
| 133 |
+
Always use `language="en"` when running inference, even for pure Bangla text.
|
| 134 |
+
|
| 135 |
+
---
|
| 136 |
+
|
| 137 |
+
## Inference Parameters (Production)
|
| 138 |
+
|
| 139 |
+
| Parameter | Value | Notes |
|
| 140 |
+
|-----------|-------|-------|
|
| 141 |
+
| `temperature` | `0.1` | Low = more deterministic |
|
| 142 |
+
| `length_penalty` | `1.0` | Default |
|
| 143 |
+
| `repetition_penalty` | `10.0` | Prevents repetition/loops |
|
| 144 |
+
| `top_k` | `10` | |
|
| 145 |
+
| `top_p` | `0.3` | |
|
| 146 |
+
| `language` | `"en"` | **Required** |
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
## Files
|
| 151 |
+
|
| 152 |
+
| File | Size | Description |
|
| 153 |
+
|------|------|-------------|
|
| 154 |
+
| `checkpoint_382000.pth` | 5.3 GB | Step 382,000 |
|
| 155 |
+
| `checkpoint_389000.pth` | 5.3 GB | Step 389,000 |
|
| 156 |
+
| `checkpoint_395000.pth` | 5.3 GB | Step 395,000 |
|
| 157 |
+
| `checkpoint_401000.pth` | 5.3 GB | Step 401,000 |
|
| 158 |
+
| `checkpoint_406000.pth` | 5.3 GB | Step 406,000 |
|
| 159 |
+
| `config.json` | 5 KB | Model configuration |
|
| 160 |
+
| `vocab.json` | 331 KB | BPE vocabulary (8,565 Bangla tokens) |
|
| 161 |
+
| `reference_audio.wav` | 295 KB | Sample reference speaker audio (Adiba voice) |
|
| 162 |
+
| `inference.py` | — | Ready-to-run inference script |
|
| 163 |
+
|
| 164 |
+
---
|
| 165 |
+
|
| 166 |
+
## Training Details
|
| 167 |
+
|
| 168 |
+
| | |
|
| 169 |
+
|---|---|
|
| 170 |
+
| **Base model** | Coqui XTTS v2 (`tts_models/multilingual/multi-dataset/xtts_v2`) |
|
| 171 |
+
| **Dataset** | ~99K Bangla speech samples |
|
| 172 |
+
| **Training platform** | Modal (H100 GPU) |
|
| 173 |
+
| **Fine-tuning date** | January 2026 |
|
| 174 |
+
| **Vocabulary** | 8,565 BPE tokens (Bangla-extended) |
|
| 175 |
+
| **Output sample rate** | 24,000 Hz |
|
| 176 |
+
|
| 177 |
+
---
|
| 178 |
+
|
| 179 |
+
## Troubleshooting
|
| 180 |
+
|
| 181 |
+
**`ImportError` from transformers / tokenizers mismatch**
|
| 182 |
+
Install exact versions: `pip install "transformers==4.36.0" "tokenizers==0.15.0"`
|
| 183 |
+
|
| 184 |
+
**Audio is garbled or very short**
|
| 185 |
+
Make sure you are using `language="en"`, not `"bn"`.
|
| 186 |
+
|
| 187 |
+
**Slow inference on CPU**
|
| 188 |
+
XTTS has known MPS issues on Apple Silicon. CPU is the safest option.
|
| 189 |
+
On Linux/Windows with NVIDIA GPU, use `model.cuda()` for fast inference.
|
| 190 |
+
|
| 191 |
+
**Out of memory**
|
| 192 |
+
Each checkpoint is ~5.3 GB. On CPU you need ~6 GB RAM. On GPU you need ~6 GB VRAM.
|