--- 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." **2.** "The quick brown fox jumps over the lazy dog." **3.** "This tiny model has only ten million parameters, and it was trained from scratch." **4.** "Hello, how are you today?" ## 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 ``. - 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.