drmhse commited on
Commit
630c590
路
verified 路
1 Parent(s): 35d0646

Paper and card: nano-edge-tts v1 (earlier model) and v2 (this model) named explicitly

Browse files
README.md CHANGED
@@ -19,7 +19,7 @@ tags:
19
  # nano-edge-tts-standalone
20
 
21
  Text to speech in **3.27M parameters**, distilled from [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) without running any
22
- of its networks or installing any of its software. It builds on [nano-edge-tts](https://huggingface.co/drmhse/nano-edge-tts),
23
  which replaced Kokoro's decoder and kept Kokoro's 28.5M-parameter text side; here the text side is replaced too.
24
 
25
  From Kokoro it keeps only data: the phoneme vocabulary, the 28 English voice vectors, and the text front end. Everything
@@ -30,7 +30,7 @@ learned is new:
30
  - a **mapper** (0.96M, 80 frames/s) and a **renderer** (0.79M, 160 frames/s) that set per-frequency gains on a pulse train and on
31
  white noise. Two inverse STFTs make the audio, and no network runs at audio rate.
32
 
33
- ![Learned parameters: Kokoro-82M 81.8M, nano-edge-tts 30.2M, this model 3.27M](paper/figures/params.png)
34
 
35
  **Paper:** [Kokoro-Quality Speech in 3.3M Parameters: Where a Text-to-Speech Model's Capacity Was Not Needed](paper/paper.pdf).
36
  **To rebuild it:** every checkpoint of the training chain with its arguments and logs ([`chain/`](chain)),
 
19
  # nano-edge-tts-standalone
20
 
21
  Text to speech in **3.27M parameters**, distilled from [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) without running any
22
+ of its networks or installing any of its software. It builds on [nano-edge-tts v1](https://huggingface.co/drmhse/nano-edge-tts),
23
  which replaced Kokoro's decoder and kept Kokoro's 28.5M-parameter text side; here the text side is replaced too.
24
 
25
  From Kokoro it keeps only data: the phoneme vocabulary, the 28 English voice vectors, and the text front end. Everything
 
30
  - a **mapper** (0.96M, 80 frames/s) and a **renderer** (0.79M, 160 frames/s) that set per-frequency gains on a pulse train and on
31
  white noise. Two inverse STFTs make the audio, and no network runs at audio rate.
32
 
33
+ ![Learned parameters: Kokoro-82M 81.8M, nano-edge-tts v1 30.2M, nano-edge-tts v2 (this model) 3.27M](paper/figures/params.png)
34
 
35
  **Paper:** [Kokoro-Quality Speech in 3.3M Parameters: Where a Text-to-Speech Model's Capacity Was Not Needed](paper/paper.pdf).
36
  **To rebuild it:** every checkpoint of the training chain with its arguments and logs ([`chain/`](chain)),
paper/figures/listening.png CHANGED
paper/figures/listening.svg CHANGED
paper/figures/make.py CHANGED
@@ -37,8 +37,8 @@ def bar_label(ax, x, y, s, dark):
37
 
38
  def params():
39
  rows = [('Kokoro-82M', [('text side', 28.5, KOK_LIGHT), ('decoder', 53.3, KOK_DARK)], '81.8M'),
40
- ('nano-edge-tts', [('Kokoro\'s text side', 28.5, KOK_LIGHT), ('', 1.75, BLUE_MID)], '30.2M new decoder 1.75M'),
41
- ('this work', [('', 1.52, BLUE_DARK), ('', 0.96, BLUE_MID), ('', 0.79, BLUE_LIGHT)],
42
  '3.27M text side 1.52M 路 mapper 0.96M 路 renderer 0.79M')]
43
  fig, ax = plt.subplots(figsize=(W, 1.65))
44
  for i, (_, parts, total) in enumerate(rows):
@@ -76,7 +76,7 @@ def listening():
76
  ('F4 + post-filter', count(os.path.join(RES, 'listening_F4sharp_vs_kokoro.json'))),
77
  ('G2 + post-filter', count(os.path.join(RES, 'listening_G2sharp_vs_kokoro.json')))]
78
  keys = (('k', KOK_DARK, 'Kokoro-82M preferred', True), ('s', SAME, 'heard as the same', False),
79
- ('n', BLUE_DARK, 'this work preferred', True))
80
  fig, ax = plt.subplots(figsize=(W, 1.55))
81
  for i, (_, c) in enumerate(pages):
82
  x = 0
 
37
 
38
  def params():
39
  rows = [('Kokoro-82M', [('text side', 28.5, KOK_LIGHT), ('decoder', 53.3, KOK_DARK)], '81.8M'),
40
+ ('nano-edge-tts v1', [('Kokoro\'s text side', 28.5, KOK_LIGHT), ('', 1.75, BLUE_MID)], '30.2M new decoder 1.75M'),
41
+ ('nano-edge-tts v2', [('', 1.52, BLUE_DARK), ('', 0.96, BLUE_MID), ('', 0.79, BLUE_LIGHT)],
42
  '3.27M text side 1.52M 路 mapper 0.96M 路 renderer 0.79M')]
43
  fig, ax = plt.subplots(figsize=(W, 1.65))
44
  for i, (_, parts, total) in enumerate(rows):
 
76
  ('F4 + post-filter', count(os.path.join(RES, 'listening_F4sharp_vs_kokoro.json'))),
77
  ('G2 + post-filter', count(os.path.join(RES, 'listening_G2sharp_vs_kokoro.json')))]
78
  keys = (('k', KOK_DARK, 'Kokoro-82M preferred', True), ('s', SAME, 'heard as the same', False),
79
+ ('n', BLUE_DARK, 'nano-edge-tts v2 preferred', True))
80
  fig, ax = plt.subplots(figsize=(W, 1.55))
81
  for i, (_, c) in enumerate(pages):
82
  x = 0
paper/figures/offsets.svg CHANGED
paper/figures/params.png CHANGED
paper/figures/params.svg CHANGED
paper/paper.pdf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fb7a035547365e360c043a6dd6a0063789a47a91900fd94eb5822bde93957c80
3
- size 227471
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10e5c694f1e7caed91f1b1d7bdb69b3711a5e191742425af3f4cc7b8b9457a7b
3
+ size 227707
paper/paper.typ CHANGED
@@ -85,18 +85,18 @@
85
  Kokoro-82M @kokoro is an 81.8M-parameter text-to-speech model built on StyleTTS 2 @styletts2: a 28.5M-parameter text side
86
  (PL-BERT @plbert, a text encoder and a prosody predictor) turns phonemes and a voice vector into per-phoneme features, durations,
87
  pitch and energy, and a 53.3M-parameter decoder turns those into a 24 kHz waveform. It tops the Open TTS Leaderboard's English
88
- ranking @ttsleaderboard for both word error and predicted naturalness. nano-edge-tts @nanoedge already replaced its decoder with
89
  1.75M parameters that run no network at audio rate. That left the text side as 94% of the pipeline's parameters and 69% of its
90
  CPU time.
91
 
92
- This paper asks how much of the remaining capacity the quality actually needs, and answers: about 4%. The model described here
93
- (@fig-params) runs a 1.52M-parameter text side into a 1.75M-parameter decoder of nano-edge-tts's design, retrained. From Kokoro
94
  it keeps only data: the 178-symbol phoneme vocabulary, the 28 English voice vectors, and the misaki front end @misaki, packaged
95
  so that none of Kokoro's software is installed. Every component is distilled from Kokoro-82M, and closeness to Kokoro is the
96
  target throughout.
97
 
98
  #figure(image("figures/params.svg", width: 96%),
99
- caption: [Learned parameters. Grey: Kokoro-82M's networks; blue: networks trained here or in nano-edge-tts @nanoedge. The
100
  renderer's fixed STFT matrices are buffers and are not counted.]) <fig-params>
101
 
102
  The size reduction rests on three findings, each of which replaced a larger model or a longer training run with information
@@ -122,7 +122,7 @@ encoders of that kind. Kokoro adds PL-BERT @plbert, a phoneme-level language mod
122
  side keeps the interface and replaces the language model with two cheap sources of context: part-of-speech tags and parameter
123
  sharing across depth, as in ALBERT @albert and Universal Transformers @universal.
124
 
125
- *Harmonic-plus-noise decoders.* The decoder is that of nano-edge-tts @nanoedge, in the line of spectral modelling synthesis
126
  @sms, DDSP @ddsp and neural source-filter models @nsf; its critic reads frozen WavLM layers @wavlm as in StyleTTS 2. New here are
127
  a second critic on the 4--12 kHz spectrogram, trained as a least-squares GAN @lsgan with feature matching @melgan, and an
128
  inference-time post-filter on the noise gains, a frequency-domain cousin of the adaptive postfilters of speech coding @postfilter.
@@ -149,11 +149,11 @@ The text side has the interface of Kokoro's: phoneme ids and the prosody half of
149
  A mapper (0.96M) turns per-phoneme features, F0 and energy into a 512-channel description at 80 frames per second; a renderer
150
  (0.79M) predicts, 160 times a second, a gain and a phase rotation for each of 301 bins of a pulse train's STFT (25 ms window) and
151
  a gain for each of 61 bins of white noise's STFT (5 ms window) at five sub-steps. Two inverse STFTs make the audio; no network runs
152
- at audio rate. Four changes to nano-edge-tts's training made a step four times faster and removed its buzz:
153
 
154
  - *Cached mapper.* The mapper is trained with the renderer on whole sentences, then frozen and its features cached per training
155
  window. The WavLM critic is the only adversary; the multi-period and multi-resolution discriminators cost most of each step and
156
- added little. A renderer step fell from 868 to 212 ms.
157
  - *Expected power.* Spectral losses compare Kokoro's spectrum with the output's expected power, $|H|^2 + EE|N|^2$, over four noise
158
  draws. Against one draw the noise branch is charged for its own fluctuation, and the exact-period harmonic branch takes over the
159
  high band, which listeners heard as "machine".
 
85
  Kokoro-82M @kokoro is an 81.8M-parameter text-to-speech model built on StyleTTS 2 @styletts2: a 28.5M-parameter text side
86
  (PL-BERT @plbert, a text encoder and a prosody predictor) turns phonemes and a voice vector into per-phoneme features, durations,
87
  pitch and energy, and a 53.3M-parameter decoder turns those into a 24 kHz waveform. It tops the Open TTS Leaderboard's English
88
+ ranking @ttsleaderboard for both word error and predicted naturalness. Our earlier model, nano-edge-tts v1 @nanoedge, replaced its decoder with
89
  1.75M parameters that run no network at audio rate. That left the text side as 94% of the pipeline's parameters and 69% of its
90
  CPU time.
91
 
92
+ This paper presents nano-edge-tts v2 and asks how much of the remaining capacity the quality actually needs, and answers: about 4%. The model described here
93
+ (@fig-params) runs a 1.52M-parameter text side into a 1.75M-parameter decoder of v1's design, retrained. From Kokoro
94
  it keeps only data: the 178-symbol phoneme vocabulary, the 28 English voice vectors, and the misaki front end @misaki, packaged
95
  so that none of Kokoro's software is installed. Every component is distilled from Kokoro-82M, and closeness to Kokoro is the
96
  target throughout.
97
 
98
  #figure(image("figures/params.svg", width: 96%),
99
+ caption: [Learned parameters. Grey: Kokoro-82M's networks; blue: networks trained for nano-edge-tts v1 @nanoedge or v2. The
100
  renderer's fixed STFT matrices are buffers and are not counted.]) <fig-params>
101
 
102
  The size reduction rests on three findings, each of which replaced a larger model or a longer training run with information
 
122
  side keeps the interface and replaces the language model with two cheap sources of context: part-of-speech tags and parameter
123
  sharing across depth, as in ALBERT @albert and Universal Transformers @universal.
124
 
125
+ *Harmonic-plus-noise decoders.* The decoder is that of nano-edge-tts v1 @nanoedge, in the line of spectral modelling synthesis
126
  @sms, DDSP @ddsp and neural source-filter models @nsf; its critic reads frozen WavLM layers @wavlm as in StyleTTS 2. New here are
127
  a second critic on the 4--12 kHz spectrogram, trained as a least-squares GAN @lsgan with feature matching @melgan, and an
128
  inference-time post-filter on the noise gains, a frequency-domain cousin of the adaptive postfilters of speech coding @postfilter.
 
149
  A mapper (0.96M) turns per-phoneme features, F0 and energy into a 512-channel description at 80 frames per second; a renderer
150
  (0.79M) predicts, 160 times a second, a gain and a phase rotation for each of 301 bins of a pulse train's STFT (25 ms window) and
151
  a gain for each of 61 bins of white noise's STFT (5 ms window) at five sub-steps. Two inverse STFTs make the audio; no network runs
152
+ at audio rate. Four changes to v1's training made a step four times faster and removed its buzz:
153
 
154
  - *Cached mapper.* The mapper is trained with the renderer on whole sentences, then frozen and its features cached per training
155
  window. The WavLM critic is the only adversary; the multi-period and multi-resolution discriminators cost most of each step and
156
+ added little in v1. A renderer step fell from 868 to 212 ms.
157
  - *Expected power.* Spectral losses compare Kokoro's spectrum with the output's expected power, $|H|^2 + EE|N|^2$, over four noise
158
  draws. Against one draw the noise branch is charged for its own fluctuation, and the exact-period harmonic branch takes over the
159
  high band, which listeners heard as "machine".