File size: 4,433 Bytes
e4a44dd
 
 
 
 
 
 
 
 
85bf6ce
e4a44dd
 
 
 
 
 
85bf6ce
e4a44dd
85bf6ce
e4a44dd
 
 
85bf6ce
 
 
e4a44dd
85bf6ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e4a44dd
 
 
 
 
 
 
85bf6ce
e4a44dd
 
 
 
85bf6ce
e4a44dd
 
 
85bf6ce
e4a44dd
85bf6ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e4a44dd
 
85bf6ce
e4a44dd
85bf6ce
 
 
 
 
e4a44dd
85bf6ce
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
license: mit
language: en
library_name: pytorch
pipeline_tag: text-to-speech
tags:
  - text-to-speech
  - tts
  - tiny
  - from-scratch
  - fastspeech
  - hifi-gan
datasets:
  - keithito/lj_speech
---

# Tiny TTS: a ~9.4M-param acoustic model + 1.7M vocoder, trained from scratch

A small English text-to-speech system trained **entirely from scratch** on LJSpeech (single female speaker, ~24 h). The acoustic model was trained in about 45 minutes on one GPU. It needs no phonemizer and no external aligner.

| Component | Params | Notes |
|---|---|---|
| Acoustic model | 9.36 M | FastSpeech-style, 4+4 FFT blocks, d=256, character input |
| Vocoder | 1.72 M | HiFi-GAN-style generator, fine-tuned on the acoustic model's mels |
| **Total** | **~11.1 M** | |

## Samples

**1.** "Printing, in the only sense with which we are at present concerned, differs from most arts and crafts."

<audio controls preload="none" src="https://huggingface.co/QuillBytes/cyclone-mini/resolve/main/samples/sample_0.wav"></audio>

**2.** "The quick brown fox jumps over the lazy dog."

<audio controls preload="none" src="https://huggingface.co/QuillBytes/cyclone-mini/resolve/main/samples/sample_1.wav"></audio>

**3.** "This tiny model has only ten million parameters, and it was trained from scratch."

<audio controls preload="none" src="https://huggingface.co/QuillBytes/cyclone-mini/resolve/main/samples/sample_2.wav"></audio>

**4.** "Hello, how are you today?"

<audio controls preload="none" src="https://huggingface.co/QuillBytes/cyclone-mini/resolve/main/samples/sample_3.wav"></audio>

## Usage

```python
from huggingface_hub import snapshot_download
import sys, soundfile as sf

d = snapshot_download("QuillBytes/cyclone-mini")
sys.path.insert(0, d)
from inference import TinyTTSPipeline

tts = TinyTTSPipeline(d)                  # vocoder="original" loads vocoder_original.safetensors
wav = tts("Hello, how are you today?")    # float32 numpy array, 22.05 kHz
sf.write("out.wav", wav, tts.sr)
```

Or from the command line:

```bash
python inference.py "Hello there." out.wav
```

Requirements: `torch numpy safetensors soundfile huggingface_hub`. It runs on CPU or GPU.

## How it works

- **Acoustic model:** a non-autoregressive, FastSpeech-style transformer. Text goes through an encoder, a duration predictor sets how many frames each token gets, a length regulator expands the sequence, and a decoder predicts an 80-bin log-mel spectrogram.
- **Alignment:** durations come from a jointly trained convolutional aligner (forward-sum loss plus monotonic alignment search), so no MFA or phonemizer is needed. The aligner is only used during training and is not included in the released weights.
- **Input:** lowercase characters with blank tokens interspersed between them.
- **Vocoder:** a HiFi-GAN-style generator (256x upsampling) trained with multi-period and multi-scale discriminators, then fine-tuned on the acoustic model's own teacher-forced mels.

## Files

| File | Description |
|---|---|
| `tts.safetensors` | Acoustic model weights (EMA) |
| `vocoder.safetensors` | Vocoder weights (default) |
| `vocoder_original.safetensors` | Vocoder trained on real mels only, without the fine-tune |
| `config.json` | Audio settings, symbol table, model sizes, duration correction |
| `inference.py` | Standalone inference code with no training dependencies |

## Training

- **Data:** LJSpeech 1.1 (public domain), 13,000 train / 100 val clips.
- **Acoustic model:** 50k steps, AdamW, bf16, EMA 0.999. Losses were L1 mel, duration, forward-sum and binarization.
- **Vocoder:** 40k steps (mel loss first, then GAN), then 15k steps of fine-tuning on predicted mels.
- **Audio:** 22.05 kHz, 80 mel bins, hop 256.

## Limitations

- Single speaker, English only, 22.05 kHz.
- Character-level input with no text normalization. Write numbers and abbreviations out as words ("twenty twenty four", not "2024"). Unknown characters are mapped to `<unk>`.
- Prosody is flat and over-smoothed, and slight artifacts are expected at this size.
- The acoustic model overfit mildly (val mel L1 ~0.33 vs train ~0.25), and the released weights are the final EMA checkpoint, not the best-validation one.
- Predicted durations are systematically ~10% short, so `config.json` stores a global `speed` correction (~0.90) that is applied by default.
- No pitch or energy control.

## License

MIT for the code and weights. LJSpeech is public domain.