Files
speech-nano/README.md
T
2026-06-17 22:07:42 +00:00

260 lines
7.8 KiB
Markdown

---
license: apache-2.0
language:
- en
tags:
- text-to-speech
- tts
- speech-synthesis
- pytorch
- ultra-small
- local-tts
- efficient-inference
- experimental
pipeline_tag: text-to-speech
library_name: pytorch
---
<p align="center">
<img src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/assets/inflect-nano-banner.svg" alt="Inflect-Nano-v1 banner" width="100%">
</p>
# Inflect-Nano-v1
**Inflect-Nano-v1 is a 4.63M-parameter English text-to-speech model, including its neural vocoder.**
It is built around one question: how usable can a complete local TTS stack get when the entire inference model is smaller than many single embeddings tables in modern speech systems?
This is not a SOTA voice model. The point is the size-to-functionality ratio: a complete text-to-waveform TTS pipeline that is small enough for tiny local experiments, offline assistants, embedded prototypes, browser/WASM-style work, and efficient inference research.
<p align="center">
<b>4.632M total params</b> | <b>3.465M acoustic</b> | <b>1.167M vocoder</b> | <b>24 kHz</b> | <b>English</b>
</p>
## Listen First
These examples cover punctuation, short questions, numbers, hard words, longer phrasing, and transition-heavy prompts.
| Prompt | Audio |
|---|---|
| "Did the timing change?" she answered. "Then why did Logan leave?" | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_01.wav"></audio> |
| Who puts a parking meter next to an ER label? | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_02.wav"></audio> |
| Please say neighborhood, statistics, and anesthesiologist clearly, without rushing through the middle syllables. | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_03.wav"></audio> |
| I said 91, not 306, which is a very different number. | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_04.wav"></audio> |
| The inference path looked natural, but the decoder still needed a smoother transition before Marcus approved the final test. | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_05.wav"></audio> |
| The appointment moved to 1:25, the invoice was $674.96, and the archive was labeled 1998. | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_06.wav"></audio> |
| If Logan sounded uneasy, then it happened near Long Beach, and the pause has to carry that. | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_07.wav"></audio> |
| The word aluminum should not steal attention from the softer ending after entrepreneur. | <audio controls preload="none" src="https://huggingface.co/owensong/Inflect-Nano-v1/resolve/main/examples/example_08.wav"></audio> |
## Why This Exists
Most strong TTS models are large. Many "small" TTS demos also depend on a larger external vocoder, which hides a lot of the real inference cost. Inflect-Nano-v1 counts both sides:
```text
text -> acoustic model -> mel spectrogram -> neural vocoder -> waveform
```
The model is intentionally constrained:
| Capability | Inflect-Nano-v1 |
|---|---:|
| Complete text-to-waveform stack | Yes |
| External vocoder required | No |
| Total inference parameters | **4.632M** |
| Sample rate | **24 kHz** |
| Language | English |
| Voice count | 1 |
| Voice cloning | No |
| Multilingual | No |
## Size Context
Approximate parameter comparison:
| Model / class | Params | Relative to Inflect-Nano-v1 |
|---|---:|---:|
| Inflect-Nano-v1 | **4.63M** | 1.0x |
| Kokoro-82M | ~82M | ~17.7x larger |
| Chatterbox-sized TTS | ~500M | ~108x larger |
| Multi-billion TTS systems | 1B+ | 216x+ larger |
The comparison is about model scale, not quality parity. Larger models are expected to sound better.
## Quickstart
```bash
git clone https://huggingface.co/owensong/Inflect-Nano-v1
cd Inflect-Nano-v1
pip install -r requirements.txt
```
Generate audio:
```bash
python inference.py \
--text "Wait, are you actually being for real now? I can't believe it!" \
--out sample.wav
```
CPU:
```bash
python inference.py \
--device cpu \
--text "Please say neighborhood, statistics, and anesthesiologist clearly." \
--out sample_cpu.wav
```
Optional controls:
```bash
python inference.py \
--text "No, seriously, did Jordan leave the receipt in Albuquerque?" \
--length-scale 1.03 \
--pitch-scale 1.00 \
--energy-scale 1.00 \
--out sample_controlled.wav
```
Local Gradio demo:
```bash
python app.py
```
The text frontend may download tokenizer files on first run.
## Model Summary
| Component | Parameters | Notes |
|---|---:|---|
| Acoustic model | **3,465,125** | Compact non-autoregressive FastSpeech-style model |
| Vocoder generator | **1,167,077** | Snake V2Mid HiFi-GAN-style generator |
| Total inference model | **4,632,202** | Acoustic + vocoder |
Model files:
```text
weights/inflect_nano_v1_acoustic.pt
weights/inflect_nano_v1_vocoder.pt
```
## Architecture
Inflect-Nano-v1 is a two-part TTS stack:
```text
Text
-> English normalization + G2P frontend
-> Compact FastSpeech-style acoustic model
-> 80-bin mel spectrogram
-> Snake V2Mid HiFi-GAN-style vocoder
-> 24 kHz waveform
```
### Acoustic Model
The acoustic model predicts duration, energy, brightness, and pitch, expands token states into frame states, and decodes 80-bin mel spectrograms.
Main config:
```json
{
"hidden": 168,
"encoder_layers": 5,
"decoder_layers": 6,
"decoder_ff_mult": 3,
"kernel_size": 7,
"speaker_dim": 64,
"dropout": 0.08,
"n_mels": 80,
"sample_rate": 24000,
"max_frames": 1400,
"postnet_scale": 0.1,
"use_frame_pitch": true,
"abs_frame_bins": 512
}
```
Approximate acoustic split:
```text
total acoustic: 3.465M
encoder: 1.292M
decoder: 1.211M
postnet: 0.276M
local context: 0.226M
frame GRU: 0.128M
heads/embeds/projections: remainder
```
### Vocoder
The vocoder is a custom Snake-activation HiFi-GAN-style generator. Discriminators are training-only and are not included in inference parameter counts.
Main config:
```json
{
"variant": "snake_v2mid",
"sample_rate": 24000,
"n_fft": 1024,
"hop_size": 256,
"win_size": 1024,
"num_mels": 80,
"fmax": 12000.0,
"upsample_rates": [8, 8, 2, 2],
"upsample_kernel_sizes": [16, 16, 4, 4],
"upsample_initial_channel": 144,
"resblock_kernel_sizes": [3, 7, 11],
"resblock_dilation_sizes": [[1, 3, 5], [1, 3, 5], [1, 3, 5]],
"activation": "snake"
}
```
## Intended Use
Good fits:
- Tiny local TTS experiments
- Offline assistant prototypes
- Embedded or low-resource speech demos
- Efficient inference research
- Browser/WASM-style exploration
- Baseline for sub-5M TTS work
Poor fits:
- Production narration
- Accessibility-critical output
- Voice cloning
- Multilingual TTS
- High-fidelity studio speech
- Long-form audiobook generation
## Limitations
This model is intentionally tiny and has clear quality limits:
- Unseen text can stumble or sound unstable.
- The voice can sound robotic, buzzy, or artifacted.
- Long or unusual prompts are less reliable.
- The vocoder is a major quality bottleneck.
- It is not a voice cloning model.
- It is not multilingual.
- It is not suitable for safety-critical or production accessibility use.
## Recommended Framing
Use this as:
> An experimental 4.63M-parameter English TTS model exploring the quality/size tradeoff for ultra-small local speech synthesis.
Do not present it as SOTA or production-quality.
## License
Apache-2.0.
This repository includes a small third-party English text frontend derived from TinyTTS-style code for tokenization/G2P compatibility. Its license is included as `TINY_TTS_LICENSE`.