mahmoudalyosify commited on
Commit
ec718bb
·
verified ·
1 Parent(s): 481b848

BA v0.1.0: unmodified VoxCPM2 weights, ba_config.json, ba_tts wheel, card, licences, synthetic-voice samples

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ samples/synthetic_man_reference.mp3 filter=lfs diff=lfs merge=lfs -text
37
+ samples/synthetic_woman_reference.mp3 filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BA Community License 1.0
2
+
3
+ Copyright (c) 2026 the owner of BA, the Hugging Face account mahmoudalyosify
4
+ (https://huggingface.co/mahmoudalyosify). All rights not granted below are reserved.
5
+
6
+ This is a plain-English licence. It has not yet been reviewed by a lawyer.
7
+
8
+ 1. What this licence covers
9
+
10
+ "BA" means the work of the BA project itself: the ba_tts code, its configuration files
11
+ (including ba_config.json), the text normalisers and their lexicons, the documentation and
12
+ model card, the audio samples, and the BA name, logo and other brand assets.
13
+
14
+ It does not cover third-party components. They keep their own licences (section 7).
15
+
16
+ 2. What you may do
17
+
18
+ If you follow the conditions below, you may, free of charge and for non-commercial purposes:
19
+ a. use BA;
20
+ b. modify BA;
21
+ c. share BA and your modified versions.
22
+
23
+ This licence does not let you use the BA name or logo to suggest that your work is BA or is
24
+ endorsed by its owner, beyond the attribution required below.
25
+
26
+ 3. Conditions
27
+
28
+ a. Attribution. Keep this licence and the copyright notice with every copy, say that your
29
+ work is based on BA, and link to https://huggingface.co/mahmoudalyosify/BA. If you changed
30
+ BA, say so.
31
+ b. Same terms. Share BA and anything you derive from it only under this licence.
32
+ c. Non-commercial. Commercial use needs the copyright holder's prior written permission.
33
+ Commercial use means use for, or as part of, anything sold, licensed, or offered for
34
+ money or other paid benefit, including paid services and advertising-funded products.
35
+ To ask for permission, contact the owner through the Hugging Face profile
36
+ https://huggingface.co/mahmoudalyosify.
37
+
38
+ 4. Voices and consent
39
+
40
+ You may only use a voice with BA if you are that speaker, or if you have that speaker's
41
+ explicit permission to clone their voice and to use it the way you intend.
42
+
43
+ 5. Forbidden uses
44
+
45
+ You may not use BA, or anything made with it:
46
+ a. to impersonate anyone;
47
+ b. for fraud, scams or deception, including making people believe a real person said
48
+ something they did not say;
49
+ c. to harass, threaten, defame or bully anyone;
50
+ d. to create sexual, intimate or otherwise harmful content with someone's voice without
51
+ their consent, or any non-consensual content;
52
+ e. to break the law.
53
+
54
+ 6. Watermark
55
+
56
+ BA puts an inaudible watermark in the audio it produces. Do not remove, alter, or try to
57
+ circumvent it, and do not help others do so. Do not publish or give to others BA audio made
58
+ with the watermark switched off.
59
+
60
+ 7. Third-party components
61
+
62
+ BA runs together with components made by others. Each keeps its own licence:
63
+ - VoxCPM2 model weights (OpenBMB): Apache License 2.0. The weights in the BA model
64
+ repository are unmodified; see LICENSE-VoxCPM2 and NOTICE.
65
+ - Whisper large-v3-turbo (OpenAI), used to transcribe reference recordings: MIT License.
66
+ - AudioSeal (Meta), the watermark model and code: MIT License.
67
+ - Other software packages BA depends on: their own licences.
68
+
69
+ Nothing in this licence restricts any right that those licences give you. You may use the
70
+ VoxCPM2 weights, Whisper and AudioSeal under their own licences, independently of BA. This
71
+ licence adds conditions only to BA's own work.
72
+
73
+ 8. Ending this licence
74
+
75
+ If you break this licence, your rights under it end automatically. They come back if you
76
+ fix the breach within 30 days of learning about it, unless the copyright holder has already
77
+ told you in writing that they will not.
78
+
79
+ 9. No warranty
80
+
81
+ BA is provided "as is", without warranty of any kind. The authors are not liable for any
82
+ claim, damage or other liability arising from BA or from its use. You are responsible for how
83
+ you use BA and for the audio you make with it.
LICENSE-VoxCPM2 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 OpenBMB
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.
NOTICE ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BA (https://huggingface.co/mahmoudalyosify/BA)
2
+ BA's own work (the ba_tts code, ba_config.json, the normaliser lexicons, the model card, the
3
+ samples and the brand assets) is licensed under the BA Community License 1.0 (LICENSE).
4
+
5
+ VoxCPM2 model files (unmodified)
6
+ Copyright OpenBMB. Licensed under the Apache License, Version 2.0 (full text: LICENSE-VoxCPM2).
7
+ Source: https://huggingface.co/openbmb/VoxCPM2 at commit 7936080b41163874f38610f46f438e2c0757f9fd
8
+ Files: config.json, model.safetensors, audiovae.pth, tokenizer.json, tokenizer_config.json, special_tokens_map.json, tokenization_voxcpm2.py
9
+ These files are byte-for-byte copies of the files at that commit; they were not modified,
10
+ fine-tuned, converted or quantised. Not copied from the source: README.md (this repository's
11
+ README.md is the BA model card) and .gitattributes.
12
+ LICENSE-VoxCPM2 is OpenBMB's Apache-2.0 licence file as shipped in the voxcpm 2.0.3 package
13
+ on PyPI (https://github.com/OpenBMB/VoxCPM); the openbmb/VoxCPM2 model repository declares
14
+ apache-2.0 in its model card and carries no licence file of its own.
15
+
16
+ Components downloaded at run time (not in this repository)
17
+ Whisper large-v3-turbo (OpenAI), MIT License: openai/whisper-large-v3-turbo at 41f01f3fe87f28c78e2fbf8b568835947dd65ed9
18
+ AudioSeal (Meta), MIT License: facebook/audioseal at 3c19eba53390776cf2cc9ed5f6c9ac67ce72ecba (weights); audioseal 0.2.1 on PyPI (code)
README.md ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: ba-community-license-1.0
4
+ license_link: LICENSE
5
+ language:
6
+ - ar
7
+ - arz
8
+ - en
9
+ - fr
10
+ pipeline_tag: text-to-speech
11
+ base_model: openbmb/VoxCPM2
12
+ tags:
13
+ - voice-cloning
14
+ - text-to-speech
15
+ - tts
16
+ - egyptian-arabic
17
+ - arabic
18
+ - english
19
+ - french
20
+ - zero-shot-voice-cloning
21
+ - audio-watermarking
22
+ - consent
23
+ thumbnail: https://huggingface.co/mahmoudalyosify/BA/resolve/main/assets/social-card.png
24
+ ---
25
+
26
+ ![BA: Your Voice. Your Identity.](https://huggingface.co/mahmoudalyosify/BA/resolve/main/assets/banner.png)
27
+
28
+ # BA · Your Voice. Your Identity.
29
+
30
+ BA speaks any text in your own voice, from a 10–15 second recording of you: **Egyptian Arabic**, **English**, and **French (beta)**. Every output carries an inaudible watermark. Use only your own voice or a voice whose owner has given you explicit permission.
31
+
32
+ **Try it:** [the BA Space](https://huggingface.co/spaces/mahmoudalyosify/BA) (record or upload your voice, tick the consent box, type, listen).
33
+
34
+ ## What BA is, and what it is built from
35
+
36
+ BA v0.1.0 is two things:
37
+
38
+ 1. **The VoxCPM2 weights, unmodified.** VoxCPM2 is a 2B-parameter, 48 kHz multilingual text-to-speech model by OpenBMB, released under Apache-2.0. The weight and tokenizer files in this repository are byte-for-byte copies of [`openbmb/VoxCPM2`](https://huggingface.co/openbmb/VoxCPM2) at commit `7936080b41163874f38610f46f438e2c0757f9fd` (see `NOTICE`). BA v0.1 does **not** fine-tune or otherwise change them.
39
+ 2. **The BA engine** (`ba_tts`, this repository's wheel), which decides how the model is driven:
40
+ - prepares the reference recording (mono, trimmed to speech, loudness-normalised, the cleanest stretch chosen; noisy, clipped or too-short audio is refused with a clear message);
41
+ - transcribes the reference with Whisper large-v3-turbo when you give no transcript, and clones with the reference *and* its transcript;
42
+ - writes digits, times, prices, percentages and symbols as Egyptian, English or French words, and writes common English loanwords in Egyptian text in Arabic script;
43
+ - splits long text at sentence boundaries, checks every chunk (duration against text length, empty or clipped audio) and regenerates failures with a new seed;
44
+ - loudness-normalises the result and embeds an [AudioSeal](https://huggingface.co/facebook/audioseal) watermark.
45
+
46
+ VoxCPM2 was chosen in a bake-off of eight voice-cloning systems on Egyptian Arabic (below). Of the systems eligible as a base (permissively licensed weights with documented training data), it was the only one whose Egyptian output a dialect classifier labelled as Egyptian most of the time.
47
+
48
+ ## Quick start
49
+
50
+ Python 3.10 or newer. A CUDA GPU is strongly recommended (peak GPU memory in our runs: 8.11 GB allocated, 10.99 GB reserved); CPU works but is slow.
51
+
52
+ ```bash
53
+ pip install https://huggingface.co/mahmoudalyosify/BA/resolve/main/ba_tts-0.1.0-py3-none-any.whl
54
+ ```
55
+
56
+ ```python
57
+ import soundfile as sf
58
+ from ba_tts import BA, detect_watermark
59
+
60
+ ba = BA.from_pretrained("mahmoudalyosify/BA") # downloads the weights (about 5 GB) on first use
61
+ voice = ba.create_voice("my_voice.wav", language="arz") # 10-15 s of YOUR voice; transcript optional
62
+
63
+ sr, wav = ba.speak("الميعاد اتغير للساعة 7:30، والتذكرة بقت ب 150 جنيه.", voice, language="arz")
64
+ sf.write("out.wav", wav, sr) # 48 kHz, watermarked
65
+
66
+ print(detect_watermark(wav, sr)) # {'watermarked': True, 'score': ..., 'bits_match': ...}
67
+ ```
68
+
69
+ `language` is `"arz"` (Egyptian Arabic), `"en"` or `"fr"`. You can pass several recordings (`create_voice(["a.wav", "b.wav"])`), give the transcript yourself (`transcript="..."`), save a voice for later (`voice.save("me.npz")`, `Voice.load("me.npz")`), and set `seed`, `cfg_value` or `inference_timesteps` in `speak`. Text longer than one chunk is split and joined automatically (up to 5,000 characters).
70
+
71
+ Command line:
72
+
73
+ ```bash
74
+ ba-tts --ref my_voice.wav --lang arz --text "أنا رايح الشغل دلوقتي وهرجع على المغرب." --out out.wav
75
+ ba-tts --ref my_voice.wav --lang en --text-file speech.txt --out speech.wav --save-voice me.npz
76
+ ba-tts --detect out.wav # is this file a BA output?
77
+ ```
78
+
79
+ ## Languages
80
+
81
+ A language is listed only if the full system passes gate G3 on held-out texts: failure rate at most 5%; intelligibility within a fixed bound; speaker similarity at least 80% of the similarity between two real recordings of the same speaker; and, for Egyptian, a dialect-ID share at least 60% of the share measured on real colloquial Egyptian speech (otherwise it would be listed only as "Arabic").
82
+
83
+ | Language | Code | Status | Failure rate | Intelligibility | Speaker similarity (ECAPA) | Egyptian dialect share |
84
+ |---|---|---|---|---|---|---|
85
+ | Egyptian Arabic | `arz` | listed | 0/130 | CER 0.030 (bound 0.171) | 0.769 (bar 0.696) | 0.889 (bar 0.54) |
86
+ | English | `en` | listed | 0/64 | WER 0.003 (bound 0.08) | 0.779 (bar 0.699) | – |
87
+ | French | `fr` | **beta** | 0/82 | WER 0.030 (bound 0.10) | 0.792 (bar 0.720) | – |
88
+
89
+ French passed the same gate but is marked beta: it rests on three French reference voices, its generation settings were not tuned separately (it uses the English values), and it is the newest language. Cross-language use (an Egyptian voice speaking English or French) works, with lower similarity (see Limitations).
90
+
91
+ ## Measured results
92
+
93
+ ### Evaluation set
94
+
95
+ - **Reference voices:** 12 speakers from [FLEURS](https://huggingface.co/datasets/google/fleurs) (CC-BY-4.0): 6 Egyptian (`ar_eg`, 3 male and 3 female), 3 American English, 3 French; clean clips of 8–15 s. They are used for measurement only; neither these clips nor anything cloned from them is published.
96
+ - **Texts:** 40 colloquial Egyptian sentences (everyday talk, questions, numbers and dates, long sentences, a diacritised copy of ten), 20 English, 20 French, 6 Arabic–English code-switched sentences, and one passage of about 120 words per language. Some texts were used to tune the engine; **every number below excludes them** (held-out texts only). BA and raw VoxCPM2 are compared on the same texts, voices and seeds.
97
+ - **Automatic metrics, each calibrated on real speech:**
98
+ - words: CER (Egyptian) and WER (English, French) from Whisper large-v3 after normalisation. On real speech the same ASR gives CER 0.071 on colloquial Egyptian and WER 0.052 (English) and 0.062 (French) on FLEURS;
99
+ - voice: cosine similarity of ECAPA-TDNN speaker embeddings between the reference and the output. Two different real clips of the same speaker score 0.870 (Egyptian), 0.874 (English), 0.900 (French); clips of different speakers 0.084–0.184;
100
+ - dialect: share of outputs that the [`badrex/mms-300m-arabic-dialect-identifier`](https://huggingface.co/badrex/mms-300m-arabic-dialect-identifier) classifier labels Egyptian. colloquial Egyptian speech: 0.90 (lahgtna test set; the gate's reference) and 0.98 (NileTTS); Egyptians reading Modern Standard Arabic (FLEURS): 0.34;
101
+ - naturalness: DNSMOS P.808 (real speech: 3.515–3.990);
102
+ - failures: empty, cut off, or a duration far outside what the text length implies.
103
+
104
+ ### BA engine vs raw VoxCPM2 (held-out texts)
105
+
106
+ | Condition | n | Error BA | Error raw | Similarity BA | Similarity raw | Egyptian share BA | Egyptian share raw | DNSMOS BA | DNSMOS raw |
107
+ |---|---|---|---|---|---|---|---|---|---|
108
+ | Egyptian sentences (CER) | 72 | **0.030** | 0.069 | **0.769** | 0.713 | **0.889** | 0.819 | 3.527 | 3.349 |
109
+ | Egyptian with digits (CER) | 18 | **0.073** | 0.122 | 0.777 | 0.730 | 0.833 | 0.667 | 3.562 | 3.313 |
110
+ | Egyptian, diacritised (CER) | 20 | 0.040 | 0.045 | 0.768 | 0.694 | 0.600 | 0.400 | 3.550 | 3.410 |
111
+ | Arabic–English code-switch (CER) | 18 | 0.284 | 0.274 | 0.773 | 0.739 | 0.944 | 0.722 | 3.515 | 3.387 |
112
+ | English (WER) | 42 | 0.003 | 0.000 | **0.779** | 0.655 | – | – | 3.861 | 3.702 |
113
+ | French (WER) | 60 | 0.030 | 0.030 | 0.792 | 0.759 | – | – | 3.727 | 3.631 |
114
+ | Egyptian voice → English (WER) | 20 | 0.000 | 0.000 | 0.730 | 0.639 | – | – | 3.603 | 3.529 |
115
+ | Egyptian voice → French (WER) | 20 | 0.062 | 0.137 | 0.696 | 0.570 | – | – | 3.576 | 3.385 |
116
+ | ~120-word Egyptian passage (CER) | 2 | 0.040 | 0.033 | 0.823 | 0.762 | 1.000 | 1.000 | 3.558 | 3.522 |
117
+ | ~120-word English passage (WER) | 2 | 0.000 | 0.000 | 0.807 | 0.703 | – | – | 3.942 | 3.762 |
118
+ | ~120-word French passage (WER) | 2 | 0.010 | 0.010 | 0.839 | 0.797 | – | – | 3.843 | 3.781 |
119
+
120
+ Failures: none for BA in any condition; raw VoxCPM2 produced 2 empty English outputs. On the code-switch set the plain CER is slightly worse for BA because BA writes loanwords in Arabic script, which changes what Whisper writes; with both scripts mapped to one form, BA scores 0.074 against 0.084 for raw VoxCPM2. Raw VoxCPM2 would fail G3 for English on similarity (0.655); BA passes.
121
+
122
+ ### Why VoxCPM2 (bake-off, Egyptian sentences, 3 voices × 32 sentences)
123
+
124
+ | System (raw, before the BA engine) | Weights licence | Egyptian CER | Labelled Egyptian | Similarity (ECAPA) | Failure rate (all conditions) |
125
+ |---|---|---|---|---|---|
126
+ | Chatterbox Multilingual V3 | MIT | 0.035 | 0.208 | 0.706 | 6/324 |
127
+ | Chatterbox Multilingual V2 | MIT | 0.056 | 0.167 | 0.739 | 10/324 |
128
+ | **VoxCPM2** | Apache-2.0 | 0.065 | **0.823** | 0.714 | 3/324 |
129
+
130
+ Chatterbox says the right words with the wrong dialect (mostly labelled Levantine, Gulf or MSA). Only permissively licensed weights were eligible; non-commercial systems and community fine-tunes with undocumented training data were measured for reference only.
131
+
132
+ ### Speed and memory (NVIDIA A40, no `torch.compile`, as on ZeroGPU)
133
+
134
+ | | |
135
+ |---|---|
136
+ | Model load | 19.9 s |
137
+ | Preparing a voice from a 10 s clip | 0.3 s |
138
+ | Egyptian sentence, 23 words → 8.25 s of audio | 7.89 s |
139
+ | Egyptian passage, 118 words → 39.99 s of audio | 38.03 s |
140
+ | English passage, 158 words → 41.22 s of audio | 39.0 s |
141
+ | Peak GPU memory (allocated / reserved) | 8.08 / 10.35 GB |
142
+
143
+ With `torch.compile` (the default on a plain CUDA GPU) the 118-word Egyptian passage took 27.49 s. On 2 CPU threads raw VoxCPM2 ran at about 30× real time in the bake-off, so a GPU is needed for practical use.
144
+
145
+ ### Watermark detection
146
+
147
+ | Audio | n | Detected |
148
+ |---|---|---|
149
+ | BA output, 48 kHz WAV | 60 | 60 |
150
+ | BA output, MP3 128 kbit/s | 60 | 60 |
151
+ | BA output, MP3 64 kbit/s | 60 | 60 |
152
+ | BA output, resampled to 16 kHz | 60 | 60 |
153
+ | Raw VoxCPM2 output (no watermark) | 60 | 0 |
154
+ | Real speech | 53 | 0 |
155
+
156
+ ## How it works
157
+
158
+ ```
159
+ your recording(s) ──► reference preparation ──► Whisper large-v3-turbo transcript (if none given)
160
+ │ │
161
+ └──────► VoxCPM2 prompt cache (reference audio + transcript)
162
+ text ──► language normaliser (numbers, symbols, loanwords) ──► sentence chunks
163
+ │
164
+ VoxCPM2 generation per chunk, fixed voice and seed ◄───┘
165
+ │
166
+ chunk check (duration vs text length, empty, clipped) ──► retry with a new seed (up to 2)
167
+ │
168
+ join with pauses ──► loudness normalisation (−20 LUFS) ──► AudioSeal watermark ──► 48 kHz audio
169
+ ```
170
+
171
+ The per-language generation settings (guidance 2.0, 10 steps), the chunk length, the reference noise thresholds and the loanword policy were chosen by measurement on the tuning texts. They are recorded in `ba_config.json`, which also pins the revisions of the ASR model and the watermark weights.
172
+
173
+ ## Limitations
174
+
175
+ - **No native-listener review yet.** Nobody has yet listened systematically to BA's outputs; the owner's blind listening test of the bake-off is pending. Every quality number on this card is automatic.
176
+ - **Automatic metrics have blind spots.** One dialect classifier decides "Egyptian"; it labels Egyptians reading Modern Standard Arabic as Egyptian only 34% of the time, and the six Egyptian reference voices are FLEURS clips of read MSA, not colloquial speech. DNSMOS was trained on English and is a weak judge of Arabic. Similarity is one embedding model (ECAPA).
177
+ - **Digits are measured by ASR.** Whisper writes most spoken numbers back as digits, so the digit-sentence CER shows whether the right number was said, not whether it was said the Egyptian way. The normaliser itself is covered by unit tests.
178
+ - **Small sets.** 18 digit sentences, 18 code-switched utterances and 2 passages per language; French rests on 3 voices.
179
+ - **Cross-language similarity is lower.** An Egyptian voice speaking French reaches similarity 0.696, exactly 80% of the Egyptian same-speaker ceiling (0.870); speaking English, 0.730. Cross-language use was not part of the gate.
180
+ - **Code-switching.** Inside Egyptian text, a fixed list of common English loanwords is written in Arabic script and short upper-case acronyms are spelled letter by letter; other Latin words are left as written and may be mispronounced.
181
+ - **Speed.** Timings are on an A40. The Space runs on shared ZeroGPU hardware, where speed and queueing differ. CPU-only use is very slow.
182
+ - **Reference quality matters.** Noisy, reverberant, clipped or very short recordings are refused or give a weaker likeness.
183
+ - **No fine-tune.** BA v0.1 uses the base weights; anything VoxCPM2 cannot say well, BA cannot either.
184
+
185
+ ## Responsible use
186
+
187
+ - **Consent.** Use only your own voice, or a voice whose owner has given you explicit permission for this use. Do not impersonate anyone, deceive, defraud, harass, or make non-consensual content. These terms are part of the licence.
188
+ - **Watermark.** Every BA output carries an inaudible AudioSeal watermark with the 16-bit message "BA". Anyone can check a file: `ba-tts --detect file.wav`, or `detect_watermark(wav, sr)` in Python. Detection survived MP3 at 64 kbit/s and resampling in our tests; it was not tested against deliberate removal attacks. Do not remove or circumvent it, and do not publish audio made with the watermark switched off (`watermark=False` exists for research measurement).
189
+ - **The Space.** Generation is blocked until you tick the consent box. Uploads are processed in a per-request temporary directory that is deleted after the request, together with Gradio's own copies; the voice prepared from them lives only in your browser session's memory. Generated audio sits in Gradio's cache only so the player and download work, and is swept every few minutes. No text or audio is logged; flagging and analytics are off. Nothing you upload is used for training.
190
+
191
+ ## Audio samples (synthetic voices)
192
+
193
+ These voices are **synthetic**: they belong to no real person. Each reference voice was created with VoxCPM2's voice-design mode from a text description, then cloned by BA from that reference alone (the reference was transcribed automatically, as in the Space). No real person's voice is published here.
194
+
195
+ | Voice | Reference (voice design) | Egyptian 1 | Egyptian 2 | English | French |
196
+ |---|---|---|---|---|---|
197
+ | Synthetic man (“an Egyptian man in his thirties, warm, calm voice”) | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_man_reference.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_man_arz1.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_man_arz2.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_man_en.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_man_fr.mp3"></audio> |
198
+ | Synthetic woman (“an Egyptian woman in her thirties, clear, friendly voice”) | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_woman_reference.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_woman_arz1.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_woman_arz2.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_woman_en.mp3"></audio> | <audio controls src="https://huggingface.co/mahmoudalyosify/BA/resolve/main/samples/synthetic_woman_fr.mp3"></audio> |
199
+
200
+ Texts: Egyptian 1 «أنا رايح الشغل دلوقتي وهرجع على المغرب إن شاء الله.» · Egyptian 2 «الميعاد اتغير للساعة 7:30، والتذكرة بقت ب 150 جنيه.» · English “The meeting has been moved to Thursday afternoon, so please update your calendar.” · French « Le concert commence à 21h, mais il vaut mieux arriver un peu en avance. »
201
+
202
+ Each sample was generated once with the default seed. The design seed of each voice was the first one, in a fixed list, that gave a reference of 8–12 s which the dialect classifier labelled Egyptian. All samples, references included, carry the watermark. The samples illustrate; they are not part of the measurements above.
203
+
204
+ ## Licence
205
+
206
+ - **BA's own work** (the `ba_tts` code, `ba_config.json`, the normaliser lexicons, this card and the docs, the samples, the BA name and brand assets): **BA Community License 1.0** (`LICENSE`). In short: free for non-commercial use, modification and sharing, with attribution and under the same terms; commercial use only with the owner's written permission (contact through the [Hugging Face profile](https://huggingface.co/mahmoudalyosify)); use a voice only if it is yours or you have the speaker's explicit permission; no impersonation, fraud, deception, harassment or non-consensual content; do not remove or circumvent the watermark; no warranty.
207
+ - **Third-party components keep their own licences:** the VoxCPM2 weights are Apache-2.0 (`LICENSE-VoxCPM2`, `NOTICE`), Whisper large-v3-turbo is MIT, AudioSeal is MIT. Nothing in the BA licence restricts the rights those licences give you; you may use the VoxCPM2 weights under Apache-2.0 independently of BA.
208
+ - The licence has not yet been reviewed by a lawyer.
209
+
210
+ ## Files in this repository
211
+
212
+ | File | What |
213
+ |---|---|
214
+ | `model.safetensors`, `audiovae.pth`, `config.json`, `tokenizer.json`, `tokenizer_config.json`, `special_tokens_map.json`, `tokenization_voxcpm2.py` | VoxCPM2, unmodified (OpenBMB, Apache-2.0) |
215
+ | `ba_config.json` | BA version, pinned revisions (VoxCPM2, Whisper, AudioSeal), per-language defaults |
216
+ | `ba_tts-0.1.0-py3-none-any.whl` | the BA engine and CLI |
217
+ | `LICENSE`, `LICENSE-VoxCPM2`, `NOTICE` | licences and attribution |
218
+ | `samples/`, `assets/` | synthetic-voice samples, banner and social card |
219
+
220
+ ## Citations
221
+
222
+ ```bibtex
223
+ @article{voxcpm2_2026,
224
+ title = {VoxCPM2: Tokenizer-Free TTS for Multilingual Speech Generation, Creative Voice Design, and True-to-Life Cloning},
225
+ author = {VoxCPM Team},
226
+ journal = {GitHub},
227
+ year = {2026}
228
+ }
229
+ @article{voxcpm2025,
230
+ title = {VoxCPM: Tokenizer-Free TTS for Context-Aware Speech Generation and True-to-Life Voice Cloning},
231
+ author = {Zhou, Yixuan and Zeng, Guoyang and Liu, Xin and Li, Xiang and Yu, Renjie and Wang, Ziyang and Ye, Runchuan and Sun, Weiyue and Gui, Jiancheng and Li, Kehan and Wu, Zhiyong and Liu, Zhiyuan},
232
+ journal = {arXiv preprint arXiv:2509.24650},
233
+ year = {2025}
234
+ }
235
+ @article{radford2022whisper,
236
+ title = {Robust Speech Recognition via Large-Scale Weak Supervision},
237
+ author = {Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
238
+ journal = {arXiv preprint arXiv:2212.04356},
239
+ year = {2022}
240
+ }
241
+ @inproceedings{sanroman2024audioseal,
242
+ title = {Proactive Detection of Voice Cloning with Localized Watermarking},
243
+ author = {San Roman, Robin and Fernandez, Pierre and Elsahar, Hady and D{\'e}fossez, Alexandre and Furon, Teddy and Tran, Tuan},
244
+ booktitle = {Proceedings of the 41st International Conference on Machine Learning (ICML)},
245
+ year = {2024}
246
+ }
247
+ @article{conneau2022fleurs,
248
+ title = {FLEURS: Few-shot Learning Evaluation of Universal Representations of Speech},
249
+ author = {Conneau, Alexis and Ma, Min and Khanuja, Simran and Zhang, Yu and Axelrod, Vera and Dalmia, Siddharth and Riesa, Jason and Rivera, Clara and Bapna, Ankur},
250
+ journal = {arXiv preprint arXiv:2205.12446},
251
+ year = {2022}
252
+ }
253
+ ```
assets/banner.png ADDED
assets/social-card.png ADDED
audiovae.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94b5d51e107e0507d4acc976cfdadb64edd6fd06d1f751dadbf2fd1594274bf1
3
+ size 376951122
ba_config.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "ba-config-1",
3
+ "ba_version": "0.1.0",
4
+ "base_model": {
5
+ "repo_id": "openbmb/VoxCPM2",
6
+ "revision": "7936080b41163874f38610f46f438e2c0757f9fd",
7
+ "licence": "Apache-2.0",
8
+ "weights_modified": false,
9
+ "files": [
10
+ "config.json",
11
+ "model.safetensors",
12
+ "audiovae.pth",
13
+ "tokenizer.json",
14
+ "tokenizer_config.json",
15
+ "special_tokens_map.json",
16
+ "tokenization_voxcpm2.py"
17
+ ]
18
+ },
19
+ "asr": {
20
+ "repo_id": "openai/whisper-large-v3-turbo",
21
+ "revision": "41f01f3fe87f28c78e2fbf8b568835947dd65ed9",
22
+ "licence": "MIT",
23
+ "use": "transcribes the reference recording when no transcript is given"
24
+ },
25
+ "watermark": {
26
+ "repo_id": "facebook/audioseal",
27
+ "revision": "3c19eba53390776cf2cc9ed5f6c9ac67ce72ecba",
28
+ "licence": "MIT",
29
+ "generator": "generator_base.pth",
30
+ "detector": "detector_base.pth",
31
+ "message": "BA",
32
+ "message_bits": [
33
+ 0,
34
+ 1,
35
+ 0,
36
+ 0,
37
+ 0,
38
+ 0,
39
+ 1,
40
+ 0,
41
+ 0,
42
+ 1,
43
+ 0,
44
+ 0,
45
+ 0,
46
+ 0,
47
+ 0,
48
+ 1
49
+ ]
50
+ },
51
+ "languages": {
52
+ "arz": "Egyptian Arabic",
53
+ "en": "English",
54
+ "fr": "French (beta)"
55
+ },
56
+ "defaults": {
57
+ "per_language": {
58
+ "arz": {
59
+ "cfg_value": 2.0,
60
+ "inference_timesteps": 10,
61
+ "max_chunk_chars": 1000,
62
+ "chars_per_sec_band": [
63
+ 4.006,
64
+ 19.261
65
+ ],
66
+ "latin_words": "arabic"
67
+ },
68
+ "en": {
69
+ "cfg_value": 2.0,
70
+ "inference_timesteps": 10,
71
+ "max_chunk_chars": 1000,
72
+ "chars_per_sec_band": [
73
+ 4.462,
74
+ 22.389
75
+ ]
76
+ },
77
+ "fr": {
78
+ "cfg_value": 2.0,
79
+ "inference_timesteps": 10,
80
+ "max_chunk_chars": 1000,
81
+ "chars_per_sec_band": [
82
+ 6.55,
83
+ 31.638
84
+ ]
85
+ }
86
+ },
87
+ "seed": 1234,
88
+ "max_text_chars": 5000,
89
+ "max_retries_per_chunk": 2,
90
+ "pauses_s": {
91
+ "sentence": 0.3,
92
+ "clause": 0.15,
93
+ "paragraph": 0.6
94
+ },
95
+ "output_lufs": -20.0,
96
+ "reference": {
97
+ "sample_rate": 16000,
98
+ "min_speech_s": 3.0,
99
+ "target_s": [
100
+ 6.0,
101
+ 15.0
102
+ ],
103
+ "noise_reject_db": 25.9,
104
+ "noise_warn_db": 32.7,
105
+ "clip_max_ratio": 0.00625,
106
+ "lufs": -20.0
107
+ }
108
+ },
109
+ "read_at_load": [
110
+ "defaults.per_language.*.cfg_value",
111
+ "defaults.per_language.*.inference_timesteps",
112
+ "defaults.per_language.*.max_chunk_chars",
113
+ "asr.repo_id",
114
+ "asr.revision"
115
+ ]
116
+ }
ba_tts-0.1.0-py3-none-any.whl ADDED
Binary file (45.7 kB). View file
 
config.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "voxcpm2",
3
+ "lm_config": {
4
+ "bos_token_id": 1,
5
+ "eos_token_id": 2,
6
+ "hidden_size": 2048,
7
+ "intermediate_size": 6144,
8
+ "max_position_embeddings": 32768,
9
+ "num_attention_heads": 16,
10
+ "num_hidden_layers": 28,
11
+ "num_key_value_heads": 2,
12
+ "rms_norm_eps": 1e-05,
13
+ "rope_theta": 10000,
14
+ "kv_channels": 128,
15
+ "rope_scaling": {
16
+ "type": "longrope",
17
+ "long_factor": [0.9977997200264581, 1.014658295992452, 1.0349680404997148, 1.059429246056193, 1.0888815016813513, 1.1243301355211495, 1.166977103606075, 1.2182568066927284, 1.2798772354275727, 1.3538666751582975, 1.4426259039919596, 1.5489853358570191, 1.6762658237220625, 1.8283407612492941, 2.0096956085876183, 2.225478927469756, 2.481536379650452, 2.784415934557119, 3.1413289096347365, 3.560047844772632, 4.048719380066383, 4.615569542115128, 5.2684819496549835, 6.014438591970396, 6.858830049237097, 7.804668263503327, 8.851768731513417, 9.99600492938444, 11.228766118181639, 12.536757560834843, 13.902257701387796, 15.303885189125953, 16.717837610115794, 18.119465097853947, 19.484965238406907, 20.792956681060105, 22.02571786985731, 23.16995406772833, 24.217054535738416, 25.16289275000465, 26.007284207271347, 26.753240849586767, 27.40615325712662, 27.973003419175363, 28.461674954469114, 28.880393889607006, 29.237306864684626, 29.540186419591297, 29.79624387177199, 30.01202719065413, 30.193382037992453, 30.34545697551969, 30.47273746338473, 30.579096895249787, 30.66785612408345, 30.741845563814174, 30.80346599254902, 30.85474569563567, 30.897392663720595, 30.932841297560394, 30.962293553185553, 30.986754758742034, 31.007064503249293, 31.02392307921529],
18
+ "short_factor": [0.9977997200264581, 1.014658295992452, 1.0349680404997148, 1.059429246056193, 1.0888815016813513, 1.1243301355211495, 1.166977103606075, 1.2182568066927284, 1.2798772354275727, 1.3538666751582975, 1.4426259039919596, 1.5489853358570191, 1.6762658237220625, 1.8283407612492941, 2.0096956085876183, 2.225478927469756, 2.481536379650452, 2.784415934557119, 3.1413289096347365, 3.560047844772632, 4.048719380066383, 4.615569542115128, 5.2684819496549835, 6.014438591970396, 6.858830049237097, 7.804668263503327, 8.851768731513417, 9.99600492938444, 11.228766118181639, 12.536757560834843, 13.902257701387796, 15.303885189125953, 16.717837610115794, 18.119465097853947, 19.484965238406907, 20.792956681060105, 22.02571786985731, 23.16995406772833, 24.217054535738416, 25.16289275000465, 26.007284207271347, 26.753240849586767, 27.40615325712662, 27.973003419175363, 28.461674954469114, 28.880393889607006, 29.237306864684626, 29.540186419591297, 29.79624387177199, 30.01202719065413, 30.193382037992453, 30.34545697551969, 30.47273746338473, 30.579096895249787, 30.66785612408345, 30.741845563814174, 30.80346599254902, 30.85474569563567, 30.897392663720595, 30.932841297560394, 30.962293553185553, 30.986754758742034, 31.007064503249293, 31.02392307921529],
19
+ "original_max_position_embeddings": 32768
20
+ },
21
+ "vocab_size": 73448,
22
+ "use_mup": false,
23
+ "scale_emb": 12,
24
+ "dim_model_base": 256,
25
+ "scale_depth": 1.4
26
+ },
27
+ "patch_size": 4,
28
+ "feat_dim": 64,
29
+ "scalar_quantization_latent_dim": 512,
30
+ "scalar_quantization_scale": 9,
31
+ "residual_lm_num_layers": 8,
32
+ "residual_lm_no_rope": true,
33
+ "encoder_config": {
34
+ "hidden_dim": 1024,
35
+ "ffn_dim": 4096,
36
+ "num_heads": 16,
37
+ "num_layers": 12,
38
+ "kv_channels": 128
39
+ },
40
+ "dit_config": {
41
+ "hidden_dim": 1024,
42
+ "ffn_dim": 4096,
43
+ "num_heads": 16,
44
+ "num_layers": 12,
45
+ "kv_channels": 128,
46
+ "mean_mode": false,
47
+ "cfm_config": {
48
+ "sigma_min": 1e-06,
49
+ "solver": "euler",
50
+ "t_scheduler": "log-norm",
51
+ "inference_cfg_rate": 2.0
52
+ }
53
+ },
54
+ "audio_vae_config": {
55
+ "encoder_dim": 128,
56
+ "encoder_rates": [2, 5, 8, 8],
57
+ "latent_dim": 64,
58
+ "decoder_dim": 2048,
59
+ "decoder_rates": [8, 6, 5, 2, 2, 2],
60
+ "sr_bin_boundaries": [20000, 30000, 40000],
61
+ "sample_rate": 16000,
62
+ "out_sample_rate": 48000
63
+ },
64
+ "max_length": 8192,
65
+ "device": "cuda",
66
+ "dtype": "bfloat16"
67
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7f964cfa9da23653baec6e6f7750719977ad944ed9f95fe52fe3a620506891d
3
+ size 4580080592
samples/synthetic_man_arz1.mp3 ADDED
Binary file (50.7 kB). View file
 
samples/synthetic_man_arz2.mp3 ADDED
Binary file (77.6 kB). View file
 
samples/synthetic_man_en.mp3 ADDED
Binary file (73 kB). View file
 
samples/synthetic_man_fr.mp3 ADDED
Binary file (70.7 kB). View file
 
samples/synthetic_man_reference.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b35f8bd2357a8668415226a14cd34e8e28494717ed0c07e3b6380b5ca0b8ad54
3
+ size 148269
samples/synthetic_woman_arz1.mp3 ADDED
Binary file (54.6 kB). View file
 
samples/synthetic_woman_arz2.mp3 ADDED
Binary file (71.5 kB). View file
 
samples/synthetic_woman_en.mp3 ADDED
Binary file (68 kB). View file
 
samples/synthetic_woman_fr.mp3 ADDED
Binary file (61.9 kB). View file
 
samples/synthetic_woman_reference.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36ab0c608f54c2856ad86ed751e45ade97483506a2434f99fc77af410a091efb
3
+ size 135981
special_tokens_map.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "<|im_end|>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": "<|im_start|>",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ },
17
+ {
18
+ "content": "<|tool_call|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ {
25
+ "content": "<|execute_start|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ {
32
+ "content": "<|execute_end|>",
33
+ "lstrip": false,
34
+ "normalized": false,
35
+ "rstrip": false,
36
+ "single_word": false
37
+ },
38
+ {
39
+ "content": "<|fim_prefix|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false
44
+ },
45
+ {
46
+ "content": "<|fim_middle|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false
51
+ },
52
+ {
53
+ "content": "<|fim_suffix|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false
58
+ }
59
+ ],
60
+ "bos_token": {
61
+ "content": "<s>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false
66
+ },
67
+ "eos_token": {
68
+ "content": "</s>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false
73
+ },
74
+ "unk_token": {
75
+ "content": "<unk>",
76
+ "lstrip": false,
77
+ "normalized": false,
78
+ "rstrip": false,
79
+ "single_word": false
80
+ }
81
+ }
tokenization_voxcpm2.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Custom tokenizer for VoxCPM2 that splits multi-character Chinese tokens.
2
+
3
+ VoxCPM2 was trained with ``mask_multichar_chinese_tokens`` which splits
4
+ multi-character Chinese tokens (e.g. "你好" -> ["你", "好"]) into individual
5
+ character IDs before embedding. The base LlamaTokenizerFast produces
6
+ multi-character Chinese tokens that the model has never seen during training,
7
+ yielding garbled Chinese audio output in downstream inference frameworks.
8
+
9
+ This module provides ``VoxCPM2Tokenizer`` which transparently applies the
10
+ character splitting inside ``encode()`` and ``__call__()``, so any downstream
11
+ consumer (vLLM, vLLM-Omni, Nano-vLLM, etc.) gets correct single-character
12
+ IDs without code changes.
13
+ """
14
+
15
+ from transformers import LlamaTokenizerFast
16
+
17
+
18
+ class VoxCPM2Tokenizer(LlamaTokenizerFast):
19
+
20
+ def __init__(self, *args, **kwargs):
21
+ super().__init__(*args, **kwargs)
22
+ self._split_map = self._build_split_map()
23
+
24
+ def _build_split_map(self) -> dict[int, list[int]]:
25
+ vocab = self.get_vocab()
26
+ split_map: dict[int, list[int]] = {}
27
+ for token, tid in vocab.items():
28
+ clean = token.replace("\u2581", "")
29
+ if len(clean) >= 2 and all(self._is_cjk(c) for c in clean):
30
+ char_ids = self.convert_tokens_to_ids(list(clean))
31
+ if all(c != self.unk_token_id for c in char_ids):
32
+ split_map[tid] = char_ids
33
+ return split_map
34
+
35
+ @staticmethod
36
+ def _is_cjk(c: str) -> bool:
37
+ return (
38
+ "\u4e00" <= c <= "\u9fff"
39
+ or "\u3400" <= c <= "\u4dbf"
40
+ or "\uf900" <= c <= "\ufaff"
41
+ or "\U00020000" <= c <= "\U0002a6df"
42
+ )
43
+
44
+ def _expand_ids(self, ids: list[int]) -> list[int]:
45
+ result: list[int] = []
46
+ for tid in ids:
47
+ expansion = self._split_map.get(tid)
48
+ if expansion is not None:
49
+ result.extend(expansion)
50
+ else:
51
+ result.append(tid)
52
+ return result
53
+
54
+ def encode(self, text, *args, **kwargs):
55
+ ids = super().encode(text, *args, **kwargs)
56
+ return self._expand_ids(ids)
57
+
58
+ def __call__(self, text, *args, **kwargs):
59
+ result = super().__call__(text, *args, **kwargs)
60
+ if hasattr(result, "input_ids"):
61
+ ids = result["input_ids"]
62
+ if isinstance(ids, list) and ids and isinstance(ids[0], list):
63
+ result["input_ids"] = [self._expand_ids(x) for x in ids]
64
+ if "attention_mask" in result:
65
+ result["attention_mask"] = [
66
+ [1] * len(x) for x in result["input_ids"]
67
+ ]
68
+ elif isinstance(ids, list):
69
+ result["input_ids"] = self._expand_ids(ids)
70
+ if "attention_mask" in result:
71
+ result["attention_mask"] = [1] * len(result["input_ids"])
72
+ return result
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "101": {
30
+ "content": "<|audio_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "102": {
38
+ "content": "<|audio_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "103": {
46
+ "content": "<|audio_prompt_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "104": {
54
+ "content": "<|audio_prompt_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "105": {
62
+ "content": "<|background|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "106": {
70
+ "content": "<|/background|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "107": {
78
+ "content": "<|characters|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "108": {
86
+ "content": "<|/characters|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "109": {
94
+ "content": "<|speaker_id|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "110": {
102
+ "content": "<|/speaker_id|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "111": {
110
+ "content": "<|span|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "112": {
118
+ "content": "<|/span|>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": true
124
+ },
125
+ "73440": {
126
+ "content": "<|im_end|>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": true
132
+ },
133
+ "73441": {
134
+ "content": "<|im_start|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": true
140
+ },
141
+ "73442": {
142
+ "content": "<|tool_call|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": true
148
+ },
149
+ "73443": {
150
+ "content": "<|execute_start|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": true
156
+ },
157
+ "73444": {
158
+ "content": "<|execute_end|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": true
164
+ },
165
+ "73445": {
166
+ "content": "<|fim_prefix|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": true
172
+ },
173
+ "73446": {
174
+ "content": "<|fim_middle|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": true
180
+ },
181
+ "73447": {
182
+ "content": "<|fim_suffix|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
+ }
189
+ },
190
+ "additional_special_tokens": [
191
+ "<|im_end|>",
192
+ "<|im_start|>",
193
+ "<|tool_call|>",
194
+ "<|execute_start|>",
195
+ "<|execute_end|>",
196
+ "<|fim_prefix|>",
197
+ "<|fim_middle|>",
198
+ "<|fim_suffix|>"
199
+ ],
200
+ "bos_token": "<s>",
201
+ "clean_up_tokenization_spaces": false,
202
+ "eos_token": "<|im_end|>",
203
+ "legacy": true,
204
+ "model_max_length": 1000000000000000019884624838656,
205
+ "pad_token": null,
206
+ "sp_model_kwargs": {},
207
+ "spaces_between_special_tokens": false,
208
+ "tokenizer_class": "VoxCPM2Tokenizer",
209
+ "unk_token": "<unk>",
210
+ "use_default_system_prompt": false,
211
+ "chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
212
+ "auto_map": {
213
+ "AutoTokenizer": [
214
+ "tokenization_voxcpm2.VoxCPM2Tokenizer",
215
+ null
216
+ ]
217
+ }
218
+ }