tiny-tts 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. tiny_tts-0.2.0/LICENSE +152 -0
  2. tiny_tts-0.2.0/MANIFEST.in +5 -0
  3. tiny_tts-0.2.0/PKG-INFO +458 -0
  4. tiny_tts-0.2.0/README.md +230 -0
  5. tiny_tts-0.2.0/TinyTTS.png +0 -0
  6. tiny_tts-0.2.0/checkpoints/G.pth +0 -0
  7. tiny_tts-0.2.0/pyproject.toml +109 -0
  8. tiny_tts-0.2.0/setup.cfg +4 -0
  9. tiny_tts-0.2.0/setup.py +144 -0
  10. tiny_tts-0.2.0/tiny_tts/__init__.py +102 -0
  11. tiny_tts-0.2.0/tiny_tts/alignment/__init__.py +16 -0
  12. tiny_tts-0.2.0/tiny_tts/alignment/core.py +46 -0
  13. tiny_tts-0.2.0/tiny_tts/infer.py +191 -0
  14. tiny_tts-0.2.0/tiny_tts/infer_onnx.py +199 -0
  15. tiny_tts-0.2.0/tiny_tts/integrations/__init__.py +6 -0
  16. tiny_tts-0.2.0/tiny_tts/integrations/langchain.py +179 -0
  17. tiny_tts-0.2.0/tiny_tts/models/__init__.py +1 -0
  18. tiny_tts-0.2.0/tiny_tts/models/synthesizer.py +718 -0
  19. tiny_tts-0.2.0/tiny_tts/nn/__init__.py +1 -0
  20. tiny_tts-0.2.0/tiny_tts/nn/attentions.py +424 -0
  21. tiny_tts-0.2.0/tiny_tts/nn/commons.py +151 -0
  22. tiny_tts-0.2.0/tiny_tts/nn/modules.py +578 -0
  23. tiny_tts-0.2.0/tiny_tts/nn/transforms.py +209 -0
  24. tiny_tts-0.2.0/tiny_tts/text/__init__.py +19 -0
  25. tiny_tts-0.2.0/tiny_tts/text/advanced_normalization.py +370 -0
  26. tiny_tts-0.2.0/tiny_tts/text/english.py +173 -0
  27. tiny_tts-0.2.0/tiny_tts/text/english_utils/__init__.py +0 -0
  28. tiny_tts-0.2.0/tiny_tts/text/english_utils/abbreviations.py +35 -0
  29. tiny_tts-0.2.0/tiny_tts/text/english_utils/number_norm.py +97 -0
  30. tiny_tts-0.2.0/tiny_tts/text/english_utils/time_norm.py +47 -0
  31. tiny_tts-0.2.0/tiny_tts/text/symbols.py +293 -0
  32. tiny_tts-0.2.0/tiny_tts/utils/__init__.py +5 -0
  33. tiny_tts-0.2.0/tiny_tts/utils/config.py +42 -0
  34. tiny_tts-0.2.0/tiny_tts.egg-info/PKG-INFO +458 -0
  35. tiny_tts-0.2.0/tiny_tts.egg-info/SOURCES.txt +61 -0
  36. tiny_tts-0.2.0/tiny_tts.egg-info/dependency_links.txt +1 -0
  37. tiny_tts-0.2.0/tiny_tts.egg-info/entry_points.txt +3 -0
  38. tiny_tts-0.2.0/tiny_tts.egg-info/requires.txt +53 -0
  39. tiny_tts-0.2.0/tiny_tts.egg-info/top_level.txt +1 -0
