canto-tts 0.1.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.
- canto_tts-0.1.0/.gitignore +113 -0
- canto_tts-0.1.0/LICENSE +201 -0
- canto_tts-0.1.0/PKG-INFO +120 -0
- canto_tts-0.1.0/README.md +206 -0
- canto_tts-0.1.0/README_PYPI.md +73 -0
- canto_tts-0.1.0/pyproject.toml +105 -0
- canto_tts-0.1.0/src/canto_tts/__init__.py +162 -0
- canto_tts-0.1.0/src/canto_tts/_vendor/openmoss/ort_cpu_runtime.py +844 -0
- canto_tts-0.1.0/src/canto_tts/api/__init__.py +1 -0
- canto_tts-0.1.0/src/canto_tts/api/app.py +296 -0
- canto_tts-0.1.0/src/canto_tts/api/static/playground.css +450 -0
- canto_tts-0.1.0/src/canto_tts/api/static/playground.js +278 -0
- canto_tts-0.1.0/src/canto_tts/api/templates/index.html +103 -0
- canto_tts-0.1.0/src/canto_tts/backends/__init__.py +1 -0
- canto_tts-0.1.0/src/canto_tts/backends/base.py +111 -0
- canto_tts-0.1.0/src/canto_tts/backends/factory.py +105 -0
- canto_tts-0.1.0/src/canto_tts/backends/onnx_backend.py +191 -0
- canto_tts-0.1.0/src/canto_tts/backends/torch_backend.py +157 -0
- canto_tts-0.1.0/src/canto_tts/cli.py +220 -0
- canto_tts-0.1.0/src/canto_tts/core/__init__.py +1 -0
- canto_tts-0.1.0/src/canto_tts/core/cantophon.py +167 -0
- canto_tts-0.1.0/src/canto_tts/core/control_schema.py +83 -0
- canto_tts-0.1.0/src/canto_tts/core/prompting.py +118 -0
- canto_tts-0.1.0/src/canto_tts/hub.py +57 -0
- canto_tts-0.1.0/src/canto_tts/quality.py +281 -0
- canto_tts-0.1.0/tests/test_api.py +128 -0
- canto_tts-0.1.0/tests/test_onnx_backend.py +104 -0
- canto_tts-0.1.0/tests/test_quality.py +182 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# canto-tts — .gitignore
|
|
3
|
+
# =============================================================================
|
|
4
|
+
|
|
5
|
+
# ---------------------------------------------------------------------------
|
|
6
|
+
# Python bytecode & caches
|
|
7
|
+
# ---------------------------------------------------------------------------
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[cod]
|
|
10
|
+
*$py.class
|
|
11
|
+
*.pyo
|
|
12
|
+
|
|
13
|
+
# ---------------------------------------------------------------------------
|
|
14
|
+
# Virtual environments
|
|
15
|
+
# ---------------------------------------------------------------------------
|
|
16
|
+
.venv/
|
|
17
|
+
venv/
|
|
18
|
+
env/
|
|
19
|
+
ENV/
|
|
20
|
+
.env/
|
|
21
|
+
|
|
22
|
+
# ---------------------------------------------------------------------------
|
|
23
|
+
# Build artefacts & distribution
|
|
24
|
+
# ---------------------------------------------------------------------------
|
|
25
|
+
build/
|
|
26
|
+
dist/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
.eggs/
|
|
31
|
+
|
|
32
|
+
# ---------------------------------------------------------------------------
|
|
33
|
+
# Installer / package manager state
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
*.whl
|
|
38
|
+
.uv/
|
|
39
|
+
|
|
40
|
+
# ---------------------------------------------------------------------------
|
|
41
|
+
# Testing & coverage
|
|
42
|
+
# ---------------------------------------------------------------------------
|
|
43
|
+
.pytest_cache/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
htmlcov/
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
|
|
50
|
+
# ---------------------------------------------------------------------------
|
|
51
|
+
# Type checking
|
|
52
|
+
# ---------------------------------------------------------------------------
|
|
53
|
+
.mypy_cache/
|
|
54
|
+
.dmypy.json
|
|
55
|
+
.pytype/
|
|
56
|
+
.pyre/
|
|
57
|
+
|
|
58
|
+
# ---------------------------------------------------------------------------
|
|
59
|
+
# Linting
|
|
60
|
+
# ---------------------------------------------------------------------------
|
|
61
|
+
.ruff_cache/
|
|
62
|
+
|
|
63
|
+
# ---------------------------------------------------------------------------
|
|
64
|
+
# IDEs & editors
|
|
65
|
+
# ---------------------------------------------------------------------------
|
|
66
|
+
.vscode/
|
|
67
|
+
.idea/
|
|
68
|
+
*.swp
|
|
69
|
+
*.swo
|
|
70
|
+
*~
|
|
71
|
+
.DS_Store
|
|
72
|
+
Thumbs.db
|
|
73
|
+
|
|
74
|
+
# ---------------------------------------------------------------------------
|
|
75
|
+
# Local model / weight cache directories
|
|
76
|
+
# (never commit large binary weight files to the source repo)
|
|
77
|
+
# ---------------------------------------------------------------------------
|
|
78
|
+
onnx_weights/
|
|
79
|
+
torch_weights/
|
|
80
|
+
model_cache/
|
|
81
|
+
weights/
|
|
82
|
+
checkpoints/
|
|
83
|
+
|
|
84
|
+
# ---------------------------------------------------------------------------
|
|
85
|
+
# Audio test outputs
|
|
86
|
+
# (generated by tests or manual runs — not source artefacts)
|
|
87
|
+
# ---------------------------------------------------------------------------
|
|
88
|
+
*.wav
|
|
89
|
+
*.mp3
|
|
90
|
+
*.flac
|
|
91
|
+
*.ogg
|
|
92
|
+
*.opus
|
|
93
|
+
|
|
94
|
+
# ---------------------------------------------------------------------------
|
|
95
|
+
# Jupyter / notebook
|
|
96
|
+
# ---------------------------------------------------------------------------
|
|
97
|
+
.ipynb_checkpoints/
|
|
98
|
+
*.ipynb
|
|
99
|
+
|
|
100
|
+
# ---------------------------------------------------------------------------
|
|
101
|
+
# Docs build output
|
|
102
|
+
# ---------------------------------------------------------------------------
|
|
103
|
+
docs/_build/
|
|
104
|
+
docs/site/
|
|
105
|
+
site/
|
|
106
|
+
|
|
107
|
+
# ---------------------------------------------------------------------------
|
|
108
|
+
# Misc
|
|
109
|
+
# ---------------------------------------------------------------------------
|
|
110
|
+
*.log
|
|
111
|
+
*.tmp
|
|
112
|
+
*.bak
|
|
113
|
+
.hypothesis/
|
canto_tts-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
canto_tts-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: canto-tts
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Open-source Cantonese (Hong Kong) text-to-speech — CPU-first ONNX inference SDK
|
|
5
|
+
Project-URL: Homepage, https://github.com/typangaa/canto-tts
|
|
6
|
+
Project-URL: Repository, https://github.com/typangaa/canto-tts
|
|
7
|
+
Author: typangaa
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: canto-hk-g2p
|
|
12
|
+
Requires-Dist: huggingface-hub>=0.20
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: onnxruntime>=1.16
|
|
15
|
+
Requires-Dist: sentencepiece
|
|
16
|
+
Requires-Dist: soundfile
|
|
17
|
+
Provides-Extra: all
|
|
18
|
+
Requires-Dist: fastapi>=0.110; extra == 'all'
|
|
19
|
+
Requires-Dist: faster-whisper>=1.0; extra == 'all'
|
|
20
|
+
Requires-Dist: funasr; extra == 'all'
|
|
21
|
+
Requires-Dist: jinja2>=3.1; extra == 'all'
|
|
22
|
+
Requires-Dist: modelscope; extra == 'all'
|
|
23
|
+
Requires-Dist: opencc-python-reimplemented; extra == 'all'
|
|
24
|
+
Requires-Dist: python-multipart; extra == 'all'
|
|
25
|
+
Requires-Dist: torch>=2.0; extra == 'all'
|
|
26
|
+
Requires-Dist: torchaudio>=2.0; extra == 'all'
|
|
27
|
+
Requires-Dist: transformers==4.57.1; extra == 'all'
|
|
28
|
+
Requires-Dist: uvicorn>=0.27; extra == 'all'
|
|
29
|
+
Provides-Extra: demo
|
|
30
|
+
Requires-Dist: fastapi>=0.110; extra == 'demo'
|
|
31
|
+
Requires-Dist: jinja2>=3.1; extra == 'demo'
|
|
32
|
+
Requires-Dist: python-multipart; extra == 'demo'
|
|
33
|
+
Requires-Dist: uvicorn>=0.27; extra == 'demo'
|
|
34
|
+
Provides-Extra: quality
|
|
35
|
+
Requires-Dist: faster-whisper>=1.0; extra == 'quality'
|
|
36
|
+
Provides-Extra: quality-sensevoice
|
|
37
|
+
Requires-Dist: funasr; extra == 'quality-sensevoice'
|
|
38
|
+
Requires-Dist: modelscope; extra == 'quality-sensevoice'
|
|
39
|
+
Requires-Dist: opencc-python-reimplemented; extra == 'quality-sensevoice'
|
|
40
|
+
Requires-Dist: torch>=2.0; extra == 'quality-sensevoice'
|
|
41
|
+
Requires-Dist: torchaudio>=2.0; extra == 'quality-sensevoice'
|
|
42
|
+
Provides-Extra: torch
|
|
43
|
+
Requires-Dist: torch>=2.0; extra == 'torch'
|
|
44
|
+
Requires-Dist: torchaudio>=2.0; extra == 'torch'
|
|
45
|
+
Requires-Dist: transformers==4.57.1; extra == 'torch'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# canto-tts
|
|
49
|
+
|
|
50
|
+
**Cantonese Hong Kong Text-to-Speech · CPU-first · Apache-2.0**
|
|
51
|
+
|
|
52
|
+
[](https://pypi.org/project/canto-tts/)
|
|
53
|
+
[](https://github.com/typangaa/canto-tts/blob/main/LICENSE)
|
|
54
|
+
[](https://pypi.org/project/canto-tts/)
|
|
55
|
+
|
|
56
|
+
An open-source Cantonese (Hong Kong) text-to-speech SDK.
|
|
57
|
+
Runs on CPU via ONNX Runtime — no GPU required.
|
|
58
|
+
Fine-tuned from [MOSS-TTS-Nano](https://github.com/OpenMOSS/MOSS-TTS)
|
|
59
|
+
(0.1 B params, GPT-2 backbone, Apache-2.0, by OpenMOSS).
|
|
60
|
+
|
|
61
|
+
> **Weights published** — CER 11.82% / tone accuracy 84.22% / code-switch CER 13.87%
|
|
62
|
+
> on a 100-sentence gate set (N=5 repeat eval).
|
|
63
|
+
> Single default voice only — no voice cloning, no voice selection (yet).
|
|
64
|
+
> **PyPI package not published yet** — install from source for now;
|
|
65
|
+
> see the [GitHub repo](https://github.com/typangaa/canto-tts) for current status.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/typangaa/canto-tts.git && cd canto-tts && pip install -e .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Quickstart
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from canto_tts import CantoTTS
|
|
79
|
+
|
|
80
|
+
tts = CantoTTS() # auto-downloads typangaa/canto-tts-nano from HuggingFace on first use
|
|
81
|
+
tts.synthesize("多謝晒,今日天氣幾好。", "hello.wav")
|
|
82
|
+
print("Saved to hello.wav")
|
|
83
|
+
|
|
84
|
+
# English code-switching works too
|
|
85
|
+
tts.synthesize("我哋一齊去 IFC food court 食飯。", "codeswitching.wav")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Weights auto-download from HuggingFace and cache via the Hub (`~/.cache/huggingface/hub/`).
|
|
89
|
+
|
|
90
|
+
## Quality Modes (opt-in)
|
|
91
|
+
|
|
92
|
+
Two opt-in `quality=` modes trade extra compute for a more reliable draw, without touching the model:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
tts.synthesize(text, "out.wav", quality="duration_filter", max_attempts=3) # no extra deps
|
|
96
|
+
tts.synthesize(text, "out.wav", quality="best_of_n", best_of_n=4) # needs canto-tts[quality]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`quality="best_of_n"` reranks N draws by ASR character-error-rate; pass `asr_backend="sensevoice"` (needs `canto-tts[quality-sensevoice]`) for ~7x faster reranking at a small accuracy cost. Full writeup: [GitHub README](https://github.com/typangaa/canto-tts#quality-modes-opt-in-inference-time-reranking).
|
|
100
|
+
|
|
101
|
+
## Limitations
|
|
102
|
+
|
|
103
|
+
| | |
|
|
104
|
+
|--|--|
|
|
105
|
+
| **Quality** | CER 11.82% / tone accuracy 84.22% / code-switch CER 13.87% (N=5 repeat, 100-sentence gate set). |
|
|
106
|
+
| **Voice** | Single default voice. No voice cloning, no voice selection (yet). |
|
|
107
|
+
| **Language** | Cantonese (Hong Kong) + English code-switching only. No Mandarin. |
|
|
108
|
+
| **Training data** | Privately sourced — not released (copyright), regardless of weight status. |
|
|
109
|
+
| **Weights** | ✅ Published — [huggingface.co/typangaa/canto-tts-nano](https://huggingface.co/typangaa/canto-tts-nano). |
|
|
110
|
+
|
|
111
|
+
## Model & License
|
|
112
|
+
|
|
113
|
+
- **Base model**: [MOSS-TTS-Nano](https://github.com/OpenMOSS/MOSS-TTS) by OpenMOSS
|
|
114
|
+
- **Weights**: published at [huggingface.co/typangaa/canto-tts-nano](https://huggingface.co/typangaa/canto-tts-nano)
|
|
115
|
+
- **License**: Apache-2.0 (inherited from MOSS-TTS-Nano)
|
|
116
|
+
|
|
117
|
+
## Full Documentation
|
|
118
|
+
|
|
119
|
+
Full README, CLI docs, Docker self-hosting, and deployment guide:
|
|
120
|
+
**https://github.com/typangaa/canto-tts**
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# canto-tts 🎙️
|
|
2
|
+
|
|
3
|
+
> **廣東話(香港)文字轉語音 · Cantonese Hong Kong Text-to-Speech**
|
|
4
|
+
> CPU-first, ONNX Runtime, Apache-2.0 — no GPU required.
|
|
5
|
+
|
|
6
|
+
[](https://pypi.org/project/canto-tts/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://pypi.org/project/canto-tts/)
|
|
9
|
+
[](https://huggingface.co/typangaa/canto-tts-nano)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ✅ 狀態 / Status
|
|
14
|
+
|
|
15
|
+
> **Weights published on HuggingFace** — [`typangaa/canto-tts-nano`](https://huggingface.co/typangaa/canto-tts-nano).
|
|
16
|
+
> `canto-tts-nano-v1` 已經通過晒全部 quality gate(CER 11.82% / tone accuracy 84.22% / code-switch CER
|
|
17
|
+
> 13.87%,N=5 repeat eval),`CantoTTS()` 而家可以零參數自動下載呢個 checkpoint。**PyPI package 未發佈**——
|
|
18
|
+
> 而家請用 [Install](#install) 嘅 source install。
|
|
19
|
+
>
|
|
20
|
+
> Quality gate 數字全表見 [Limitations](#limitations--已知限制) / [Model & License](#model--license)。
|
|
21
|
+
|
|
22
|
+
See the [Limitations](#limitations--已知限制) section for full details.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 廣東話簡介
|
|
27
|
+
|
|
28
|
+
`canto-tts` 係一個開源嘅廣東話(香港)文字轉語音 Python SDK,底層用 ONNX Runtime,唔需要 GPU。模型係由 [MOSS-TTS-Nano](https://github.com/OpenMOSS/MOSS-TTS) (OpenMOSS, Apache-2.0) fine-tune 而成,支援廣東話拼音輸入(jyutping phoneme tokens),以及英文 code-switching(英文字保留原文,唔需要另外做音素轉換)。
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## English Description
|
|
33
|
+
|
|
34
|
+
`canto-tts` is an open-source Cantonese (Hong Kong) text-to-speech Python SDK.
|
|
35
|
+
It runs on CPU via ONNX Runtime (no GPU needed) and is fine-tuned from
|
|
36
|
+
[MOSS-TTS-Nano](https://github.com/OpenMOSS/MOSS-TTS) (0.1 B parameters, GPT-2 backbone, Apache-2.0).
|
|
37
|
+
|
|
38
|
+
Key facts:
|
|
39
|
+
- **Input**: jyutping-phoneme tokens (the library converts raw Hanzi for you via `canto_hk_g2p`).
|
|
40
|
+
- **English code-switching**: English words inside a Cantonese sentence are kept as orthography and pronounced naturally.
|
|
41
|
+
- **CPU-first**: default backend is ONNX Runtime; PyTorch is optional.
|
|
42
|
+
- **Single default voice**: unconditional generation — no voice cloning, no voice selection.
|
|
43
|
+
- **Weights**: auto-downloads from [typangaa/canto-tts-nano](https://huggingface.co/typangaa/canto-tts-nano) on first use (cached under `~/.cache/huggingface`) — see [Status](#-狀態--status) above.
|
|
44
|
+
- **Training data**: privately sourced (not released for copyright reasons) — only the model weights will be public (once quality gates are met).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
⚠️ **Not on PyPI yet.** Install from source for now:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/typangaa/canto-tts.git
|
|
54
|
+
cd canto-tts
|
|
55
|
+
pip install -e .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Once published, this will be `pip install canto-tts`.
|
|
59
|
+
|
|
60
|
+
Optional extras:
|
|
61
|
+
|
|
62
|
+
| Extra | What it adds |
|
|
63
|
+
|-------|-------------|
|
|
64
|
+
| `canto-tts[demo]` | FastAPI demo server (`canto-tts-demo` command) |
|
|
65
|
+
| `canto-tts[torch]` | PyTorch backend |
|
|
66
|
+
| `canto-tts[quality]` | `quality="best_of_n"` with the default ASR reranker (torch-free) — see [Quality Modes](#quality-modes-opt-in-inference-time-reranking) |
|
|
67
|
+
| `canto-tts[quality-sensevoice]` | `quality="best_of_n"` with the faster `asr_backend="sensevoice"` reranker (adds torch) |
|
|
68
|
+
| `canto-tts[dev]` | Dev / test tools |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Quickstart (Python SDK)
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from canto_tts import CantoTTS
|
|
76
|
+
|
|
77
|
+
tts = CantoTTS() # auto-downloads typangaa/canto-tts-nano from HuggingFace on first use
|
|
78
|
+
tts.synthesize("多謝晒,今日天氣幾好。", "hello.wav")
|
|
79
|
+
print("Saved to hello.wav")
|
|
80
|
+
|
|
81
|
+
# Code-switching: English words inside Cantonese are read naturally
|
|
82
|
+
tts.synthesize("我哋一齊去 IFC food court 食飯。", "codeswitching.wav")
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
To point at your own locally-exported ONNX bundle instead (e.g. a checkpoint you fine-tuned
|
|
86
|
+
yourself via [`scripts/export_onnx.py`](scripts/export_onnx.py)), pass `checkpoint=`:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
tts = CantoTTS(checkpoint="/path/to/your/exported/onnx_weights")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
See [`examples/quickstart.py`](examples/quickstart.py) for the full annotated version.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## CLI
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
canto-tts synthesize "多謝晒,今日天氣幾好。" -o hello.wav # auto-downloads weights on first use
|
|
100
|
+
|
|
101
|
+
# Point at your own local export instead
|
|
102
|
+
canto-tts synthesize "..." -o out.wav --backend onnx --checkpoint /path/to/onnx_weights
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Run `canto-tts --help` for all commands.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Quality Modes (opt-in inference-time reranking)
|
|
110
|
+
|
|
111
|
+
`synthesize()` 預設淨係跑一次 draw(最快)。兩種 opt-in `quality=` mode 都唔改 model 本身,淨係揀邊個 draw 好過留低:
|
|
112
|
+
|
|
113
|
+
- `quality="duration_filter"`:最多跑 `max_attempts`(default 3)次,揀 duration 最貼近 phoneme-length 預期嘅一個。捕捉最常見嘅兩種 catastrophic AR-codec 失敗(過早截斷 / 無限循環)。**唔使裝額外依賴**,一停到 in-range 嘅 draw 就即刻停,唔一定跑晒個 budget。
|
|
114
|
+
- `quality="best_of_n"`:跑 `best_of_n`(default 4)次,每次用本地 ASR model 轉錄,揀同輸入文字 character-error-rate(CER)最低嘅一個。捕捉 duration 篩唔到嘅問題(錯調、發音錯、code-switch 段落含糊)。需要 `canto-tts[quality]`(`asr_backend="whisper"`,default)或 `canto-tts[quality-sensevoice]`(`asr_backend="sensevoice"`)。
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
tts.synthesize(text, "out.wav", quality="duration_filter", max_attempts=3)
|
|
118
|
+
tts.synthesize(text, "out.wav", quality="best_of_n", best_of_n=4, asr_backend="whisper")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
canto-tts synthesize "..." -o out.wav --quality best_of_n --best-of-n 4 --asr-backend whisper
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`asr_backend` options for `quality="best_of_n"` (measured on this project's own generation output — mean CER = the ASR's own transcription error vs. known text, i.e. how sharp a reranking signal it gives, not a general-purpose ASR quality claim):
|
|
126
|
+
|
|
127
|
+
| `asr_backend` | Extra | Mean CER | Speed | Dependency footprint |
|
|
128
|
+
|---|---|---|---|---|
|
|
129
|
+
| `"whisper"` (default) | `canto-tts[quality]` | 0.036 (most accurate) | ~1.3s/candidate | torch-free (faster-whisper / CTranslate2, a Cantonese fine-tune of whisper-small) |
|
|
130
|
+
| `"sensevoice"` | `canto-tts[quality-sensevoice]` | 0.053 | ~0.18s/candidate (~7x faster) | pulls in torch + torchaudio; non-OSI ModelScope model license (commercial use permitted) |
|
|
131
|
+
|
|
132
|
+
See [`canto_tts/quality.py`](src/canto_tts/quality.py)'s module docstring for the full tradeoff writeup.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Web Demo (self-hosted)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install -e ".[demo]"
|
|
140
|
+
canto-tts-demo # auto-downloads weights on first use; set CANTO_TTS_CHECKPOINT to override
|
|
141
|
+
# → open http://localhost:8000
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The demo provides a browser-based UI with a text input and an audio player.
|
|
145
|
+
No API key required — designed for local / self-hosted use.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Docker
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# weights auto-download on first use; only edit docker/docker-compose.yml if you
|
|
153
|
+
# want to bind-mount your own local export and set CANTO_TTS_CHECKPOINT instead
|
|
154
|
+
docker compose -f docker/docker-compose.yml up
|
|
155
|
+
# → open http://localhost:8000
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
See [`docs/DEPLOY.md`](docs/DEPLOY.md) for full self-hosting instructions.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Limitations / 已知限制
|
|
163
|
+
|
|
164
|
+
| Item | Detail |
|
|
165
|
+
|------|--------|
|
|
166
|
+
| **Quality** | CER 11.82% / tone accuracy 84.22% / code-switch CER 13.87% on a 100-sentence gate set (N=5 repeat eval, Qwen3-ASR judge). Pure-English CER 9.7%. Voice-clone (zero-shot) CER 10.2%. |
|
|
167
|
+
| **Voice** | Single baked default voice in the published ONNX bundle. No runtime voice selection or cloning via the ONNX backend; the underlying checkpoint supports zero-shot voice cloning (see the torch backend / `--ref-audio`), a multi-voice picker for the ONNX path is planned. |
|
|
168
|
+
| **Language** | Cantonese (Hong Kong) + English code-switching only. **No Mandarin support** (intentionally not preserved). |
|
|
169
|
+
| **Training data** | Privately sourced — not released (copyright), regardless of weight-release status. |
|
|
170
|
+
| **Weights** | ✅ Published — [huggingface.co/typangaa/canto-tts-nano](https://huggingface.co/typangaa/canto-tts-nano). |
|
|
171
|
+
| **Input** | Converts Hanzi → jyutping internally via `canto_hk_g2p`. Homophones are disambiguated by the G2P model; errors are possible. |
|
|
172
|
+
| **Audio** | 48 000 Hz stereo WAV output (native codec rate — see `MOSS-Audio-Tokenizer-Nano`). |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Model & License
|
|
177
|
+
|
|
178
|
+
| | |
|
|
179
|
+
|--|--|
|
|
180
|
+
| **Base model** | [MOSS-TTS-Nano](https://github.com/OpenMOSS/MOSS-TTS) by OpenMOSS — 0.1 B params, GPT-2 backbone |
|
|
181
|
+
| **Fine-tune** | Hong Kong Cantonese, privately sourced training data |
|
|
182
|
+
| **Weights** | ✅ Published at [huggingface.co/typangaa/canto-tts-nano](https://huggingface.co/typangaa/canto-tts-nano) |
|
|
183
|
+
| **License** | [Apache-2.0](LICENSE) (inherited from MOSS-TTS-Nano) |
|
|
184
|
+
| **GitHub** | [github.com/typangaa/canto-tts](https://github.com/typangaa/canto-tts) |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
Issues and PRs welcome. Please open an issue before starting significant work.
|
|
191
|
+
See `CONTRIBUTING.md` (coming soon) for coding style and test conventions.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Citation
|
|
196
|
+
|
|
197
|
+
If you use this work in research, please cite the base model:
|
|
198
|
+
|
|
199
|
+
```bibtex
|
|
200
|
+
@misc{moss-tts-nano,
|
|
201
|
+
author = {OpenMOSS},
|
|
202
|
+
title = {MOSS-TTS-Nano},
|
|
203
|
+
year = {2024},
|
|
204
|
+
url = {https://github.com/OpenMOSS/MOSS-TTS}
|
|
205
|
+
}
|
|
206
|
+
```
|