diff --git a/.gitattributes b/.gitattributes index 89e2787..f2e7a7a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ *.pt filter=lfs diff=lfs merge=lfs -text *.wav filter=lfs diff=lfs merge=lfs -text +assets/inflect-nano-banner.png filter=lfs diff=lfs merge=lfs -text tiny_tts/text/cmudict_cache.pickle filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index 71fd678..5b41350 100644 --- a/README.md +++ b/README.md @@ -16,26 +16,27 @@ library_name: pytorch ---
-
+
- 4.632M total params | 3.465M acoustic | 1.167M vocoder | 24 kHz | English -
+- **4.63M parameters total** +- **Includes the vocoder** +- **24 kHz audio** +- **Single English male voice** +- **Runs locally with PyTorch** +- Built for tiny-model experiments, local assistants, embedded demos, and efficient inference research -## Listen First +## Listen -These examples cover punctuation, short questions, numbers, hard words, longer phrasing, and transition-heavy prompts. - -| Prompt | Audio | +| Text | Audio | |---|---| | "Did the timing change?" she answered. "Then why did Logan leave?" | | | Who puts a parking meter next to an ER label? | | @@ -46,41 +47,7 @@ These examples cover punctuation, short questions, numbers, hard words, longer p | If Logan sounded uneasy, then it happened near Long Beach, and the pause has to carry that. | | | The word aluminum should not steal attention from the softer ending after entrepreneur. | | -## 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 +## Install ```bash git clone https://huggingface.co/owensong/Inflect-Nano-v1 @@ -88,28 +55,23 @@ cd Inflect-Nano-v1 pip install -r requirements.txt ``` -Generate audio: +## Generate Speech ```bash -python inference.py \ - --text "Wait, are you actually being for real now? I can't believe it!" \ - --out sample.wav +python inference.py --text "Wait, are you actually being for real now?" --out sample.wav ``` CPU: ```bash -python inference.py \ - --device cpu \ - --text "Please say neighborhood, statistics, and anesthesiologist clearly." \ - --out sample_cpu.wav +python inference.py --device cpu --text "Please say neighborhood clearly." --out sample_cpu.wav ``` -Optional controls: +With simple controls: ```bash python inference.py \ - --text "No, seriously, did Jordan leave the receipt in Albuquerque?" \ + --text "The appointment moved to 1:25." \ --length-scale 1.03 \ --pitch-scale 1.00 \ --energy-scale 1.00 \ @@ -122,138 +84,79 @@ Local Gradio demo: python app.py ``` -The text frontend may download tokenizer files on first run. +## Model Size -## Model Summary +| Part | Parameters | +|---|---:| +| Acoustic model | **3.465M** | +| Vocoder generator | **1.167M** | +| Total inference stack | **4.632M** | -| 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: +The model files are: ```text weights/inflect_nano_v1_acoustic.pt weights/inflect_nano_v1_vocoder.pt ``` +## What Makes It Different + +Many small TTS projects depend on a separate larger vocoder. Inflect-Nano-v1 includes the vocoder in the published inference stack, so the full text-to-waveform path stays under 5M parameters. + +Pipeline: + +```text +text +-> English text frontend +-> compact FastSpeech-style acoustic model +-> 80-bin mel spectrogram +-> small Snake HiFi-GAN-style vocoder +-> 24 kHz waveform +``` + ## Architecture -Inflect-Nano-v1 is a two-part TTS stack: +The acoustic model is a compact non-autoregressive FastSpeech-style network. It predicts duration, pitch, energy, and brightness, then decodes an 80-bin mel spectrogram. -```text -Text - -> English normalization + G2P frontend - -> Compact FastSpeech-style acoustic model - -> 80-bin mel spectrogram - -> Snake V2Mid HiFi-GAN-style vocoder - -> 24 kHz waveform -``` +The vocoder is a small Snake-activation HiFi-GAN-style generator trained for 24 kHz waveform reconstruction. -### Acoustic Model +Main settings: -The acoustic model predicts duration, energy, brightness, and pitch, expands token states into frame states, and decodes 80-bin mel spectrograms. +| Setting | Value | +|---|---:| +| Sample rate | 24 kHz | +| Mel bins | 80 | +| Acoustic hidden size | 168 | +| Encoder layers | 5 | +| Decoder layers | 6 | +| Vocoder upsample rates | 8, 8, 2, 2 | -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: +## Good For - Tiny local TTS experiments - Offline assistant prototypes -- Embedded or low-resource speech demos - Efficient inference research +- Embedded speech demos - Browser/WASM-style exploration -- Baseline for sub-5M TTS work +- A baseline for sub-5M TTS work -Poor fits: +## Not Good For - Production narration - Accessibility-critical output - Voice cloning -- Multilingual TTS -- High-fidelity studio speech -- Long-form audiobook generation +- Multilingual speech +- High-fidelity audiobook generation +- Matching large modern TTS systems ## Limitations -This model is intentionally tiny and has clear quality limits: +This is a very small experimental model. It can sound robotic, buzzy, or unstable, especially on difficult unseen text. Long prompts and unusual phrasing are less reliable. The vocoder is also a clear quality bottleneck. -- 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. +Use it as a tiny-model research/demo release, not as a production TTS engine. ## 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`. +This repository includes a small third-party English text frontend for tokenization/G2P compatibility. Its license is included as `TINY_TTS_LICENSE`. diff --git a/assets/inflect-nano-banner.png b/assets/inflect-nano-banner.png new file mode 100644 index 0000000..0837e96 --- /dev/null +++ b/assets/inflect-nano-banner.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78e68775307d45a865cc9cac0ec538ee2f0d595ae4e531644480ff9c14d92af9 +size 3064613