tiny_tts-0.2.0/LICENSE ADDED
@@ -0,0 +1,152 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner.
50
+
51
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
52
+ whom a Contribution has been received by the Licensor and included
53
+ within the Work.
54
+
55
+ 2. Grant of Copyright License. Subject to the terms and conditions of
56
+ this License, each Contributor hereby grants to You a perpetual,
57
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
58
+ copyright license to reproduce, prepare Derivative Works of,
59
+ publicly display, publicly perform, sublicense, and distribute the
60
+ Work and such Derivative Works in Source or Object form.
61
+
62
+ 3. Grant of Patent License. Subject to the terms and conditions of
63
+ this License, each Contributor hereby grants to You a perpetual,
64
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
65
+ (except as stated in this section) patent license to make, have made,
66
+ use, offer to sell, sell, import, and otherwise transfer the Work,
67
+ where such license applies only to those patent claims licensable
68
+ by such Contributor that are necessarily infringed by their
69
+ Contribution(s) alone or by the combination of their Contribution(s)
70
+ with the Work to which such Contribution(s) was submitted. If You
71
+ institute patent litigation against any entity (including a cross-claim
72
+ or counterclaim in a lawsuit) alleging that the Work or any
73
+ Contribution embodied within the Work constitutes direct or contributory
74
+ patent infringement, then any patent licenses granted to You under
75
+ this License for that Work shall terminate as of the date such
76
+ litigation is filed.
77
+
78
+ 4. Redistribution. You may reproduce and distribute copies of the
79
+ Work or Derivative Works thereof in any medium, with or without
80
+ modifications, and in Source or Object form, provided that You
81
+ meet the following conditions:
82
+
83
+ (a) You must give any other recipients of the Work or Derivative
84
+ Works a copy of this License; and
85
+
86
+ (b) You must cause any modified files to carry prominent notices
87
+ stating that You changed the files; and
88
+
89
+ (c) You must retain, in the Source form of any Derivative Works
90
+ that You distribute, all copyright, patent, trademark, and
91
+ attribution notices from the Source form of the Work; and
92
+
93
+ (d) If the Work includes a "NOTICE" text file, You must include a
94
+ readable copy of the attribution notices contained within such
95
+ NOTICE file.
96
+
97
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
98
+ any Contribution intentionally submitted for inclusion in the Work
99
+ by You to the Licensor shall be under the terms and conditions of
100
+ this License, without any additional terms or conditions.
101
+
102
+ 6. Trademarks. This License does not grant permission to use the trade
103
+ names, trademarks, service marks, or product names of the Licensor.
104
+
105
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed
106
+ to in writing, Licensor provides the Work (and each Contributor
107
+ provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
108
+ OR CONDITIONS OF ANY KIND, either express or implied, including,
109
+ without limitation, any warranties or conditions of TITLE,
110
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR
111
+ PURPOSE. You are solely responsible for determining the
112
+ appropriateness of using or reproducing the Work and assume any
113
+ risks associated with Your exercise of permissions under this License.
114
+
115
+ 8. Limitation of Liability. In no event and under no legal theory,
116
+ whether in tort (including negligence), contract, or otherwise,
117
+ unless required by applicable law (such as deliberate and grossly
118
+ negligent acts) or agreed to in writing, shall any Contributor be
119
+ liable to You for damages, including any direct, indirect, special,
120
+ incidental, or exemplary damages of any character arising as a
121
+ result of this License or out of the use or inability to use the
122
+ Work (including but not limited to damages for loss of goodwill,
123
+ work stoppage, computer failure or malfunction, or all other
124
+ commercial damages or losses), even if such Contributor has been
125
+ advised of the possibility of such damages.
126
+
127
+ 9. Accepting Warranty or Additional Liability. While redistributing
128
+ the Work or Derivative Works thereof, You may choose to offer,
129
+ and charge a fee for, acceptance of support, warranty, indemnity,
130
+ or other liability obligations and/or rights consistent with this
131
+ License. However, in accepting such obligations, You may act only
132
+ on Your own behalf and on Your sole responsibility, not on behalf
133
+ of any other Contributor, and only if You agree to indemnify,
134
+ defend, and hold each Contributor harmless for any liability
135
+ incurred by, or claims asserted against, such Contributor by reason
136
+ of your accepting any such warranty or additional liability.
137
+
138
+ END OF TERMS AND CONDITIONS
139
+
140
+ Copyright 2025 tronghieuit
141
+
142
+ Licensed under the Apache License, Version 2.0 (the "License");
143
+ you may not use this file except in compliance with the License.
144
+ You may obtain a copy of the License at
145
+
146
+ http://www.apache.org/licenses/LICENSE-2.0
147
+
148
+ Unless required by applicable law or agreed to in writing, software
149
+ distributed under the License is distributed on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151
+ See the License for the specific language governing permissions and
152
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include TinyTTS.png
3
+ recursive-include text *.rep *.pickle
4
+ recursive-include checkpoints *.pth
5
+ recursive-include text/english_utils *.py
@@ -0,0 +1,458 @@
1
+ Metadata-Version: 2.4
2
+ Name: tiny-tts
3
+ Version: 0.2.0
4
+ Summary: Ultra-lightweight English text-to-speech model (1.6M params, ~3.4MB ONNX)
5
+ Home-page: https://github.com/tronghieuit/tiny-tts
6
+ Author: Trong Hieu UI
7
+ Author-email: Trong Hieu UI <your.email@example.com>
8
+ License: Apache License
9
+ Version 2.0, January 2004
10
+ http://www.apache.org/licenses/
11
+
12
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13
+
14
+ 1. Definitions.
15
+
16
+ "License" shall mean the terms and conditions for use, reproduction,
17
+ and distribution as defined by Sections 1 through 9 of this document.
18
+
19
+ "Licensor" shall mean the copyright owner or entity authorized by
20
+ the copyright owner that is granting the License.
21
+
22
+ "Legal Entity" shall mean the union of the acting entity and all
23
+ other entities that control, are controlled by, or are under common
24
+ control with that entity. For the purposes of this definition,
25
+ "control" means (i) the power, direct or indirect, to cause the
26
+ direction or management of such entity, whether by contract or
27
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity
31
+ exercising permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications,
34
+ including but not limited to software source code, documentation
35
+ source, and configuration files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical
38
+ transformation or translation of a Source form, including but
39
+ not limited to compiled object code, generated documentation,
40
+ and conversions to other media types.
41
+
42
+ "Work" shall mean the work of authorship made available under
43
+ the License, as indicated by a copyright notice that is included in
44
+ or attached to the work (an example is provided in the Appendix below).
45
+
46
+ "Derivative Works" shall mean any work, whether in Source or Object
47
+ form, that is based on (or derived from) the Work and for which the
48
+ editorial revisions, annotations, elaborations, or other modifications
49
+ represent, as a whole, an original work of authorship. For the purposes
50
+ of this License, Derivative Works shall not include works that remain
51
+ separable from, or merely link (or bind by name) to the interfaces of,
52
+ the Work and Derivative Works thereof.
53
+
54
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
55
+ in the Work by the copyright owner or by an individual or Legal Entity
56
+ authorized to submit on behalf of the copyright owner.
57
+
58
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
59
+ whom a Contribution has been received by the Licensor and included
60
+ within the Work.
61
+
62
+ 2. Grant of Copyright License. Subject to the terms and conditions of
63
+ this License, each Contributor hereby grants to You a perpetual,
64
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
65
+ copyright license to reproduce, prepare Derivative Works of,
66
+ publicly display, publicly perform, sublicense, and distribute the
67
+ Work and such Derivative Works in Source or Object form.
68
+
69
+ 3. Grant of Patent License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ (except as stated in this section) patent license to make, have made,
73
+ use, offer to sell, sell, import, and otherwise transfer the Work,
74
+ where such license applies only to those patent claims licensable
75
+ by such Contributor that are necessarily infringed by their
76
+ Contribution(s) alone or by the combination of their Contribution(s)
77
+ with the Work to which such Contribution(s) was submitted. If You
78
+ institute patent litigation against any entity (including a cross-claim
79
+ or counterclaim in a lawsuit) alleging that the Work or any
80
+ Contribution embodied within the Work constitutes direct or contributory
81
+ patent infringement, then any patent licenses granted to You under
82
+ this License for that Work shall terminate as of the date such
83
+ litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the
86
+ Work or Derivative Works thereof in any medium, with or without
87
+ modifications, and in Source or Object form, provided that You
88
+ meet the following conditions:
89
+
90
+ (a) You must give any other recipients of the Work or Derivative
91
+ Works a copy of this License; and
92
+
93
+ (b) You must cause any modified files to carry prominent notices
94
+ stating that You changed the files; and
95
+
96
+ (c) You must retain, in the Source form of any Derivative Works
97
+ that You distribute, all copyright, patent, trademark, and
98
+ attribution notices from the Source form of the Work; and
99
+
100
+ (d) If the Work includes a "NOTICE" text file, You must include a
101
+ readable copy of the attribution notices contained within such
102
+ NOTICE file.
103
+
104
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
105
+ any Contribution intentionally submitted for inclusion in the Work
106
+ by You to the Licensor shall be under the terms and conditions of
107
+ this License, without any additional terms or conditions.
108
+
109
+ 6. Trademarks. This License does not grant permission to use the trade
110
+ names, trademarks, service marks, or product names of the Licensor.
111
+
112
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed
113
+ to in writing, Licensor provides the Work (and each Contributor
114
+ provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
115
+ OR CONDITIONS OF ANY KIND, either express or implied, including,
116
+ without limitation, any warranties or conditions of TITLE,
117
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR
118
+ PURPOSE. You are solely responsible for determining the
119
+ appropriateness of using or reproducing the Work and assume any
120
+ risks associated with Your exercise of permissions under this License.
121
+
122
+ 8. Limitation of Liability. In no event and under no legal theory,
123
+ whether in tort (including negligence), contract, or otherwise,
124
+ unless required by applicable law (such as deliberate and grossly
125
+ negligent acts) or agreed to in writing, shall any Contributor be
126
+ liable to You for damages, including any direct, indirect, special,
127
+ incidental, or exemplary damages of any character arising as a
128
+ result of this License or out of the use or inability to use the
129
+ Work (including but not limited to damages for loss of goodwill,
130
+ work stoppage, computer failure or malfunction, or all other
131
+ commercial damages or losses), even if such Contributor has been
132
+ advised of the possibility of such damages.
133
+
134
+ 9. Accepting Warranty or Additional Liability. While redistributing
135
+ the Work or Derivative Works thereof, You may choose to offer,
136
+ and charge a fee for, acceptance of support, warranty, indemnity,
137
+ or other liability obligations and/or rights consistent with this
138
+ License. However, in accepting such obligations, You may act only
139
+ on Your own behalf and on Your sole responsibility, not on behalf
140
+ of any other Contributor, and only if You agree to indemnify,
141
+ defend, and hold each Contributor harmless for any liability
142
+ incurred by, or claims asserted against, such Contributor by reason
143
+ of your accepting any such warranty or additional liability.
144
+
145
+ END OF TERMS AND CONDITIONS
146
+
147
+ Copyright 2025 tronghieuit
148
+
149
+ Licensed under the Apache License, Version 2.0 (the "License");
150
+ you may not use this file except in compliance with the License.
151
+ You may obtain a copy of the License at
152
+
153
+ http://www.apache.org/licenses/LICENSE-2.0
154
+
155
+ Unless required by applicable law or agreed to in writing, software
156
+ distributed under the License is distributed on an "AS IS" BASIS,
157
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
158
+ See the License for the specific language governing permissions and
159
+ limitations under the License.
160
+
161
+ Project-URL: Homepage, https://github.com/tronghieuit/tiny-tts
162
+ Project-URL: Documentation, https://github.com/tronghieuit/tiny-tts#readme
163
+ Project-URL: Repository, https://github.com/tronghieuit/tiny-tts
164
+ Project-URL: Issues, https://github.com/tronghieuit/tiny-tts/issues
165
+ Project-URL: Demo, https://huggingface.co/spaces/backtracking/tiny-tts-demo
166
+ Keywords: tts,text-to-speech,speech-synthesis,onnx,lightweight,edge-computing
167
+ Classifier: Development Status :: 4 - Beta
168
+ Classifier: Intended Audience :: Developers
169
+ Classifier: Intended Audience :: Science/Research
170
+ Classifier: License :: OSI Approved :: Apache Software License
171
+ Classifier: Programming Language :: Python :: 3
172
+ Classifier: Programming Language :: Python :: 3.8
173
+ Classifier: Programming Language :: Python :: 3.9
174
+ Classifier: Programming Language :: Python :: 3.10
175
+ Classifier: Programming Language :: Python :: 3.11
176
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
177
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
178
+ Requires-Python: >=3.8
179
+ Description-Content-Type: text/markdown
180
+ License-File: LICENSE
181
+ Requires-Dist: torch>=2.0
182
+ Requires-Dist: torchaudio>=2.0
183
+ Requires-Dist: soundfile>=0.12.0
184
+ Requires-Dist: g2p-en>=3.2.0
185
+ Requires-Dist: transformers>=4.0.0
186
+ Requires-Dist: numba>=0.56.0
187
+ Requires-Dist: huggingface_hub>=0.14.0
188
+ Requires-Dist: nltk>=3.8.0
189
+ Provides-Extra: api
190
+ Requires-Dist: fastapi>=0.104.0; extra == "api"
191
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "api"
192
+ Requires-Dist: pydantic>=2.0.0; extra == "api"
193
+ Provides-Extra: onnx
194
+ Requires-Dist: onnxruntime>=1.16.0; extra == "onnx"
195
+ Requires-Dist: onnx>=1.14.0; extra == "onnx"
196
+ Requires-Dist: onnxruntime-tools>=1.7.0; extra == "onnx"
197
+ Provides-Extra: mobile
198
+ Requires-Dist: coremltools>=7.0; sys_platform == "darwin" and extra == "mobile"
199
+ Requires-Dist: onnx2tf>=1.16.0; extra == "mobile"
200
+ Requires-Dist: tensorflow>=2.14.0; extra == "mobile"
201
+ Provides-Extra: dev
202
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
203
+ Requires-Dist: black>=23.0.0; extra == "dev"
204
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
205
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
206
+ Provides-Extra: demo
207
+ Requires-Dist: gradio>=4.0.0; extra == "demo"
208
+ Requires-Dist: sounddevice>=0.4.0; extra == "demo"
209
+ Requires-Dist: matplotlib>=3.7.0; extra == "demo"
210
+ Provides-Extra: all
211
+ Requires-Dist: fastapi>=0.104.0; extra == "all"
212
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "all"
213
+ Requires-Dist: pydantic>=2.0.0; extra == "all"
214
+ Requires-Dist: onnxruntime>=1.16.0; extra == "all"
215
+ Requires-Dist: onnx>=1.14.0; extra == "all"
216
+ Requires-Dist: onnxruntime-tools>=1.7.0; extra == "all"
217
+ Requires-Dist: coremltools>=7.0; sys_platform == "darwin" and extra == "all"
218
+ Requires-Dist: onnx2tf>=1.16.0; extra == "all"
219
+ Requires-Dist: tensorflow>=2.14.0; extra == "all"
220
+ Requires-Dist: pytest>=7.0.0; extra == "all"
221
+ Requires-Dist: black>=23.0.0; extra == "all"
222
+ Requires-Dist: gradio>=4.0.0; extra == "all"
223
+ Requires-Dist: sounddevice>=0.4.0; extra == "all"
224
+ Dynamic: author
225
+ Dynamic: home-page
226
+ Dynamic: license-file
227
+ Dynamic: requires-python
228
+
229
+ <p align="center">
230
+ <img src="TinyTTS.png" alt="TinyTTS" width="480"/>
231
+ </p>
232
+
233
+ <h1 align="center">TinyTTS</h1>
234
+
235
+ <p align="center">
236
+ <b>Ultra-lightweight English Text-to-Speech โ€” only 1.6M parameters, ~3.4 MB ONNX</b>
237
+ </p>
238
+
239
+ <p align="center">
240
+ <a href="https://huggingface.co/spaces/backtracking/tiny-tts-demo">
241
+ <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-md-dark.svg" alt="Open in Spaces">
242
+ </a>
243
+ </p>
244
+
245
+ ---
246
+
247
+ ## Highlights
248
+
249
+ TinyTTS is an end-to-end text-to-speech model that delivers natural-sounding speech with a fraction of the resources required by conventional TTS systems.
250
+
251
+ | Metric | TinyTTS | Typical TTS Models |
252
+ |---|---|---|
253
+ | **Parameters** | **~1.6M** | 50Mโ€“200M+ |
254
+ | **Checkpoint size** | **~3.4 MB** (ONNX FP16) | 200 MBโ€“1 GB+ |
255
+ | **Sample rate** | 44.1 kHz | 22.05โ€“44.1 kHz |
256
+ | **End-to-end** | Yes | Often requires separate vocoder |
257
+
258
+ With only **1.6 million parameters** and an ONNX model of just **~3.4 MB** (FP16), TinyTTS runs comfortably on CPU-only machines, edge devices, and embedded systems โ€” making real-time speech synthesis accessible without a GPU.
259
+
260
+ ## Installation
261
+
262
+ ### From source (pip install)
263
+
264
+ ```bash
265
+ git clone https://github.com/tronghieuit/tiny-tts.git
266
+ cd tiny-tts
267
+ pip install -e .
268
+ ```
269
+
270
+ After installing, the `tiny-tts` command is available globally:
271
+
272
+ ```bash
273
+ tiny-tts --checkpoint G.pth --text "Hello world" --device cuda
274
+ ```
275
+
276
+ ### Dependencies only
277
+
278
+ ```bash
279
+ pip install torch torchaudio soundfile g2p-en transformers numba
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Quick Start
285
+
286
+ ### Basic inference
287
+
288
+ ```bash
289
+ tiny-tts \
290
+ --text "The weather is nice today, and I feel very relaxed." \
291
+ --checkpoint G.pth \
292
+ --output output.wav \
293
+ --speaker MALE \
294
+ --speed 1.0 \
295
+ --device cuda
296
+ ```
297
+
298
+ ### CPU inference
299
+
300
+ ```bash
301
+ tiny-tts \
302
+ --text "The weather is nice today, and I feel very relaxed." \
303
+ --checkpoint G.pth \
304
+ --device cpu
305
+ ```
306
+
307
+ Output files are saved to `infer_outputs/`.
308
+
309
+ ---
310
+
311
+ ## Python API
312
+
313
+ You can easily use TinyTTS directly in your Python code:
314
+
315
+ ```python
316
+ from tiny_tts import TinyTTS
317
+
318
+ # Initialize the TTS model (auto-detects device and downloads default checkpoint if missing)
319
+ tts = TinyTTS()
320
+ # OR specify a custom checkpoint: tts = TinyTTS(checkpoint_path="...")
321
+
322
+ # Synthesize a single sentence
323
+ tts.speak("Hello, this is a test of the Python API.", output_path="hello.wav")
324
+
325
+ # Adjust speech speed (1.0=normal, 1.5=faster, 0.7=slower)
326
+ tts.speak("This is faster speech.", output_path="fast.wav", speed=1.5)
327
+ tts.speak("This is slower speech.", output_path="slow.wav", speed=0.7)
328
+
329
+ # Synthesize a long paragraph (5 sentences)
330
+ paragraph = (
331
+ "TinyTTS is an ultra-lightweight text-to-speech model. "
332
+ "It has only one point six million parameters, which makes it extremely fast. "
333
+ "You can run it easily on your local CPU without a dedicated graphics card. "
334
+ "The audio quality remains surprisingly clear despite the small model size. "
335
+ "I hope you enjoy building exciting applications with it!"
336
+ )
337
+ tts.speak(paragraph, output_path="paragraph.wav")
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Inference Benchmarks
343
+
344
+ Benchmarked on real hardware with the sentence:
345
+ *"The weather is nice today, and I feel very relaxed."* (~4.9s of audio at 44.1kHz)
346
+
347
+ - **CPU**: Intel Core (laptop, no GPU)
348
+ - **PyTorch**: 2.5.1+cu121
349
+ - **Model**: 1.62M parameters
350
+
351
+ | Backend | Synthesis Time | Audio | RTFx |
352
+ |:---|---:|---:|---:|
353
+ | **ONNX Runtime (CPU)** | **92 ms** | 4.88s | **~53x** ๐Ÿš€ |
354
+ | PyTorch (CPU) | 272 ms | 4.88s | ~18x |
355
+
356
+ > RTFx = Audio Duration รท Synthesis Time (higher = faster).
357
+ > With only 1.62M params, TinyTTS synthesizes ~5s of 44.1kHz audio in **92ms via ONNX** โ€” approximately **53ร— real-time** on a laptop CPU.
358
+
359
+ ---
360
+
361
+ ## Comparison with Other TTS Engines
362
+
363
+ All numbers are **CPU-only inference** benchmarked on the **same machine** (Intel Core laptop, no GPU).
364
+ Text: *"The weather is nice today, and I feel very relaxed."*
365
+ Protocol: 5 warm-up runs + 20 timed runs (median). Model load time excluded.
366
+
367
+ | ENGINE | Params | TTFA (ms) | TOTAL (s) | AUDIO (s) | RTFx | ๐Ÿ”Š |
368
+ |:---|---:|---:|---:|---:|---:|:---:|
369
+ | **TinyTTS (ONNX)** | **1.6M** | **86** | **0.092** | **4.88** | **~53x ๐Ÿš€** | [โ–ถ](samples/tinytts.wav) |
370
+ | Piper (ONNX, 22kHz) | ~63M | 114 | 0.112 | 2.91 | ~26x | [โ–ถ](samples/piper.wav) |
371
+ | **TinyTTS (PyTorch)** | **1.6M** | **295** | **0.272** | **4.88** | **~18x** | [โ–ถ](samples/tinytts.wav) |
372
+ | KittenTTS nano | ~10M | 298 | 0.286 | 4.87 | ~17x | [โ–ถ](samples/kittentts_nano.wav) |
373
+ | Supertonic (2-step) | ~82M | 260 | 0.249 | 3.69 | ~15x | [โ–ถ](samples/supertonic.wav) |
374
+ | Pocket-TTS | 100M | 1055 | 0.928 | 3.68 | ~4x | [โ–ถ](samples/pocket_tts.wav) |
375
+ | Kokoro ONNX | 82M | 943 | 0.933 | 3.16 | ~3x | [โ–ถ](samples/kokoro.wav) |
376
+ | KittenTTS mini | ~25M | 1965 | 2.047 | 4.17 | ~2x | [โ–ถ](samples/kittentts_mini.wav) |
377
+
378
+ > **TTFA** = Time To First Audio. **RTFx** = Audio Duration รท Synthesis Time (higher = faster).
379
+ > โš ๏ธ Output sample rates differ: Piper 22kHz, KittenTTS 24kHz, TinyTTS/Supertonic 44.1kHz.
380
+ > **TinyTTS achieves the best speed-to-size ratio**: only **1.6M params** / **3.4 MB** ONNX yet ~53ร— real-time at 44.1kHz.
381
+
382
+ ### CPU vs GPU vs ONNX Summary
383
+
384
+ ```text
385
+ Backend | Synthesis Time | Audio | RTFx
386
+ -----------------|----------------|--------|----------
387
+ CPU (ONNX) | 0.092 s | 4.88s | ~53x ๐Ÿš€
388
+ CPU (PyTorch) | 0.272 s | 4.88s | ~18x
389
+ GPU (CUDA, est.) | ~0.015 s | 4.88s | ~325x
390
+ ```
391
+
392
+ > **ONNX Runtime** is the recommended backend for CPU deployment โ€” it provides **~3ร— speedup** over PyTorch eager mode by fusing ops and eliminating Python dispatch overhead.
393
+
394
+ ### Run benchmarks yourself
395
+
396
+ ```bash
397
+ python benchmark.py
398
+ ```
399
+
400
+ > Compares TinyTTS (PyTorch + ONNX) against Piper, Kokoro, KittenTTS, Pocket-TTS and Supertonic on CPU.
401
+
402
+ ---
403
+
404
+ ## CLI Arguments
405
+
406
+ | Argument | Short | Default | Description |
407
+ |---|---|---|---|
408
+ | `--text` | `-t` | *"The weather is nice today..."* | Text to synthesize |
409
+ | `--checkpoint` | `-c` | *(optional)* | Path to `G.pth`. Auto-downloads if omitted. |
410
+ | `--output` | `-o` | `output.wav` | Output audio filename |
411
+ | `--speaker` | `-s` | `MALE` | Speaker ID |
412
+ | `--speed` | | `1.0` | Speech speed (1.0=normal, 1.5=faster, 0.7=slower) |
413
+ | `--device` | | `cuda` | Device: `cuda` or `cpu` |
414
+
415
+ ---
416
+
417
+ ## Project Structure
418
+
419
+ ```
420
+ tiny-tts/
421
+ โ”œโ”€โ”€ infer.py # Main inference script
422
+ โ”œโ”€โ”€ TinyTTS.png # Project logo
423
+ โ”œโ”€โ”€ setup.py # Package setup (pip install)
424
+ โ”œโ”€โ”€ pyproject.toml # Build configuration
425
+ โ”œโ”€โ”€ G.pth # Pre-trained checkpoint (FP16: ~17 MB)
426
+ โ”œโ”€โ”€ tinytts_fp16.onnx # ONNX FP16 model (~3.4 MB)
427
+ โ”œโ”€โ”€ models/
428
+ โ”‚ โ””โ”€โ”€ synthesizer.py # Model definition
429
+ โ”œโ”€โ”€ nn/
430
+ โ”‚ โ”œโ”€โ”€ attentions.py # Attention layers
431
+ โ”‚ โ”œโ”€โ”€ modules.py # Neural network modules
432
+ โ”‚ โ”œโ”€โ”€ commons.py # Utility functions
433
+ โ”‚ โ””โ”€โ”€ transforms.py # Flow transforms
434
+ โ”œโ”€โ”€ text/
435
+ โ”‚ โ”œโ”€โ”€ english.py # English G2P pipeline
436
+ โ”‚ โ”œโ”€โ”€ symbols.py # Phoneme symbol tables
437
+ โ”‚ โ”œโ”€โ”€ cmudict.rep # CMU Pronouncing Dictionary
438
+ โ”‚ โ””โ”€โ”€ english_utils/ # Text normalization
439
+ โ”œโ”€โ”€ alignment/
440
+ โ”‚ โ””โ”€โ”€ core.py # Viterbi alignment
441
+ โ””โ”€โ”€ utils/
442
+ โ””โ”€โ”€ config.py # Model hyperparameters
443
+ ```
444
+
445
+ ---
446
+
447
+ ## TODO
448
+
449
+ - [ ] Public source code for training
450
+ - [ ] Add more English speakers
451
+ - [ ] Add ultra-lightweight zero-shot voice cloning
452
+ - [x] Release an even smaller model version while maintaining high accuracy
453
+
454
+ ---
455
+
456
+ ## License
457
+
458
+ Licensed under the [Apache License, Version 2.0](LICENSE).