atto-voca-arabic: 0.14M eight-voice MSA TTS
Browse filesFiles changed (50)
- .gitattributes+40
- LICENSEAdded+202
- README.mdAdded+184
- atto-voca-arabic.ptAdded+3
- code/arabic_frontend.pyAdded+337
- code/numbers.pyAdded+75
- code/text.pyAdded+138
- config.jsonAdded+43
- onnx/model.jsonAdded+82
- onnx/model.onnxAdded+3
- samples/a000-0.wavAdded+3
- samples/a000-1.wavAdded+3
- samples/a000-2.wavAdded+3
- samples/a000-3.wavAdded+3
- samples/a000-4.wavAdded+3
- samples/am6-0.wavAdded+3
- samples/am6-1.wavAdded+3
- samples/am6-2.wavAdded+3
- samples/am6-3.wavAdded+3
- samples/am6-4.wavAdded+3
- samples/nf2-0.wavAdded+3
- samples/nf2-1.wavAdded+3
- samples/nf2-2.wavAdded+3
- samples/nf2-3.wavAdded+3
- samples/nf2-4.wavAdded+3
- samples/nm2-0.wavAdded+3
- samples/nm2-1.wavAdded+3
- samples/nm2-2.wavAdded+3
- samples/nm2-3.wavAdded+3
- samples/nm2-4.wavAdded+3
- samples/pf4-0.wavAdded+3
- samples/pf4-1.wavAdded+3
- samples/pf4-2.wavAdded+3
- samples/pf4-3.wavAdded+3
- samples/pf4-4.wavAdded+3
- samples/pm2-0.wavAdded+3
- samples/pm2-1.wavAdded+3
- samples/pm2-2.wavAdded+3
- samples/pm2-3.wavAdded+3
- samples/pm2-4.wavAdded+3
- samples/sf1-0.wavAdded+3
- samples/sf1-1.wavAdded+3
- samples/sf1-2.wavAdded+3
- samples/sf1-3.wavAdded+3
- samples/sf1-4.wavAdded+3
- samples/sm3-0.wavAdded+3
- samples/sm3-1.wavAdded+3
- samples/sm3-2.wavAdded+3
- samples/sm3-3.wavAdded+3
- samples/sm3-4.wavAdded+3
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353637383940414243444546474849505152535455565758596061626364656667686970717273747532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textsamples/a000-0.wav filter=lfs diff=lfs merge=lfs -textsamples/a000-1.wav filter=lfs diff=lfs merge=lfs -textsamples/a000-2.wav filter=lfs diff=lfs merge=lfs -textsamples/a000-3.wav filter=lfs diff=lfs merge=lfs -textsamples/a000-4.wav filter=lfs diff=lfs merge=lfs -textsamples/am6-0.wav filter=lfs diff=lfs merge=lfs -textsamples/am6-1.wav filter=lfs diff=lfs merge=lfs -textsamples/am6-2.wav filter=lfs diff=lfs merge=lfs -textsamples/am6-3.wav filter=lfs diff=lfs merge=lfs -textsamples/am6-4.wav filter=lfs diff=lfs merge=lfs -textsamples/nf2-0.wav filter=lfs diff=lfs merge=lfs -textsamples/nf2-1.wav filter=lfs diff=lfs merge=lfs -textsamples/nf2-2.wav filter=lfs diff=lfs merge=lfs -textsamples/nf2-3.wav filter=lfs diff=lfs merge=lfs -textsamples/nf2-4.wav filter=lfs diff=lfs merge=lfs -textsamples/nm2-0.wav filter=lfs diff=lfs merge=lfs -textsamples/nm2-1.wav filter=lfs diff=lfs merge=lfs -textsamples/nm2-2.wav filter=lfs diff=lfs merge=lfs -textsamples/nm2-3.wav filter=lfs diff=lfs merge=lfs -textsamples/nm2-4.wav filter=lfs diff=lfs merge=lfs -textsamples/pf4-0.wav filter=lfs diff=lfs merge=lfs -textsamples/pf4-1.wav filter=lfs diff=lfs merge=lfs -textsamples/pf4-2.wav filter=lfs diff=lfs merge=lfs -textsamples/pf4-3.wav filter=lfs diff=lfs merge=lfs -textsamples/pf4-4.wav filter=lfs diff=lfs merge=lfs -textsamples/pm2-0.wav filter=lfs diff=lfs merge=lfs -textsamples/pm2-1.wav filter=lfs diff=lfs merge=lfs -textsamples/pm2-2.wav filter=lfs diff=lfs merge=lfs -textsamples/pm2-3.wav filter=lfs diff=lfs merge=lfs -textsamples/pm2-4.wav filter=lfs diff=lfs merge=lfs -textsamples/sf1-0.wav filter=lfs diff=lfs merge=lfs -textsamples/sf1-1.wav filter=lfs diff=lfs merge=lfs -textsamples/sf1-2.wav filter=lfs diff=lfs merge=lfs -textsamples/sf1-3.wav filter=lfs diff=lfs merge=lfs -textsamples/sf1-4.wav filter=lfs diff=lfs merge=lfs -textsamples/sm3-0.wav filter=lfs diff=lfs merge=lfs -textsamples/sm3-1.wav filter=lfs diff=lfs merge=lfs -textsamples/sm3-2.wav filter=lfs diff=lfs merge=lfs -textsamples/sm3-3.wav filter=lfs diff=lfs merge=lfs -textsamples/sm3-4.wav filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184---language: [ar]license: apache-2.0library_name: onnxruntimepipeline_tag: text-to-speechtags: - text-to-speech - tts - speech-synthesis - arabic - msa - modern-standard-arabic - atto-voca - tiny-voca - onnx - cpu - small-model - multi-speaker - trained-from-scratchdatasets: [oddadmix/tiny-voca-arabic-v2.1-dataset]---
# atto-voca-arabic
atto-voca-arabic is the 1/32-size sibling of [tiny-voca-arabic v2.1](https://huggingface.co/oddadmix/tiny-voca-arabic-v2.1): a**0.14M-parameter** Modern Standard Arabic (فصحى) text-to-speech model with the same **eight voices in fourspeaking styles** (assistant, news, story, promo; one female and one male voice each), trained **from scratch** onthe same data with the same recipe. The waveform generator is included: text in, 24 kHz audio out, about 390× realtime on four CPU threads.
> **Based on [tiny-voca](https://huggingface.co/n4ze3m/tiny-voca) by Muhammed Nazeem ([@n4ze3m](https://huggingface.co/n4ze3m)).**> This model uses the original tiny-voca architecture and training code> ([github.com/n4ze3m/tiny-voca](https://github.com/n4ze3m/tiny-voca), Apache-2.0), with narrower layers. No tiny-voca> weights were reused: it was trained from scratch on Arabic data.
[Demo](https://huggingface.co/spaces/oddadmix/atto-voca-arabic) ·[Dataset](https://huggingface.co/datasets/oddadmix/tiny-voca-arabic-v2.1-dataset) ·Double size (0.28M): [oddadmix/femto-voca-arabic](https://huggingface.co/oddadmix/femto-voca-arabic) ·One-eighth size (0.56M): [oddadmix/pico-voca-arabic](https://huggingface.co/oddadmix/pico-voca-arabic) ·Quarter size (1.2M): [oddadmix/nano-voca-arabic](https://huggingface.co/oddadmix/nano-voca-arabic) ·Half size (2.3M): [oddadmix/micro-voca-arabic](https://huggingface.co/oddadmix/micro-voca-arabic) ·Full size (4.5M): [oddadmix/tiny-voca-arabic-v2.1](https://huggingface.co/oddadmix/tiny-voca-arabic-v2.1)
| | atto-voca-arabic | tiny-voca-arabic v2.1 ||---|---|---|| Parameters | **142,491** (0.6 MB PyTorch, 3.8 MB ONNX) | 4,534,411 (18 MB PyTorch, 21 MB ONNX) || Width (channels / feed-forward / predictor) | 32 / 112 / 24 | 192 / 640 / 128 || Layers | same | same || CPU speed, 4 threads (ONNX) | ~390× real time | ~200× real time || Character error rate, validation / test / new sentences | 0.9% / 1.3% / 1.1% | 0.8% / 1.1% / 0.5% || Quality score (DNSMOS P.808), the 40 samples below | 3.59 | 3.76 |
Same inputs, outputs and voice order as v2.1: a drop-in replacement where size or speed matters more.
| `voice` | Name | Style | Gender ||---|---|---|---|| 0 | `a000` | Assistant | female || 1 | `am6` | Assistant | male || 2 | `nf2` | News | female || 3 | `nm2` | News | male || 4 | `sf1` | Story | female || 5 | `sm3` | Story | male || 6 | `pf4` | Promo | female || 7 | `pm2` | Promo | male |
## Samples
| Text | a000 | am6 | nf2 | nm2 | sf1 | sm3 | pf4 | pm2 ||---|---|---|---|---|---|---|---|---|| مرحبًا بكم، هذا نموذج صغير لتحويل النص إلى كلام باللغة العربية الفصحى. | [▶](samples/a000-0.wav) | [▶](samples/am6-0.wav) | [▶](samples/nf2-0.wav) | [▶](samples/nm2-0.wav) | [▶](samples/sf1-0.wav) | [▶](samples/sm3-0.wav) | [▶](samples/pf4-0.wav) | [▶](samples/pm2-0.wav) || تقع مدينة القاهرة على ضفاف نهر النيل، وهي من أكبر المدن في العالم العربي. | [▶](samples/a000-1.wav) | [▶](samples/am6-1.wav) | [▶](samples/nf2-1.wav) | [▶](samples/nm2-1.wav) | [▶](samples/sf1-1.wav) | [▶](samples/sm3-1.wav) | [▶](samples/pf4-1.wav) | [▶](samples/pm2-1.wav) || هل يمكنك أن تخبرني عن حالة الطقس غدًا؟ أريد أن أخرج في نزهة مع أصدقائي. | [▶](samples/a000-2.wav) | [▶](samples/am6-2.wav) | [▶](samples/nf2-2.wav) | [▶](samples/nm2-2.wav) | [▶](samples/sf1-2.wav) | [▶](samples/sm3-2.wav) | [▶](samples/pf4-2.wav) | [▶](samples/pm2-2.wav) || يبلغ عدد سكان المدينة مليوني شخص ويشكّل الشباب أكثر من ثلث السكان. | [▶](samples/a000-3.wav) | [▶](samples/am6-3.wav) | [▶](samples/nf2-3.wav) | [▶](samples/nm2-3.wav) | [▶](samples/sf1-3.wav) | [▶](samples/sm3-3.wav) | [▶](samples/pf4-3.wav) | [▶](samples/pm2-3.wav) || العلم نور، والجهل ظلام. ومن جدّ وجد، ومن زرع حصد. | [▶](samples/a000-4.wav) | [▶](samples/am6-4.wav) | [▶](samples/nf2-4.wav) | [▶](samples/nm2-4.wav) | [▶](samples/sf1-4.wav) | [▶](samples/sm3-4.wav) | [▶](samples/pf4-4.wav) | [▶](samples/pm2-4.wav) |
## How it works
Identical to [v2.1](https://huggingface.co/oddadmix/tiny-voca-arabic-v2.1#how-it-works): numbers read as MSAwords, [CATT](https://github.com/abjadai/catt) diacritization, a rule-based 49-symbol MSA phonemizer(`code/arabic_frontend.py`), then the tiny-voca network predicts durations, pauses, pitch, voicing and energy and asource-filter synthesizer makes the waveform. There is no separate neural vocoder.
## Evaluation
Whisper large-v3 transcripts of generated speech against the input text (diacritics and punctuation removed).Held-out texts were not seen in training in either voice of a style; the new sentences appear in no split.25 validation, 25 test and 8 new sentences per voice, the same sentences used for v2.1. CER, with the CER of theoriginal recordings in brackets:
| Voice | Validation | Test | New sentences ||---|---|---|---|| `a000` assistant F | 0.4% (0.6%) | 1.6% (1.8%) | 1.3% || `am6` assistant M | 0.7% (0.5%) | 0.2% (0.2%) | 0.7% || `nf2` news F | 0.9% (1.7%) | 3.3% (3.5%) | 1.5% || `nm2` news M | 0.5% (0.5%) | 1.0% (1.0%) | 2.0% || `sf1` story F | 0.4% (0.3%) | 0.5% (0.5%) | 0.7% || `sm3` story M | 0.4% (0.5%) | 0.4% (0.3%) | 0.7% || `pf4` promo F | 2.6% (2.5%) | 2.1% (2.0%) | 0.8% || `pm2` promo M | 0.8% (0.9%) | 1.5% (1.5%) | 1.1% |
Every voice is within 1.7 points of v2.1's CER (the largest change is `nm2` on new sentences, 0.3% → 2.0%). Generated durations are within7% of the recordings for every voice.
## Usage (ONNX Runtime)
```bashpip install onnxruntime numpy soundfile tqdmhf download oddadmix/atto-voca-arabic --local-dir atto-voca-arabic```
The front end in `code/` uses the CATT diacritizer; the[demo Space](https://huggingface.co/spaces/oddadmix/atto-voca-arabic/tree/main) contains it ready to run(`tiny_voca_ar/`, `catt_tashkeel/`). Minimal call:
```pythonimport numpy as np, onnxruntime as ort, soundfile as sffrom tiny_voca_ar.numbers import expand_numbersfrom tiny_voca_ar.text import phonemize
session = ort.InferenceSession("atto-voca-arabic/onnx/model.onnx", providers=["CPUExecutionProvider"])phones = phonemize(expand_numbers("مرحبًا بكم في عالم الذكاء الاصطناعي."))one = lambda v: np.array([v], dtype=np.float32)voice = 1 # 0 a000, 1 am6, 2 nf2, 3 nm2, 4 sf1, 5 sm3, 6 pf4, 7 pm2 (the order of "voices" in onnx/model.json)audio, durations = session.run(None, { "tokens": np.array([phones.ids], dtype=np.int64), "stress": np.array([phones.stress], dtype=np.int64), "voice": np.array([voice], dtype=np.int64), "speed": one(1.0), "pitch_shift": one(0.0), "pitch_range": one(1.0)})sf.write("hello.wav", audio[0], 24000)```
Inputs: `tokens`/`stress` int64 `[1, N]`, `voice` int64 `[1]`, `speed` (1 = as predicted, larger isfaster), `pitch_shift` (added to log F0; 0.058 ≈ one semitone), `pitch_range` (scales intonation). Readlong text one sentence at a time (at most 500 phonemes / 32 s per call) and join the audio. Voices differ in loudness;scale each result to the same peak level.
The PyTorch checkpoint `atto-voca-arabic.pt` loads with the tiny-voca code(`tiny_voca.infer.load_model`) using the Arabic `text.py` / `arabic_frontend.py` from `code/`; `config.json` holdsthe narrower sizes.
## Training
Same data and recipe as v2.1: 200k steps on one GPU (about 5 h). Steps 0–120k use the tiny-voca adversarial weight(`--gan-ratio 0.7`); steps 120k–200k continue with `--gan-ratio 6`. Only `channels`, `feedforward` and`predictor_channels` changed in the config.
## Limitations
- Eight voices, Modern Standard Arabic only; dialectal text is read with MSA rules.- Pronunciation follows the automatic diacritization. When CATT picks the wrong reading, the model says it.- This is the smallest size and the first where intelligibility slips: the error on new sentences is about twice that of femto-voca-arabic (1.1% vs 0.6%), highest for `nm2` (2.0%) and `nf2` (1.5%). Use a larger size when accuracy matters.- The quality score on the samples is 0.17 below v2.1 (DNSMOS P.808 3.59 vs 3.76; femto-voca-arabic 3.63, pico-voca-arabic 3.66). Listen before choosing it over the larger models.- It is barely faster than pico-voca-arabic: at this size the fixed per-call cost dominates. Choose it for the smaller file.- The same voice-quality limits as v2.1 apply (`sf1` and the news voices are a little noisier than their recordings).- Latin script, emoji and symbols other than numbers and % are skipped.
## Training data
[oddadmix/tiny-voca-arabic-v2.1-dataset](https://huggingface.co/datasets/oddadmix/tiny-voca-arabic-v2.1-dataset):99,948 clips (264 h) in the eight synthetic voices; 89,569 training clips passed the alignment quality checks.All voices are synthetic; please tell listeners when audio they hear was generated.
## License
Apache-2.0.
## Credits
- **Original model, architecture and training code:** [tiny-voca](https://huggingface.co/n4ze3m/tiny-voca) by Muhammed Nazeem ([@n4ze3m](https://huggingface.co/n4ze3m)), Apache-2.0 ([code](https://github.com/n4ze3m/tiny-voca)).- **Diacritizer:** [CATT](https://github.com/abjadai/catt) by Abjad AI, Apache-2.0.
## Citation
```bibtex@software{oddadmix2026attovocaarabic, author = {oddadmix}, title = {atto-voca-arabic: a 0.14M-parameter eight-voice Modern Standard Arabic text-to-speech model}, year = {2026}, url = {https://huggingface.co/oddadmix/atto-voca-arabic}, license = {Apache-2.0}}```123version https://git-lfs.github.com/spec/v1oid sha256:cf77d4513621d9e1336df0a597a367ac5e4c26a0ed14df6bf14c74770da48705size 629509123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337"""MSA front end: undiacritized text -> phonemes + stress, for an Arabic tiny-voca.
text --(split at punctuation)--> phrases --CATT diacritizer--> fully vowelled phrases --rules--> phonemes
Rules (MSA, connected speech): * definite article: sun letters assimilate the l (al+shams -> aʃʃams), moon letters keep it * hamzat al-wasl: pronounced (ʔa / ʔi) only at the start of a phrase, elided inside it; a preceding long vowel is shortened (fiː + l -> fil), a preceding sukun gets a helping vowel (min + al -> mina l) * shadda -> doubled consonant; tanween -> vowel + n; long vowels from ا و ي ى and dagger alif * ta marbuta: t + case vowel inside a phrase, dropped at a pause (pausal -a) * pausal forms (before punctuation / at the end): final short vowel and -un/-in dropped, -an -> aː * emphasis: a / aː next to an emphatic (sˤ dˤ tˤ ðˤ), q, or after x ɣ r -> back ɑ / ɑː; dark l in الله * word stress by syllable weight: superheavy final > heavy penult > antepenultInside a phrase the case ending is marked optional (Phone.optional): the voice sometimes drops it, andthe aligner keeps it only when the audio has it."""from dataclasses import dataclass, fieldimport reimport unicodedata
FATHA, DAMMA, KASRA, SUKUN, SHADDA = "َ", "ُ", "ِ", "ْ", "ّ"FATHATAN, DAMMATAN, KASRATAN, DAGGER = "ً", "ٌ", "ٍ", "ٰ"MARKS = {FATHA, DAMMA, KASRA, SUKUN, SHADDA, FATHATAN, DAMMATAN, KASRATAN, DAGGER}SHORT = {FATHA: "a", DAMMA: "u", KASRA: "i"}TANWEEN = {FATHATAN: "a", DAMMATAN: "u", KASRATAN: "i"}
CONS = {"ء": "ʔ", "أ": "ʔ", "إ": "ʔ", "ؤ": "ʔ", "ئ": "ʔ", "ب": "b", "ت": "t", "ث": "θ", "ج": "dʒ", "ح": "ħ", "خ": "x", "د": "d", "ذ": "ð", "ر": "r", "ز": "z", "س": "s", "ش": "ʃ", "ص": "sˤ", "ض": "dˤ", "ط": "tˤ", "ظ": "ðˤ", "ع": "ʕ", "غ": "ɣ", "ف": "f", "ق": "q", "ك": "k", "ل": "l", "م": "m", "ن": "n", "ه": "h", "و": "w", "ي": "j", "ة": "t"}SUN = set("تثدذرزسشصضطظلن")EMPHATIC = {"sˤ", "dˤ", "tˤ", "ðˤ", "q", "lˤ"}BACKING_BEFORE = {"x", "ɣ", "r"} # back a/aː when they precede the vowelCONSONANTS = sorted(set(CONS.values()) | {"lˤ"})VOWELS = ["a", "i", "u", "aː", "iː", "uː", "ɑ", "ɑː"]LONG = {"aː", "iː", "uː", "ɑː"}VOICELESS = {"ʔ", "t", "θ", "ħ", "x", "s", "ʃ", "sˤ", "tˤ", "f", "q", "k", "h"}PAUSE_PUNCT = "،,.؟?!:;؛…"
# Words whose spelling hides a long vowel (written without the dagger alif) or is irregular.LEXICON = { "هذا": "haːðaː", "هذه": "haːðihi", "هذان": "haːðaːni", "هذين": "haːðajni", "هؤلاء": "haːʔulaːʔi", "ذلك": "ðaːlika", "ذلكم": "ðaːlikum", "تلك": "tilka", "لكن": "laːkin", "لكنه": "laːkinnahu", "لكنها": "laːkinnahaː", "لكنني": "laːkinnaniː", "لكني": "laːkinniː", "أولئك": "ʔulaːʔika", "هكذا": "haːkaðaː", "الله": "ʔallˤaːh", "والله": "wallˤaːhi", "بالله": "billaːhi", "لله": "lillaːhi", "الرحمن": "ʔarraħmaːn", "إله": "ʔilaːh", "طه": "tˤaːhaː", "داود": "daːwuːd", "عمرو": "ʕamr", "مئة": "miʔa", "مائة": "miʔa",}
@dataclassclass Phone: p: str word: int # word index in the utterance (-1 = boundary/punctuation token) stress: int = 0 optional: bool = False # case ending inside a phrase: the aligner may drop it
@dataclassclass Result: phrases: list # diacritized phrases phones: list = field(default_factory=list)
def symbols(self): return [x.p for x in self.phones]
_diacritizer = None
def diacritize(phrases, batch_size=32): global _diacritizer if _diacritizer is None: from catt_tashkeel import CATTEncoderDecoder _diacritizer = CATTEncoderDecoder() todo = [p for p in phrases if p.strip()] out = iter(_diacritizer.do_tashkeel_batch(todo, batch_size=batch_size, verbose=False)) if todo else iter([]) return [next(out) if p.strip() else "" for p in phrases]
def normalize(text): text = unicodedata.normalize("NFC", text).replace("ـ", "") # tatweel text = re.sub(r"[\"'«»“”()\[\]{}<>*_~`]", " ", text) text = re.sub(r"\s*-\s*", " ", text) return re.sub(r"\s+", " ", text).strip()
def split_phrases(text): """[(phrase, punct)] split at pause punctuation; punct is the closing mark or '' at the end.""" parts = re.split(f"([{re.escape(PAUSE_PUNCT)}]+)", normalize(text)) out = [] for i in range(0, len(parts), 2): ph = parts[i].strip(); pu = parts[i + 1][0] if i + 1 < len(parts) else "" if ph: out.append((ph, pu)) elif pu and out: out[-1] = (out[-1][0], out[-1][1] or pu) return out
def letters(word): """[(letter, set_of_marks)] with marks attached to the preceding letter.""" out = [] for ch in word: if ch in MARKS and out: out[-1][1].add(ch) elif "ء" <= ch <= "ي" or ch == "ٱ": out.append([ch, set()]) return out
def strip_marks(s): return "".join(c for c in s if c not in MARKS)
def word_phones(word, first_in_phrase, last_in_phrase): """Phones of one diacritized word -> (list of (phone, optional), starts_with_wasl).""" bare = strip_marks(word) if bare in LEXICON: seq = re.findall(r"dʒ|sˤ|dˤ|tˤ|ðˤ|lˤ|[a-zʔʕħθðʃɣχ]ː?", LEXICON[bare]) if bare.startswith("ال") and not first_in_phrase: seq = seq[2:] if last_in_phrase is False and LEXICON[bare][-1] in "aiu" and len(seq) > 1: return [(s, i == len(seq) - 1) for i, s in enumerate(seq)], bare.startswith("ال") return [(s, False) for s in seq], bare.startswith("ال") L = letters(word) if not L: return [], False out = [] wasl = False i = 0 # proclitics before a definite article: و ف ب ك ل + ال / لل pro = [] while i < len(L) - 2 and L[i][0] in "وفبك" and L[i + 1][0] == "ا" and L[i + 2][0] == "ل" and i == 0: pro.append(L[i]); i += 1; break if i == 0 and len(L) > 2 and L[0][0] == "ل" and L[1][0] == "ل" and not (L[0][1] & {SUKUN}): # لل = li + l(article) out += [("l", False), ("i", False)]; i = 1 art_l = True else: art_l = False for c, m in pro: out += [(CONS[c], False), (SHORT.get(next(iter(m & set(SHORT)), FATHA if c != "ب" else KASRA), "a"), False)] # article if not art_l and i < len(L) - 1 and L[i][0] in "اٱ" and L[i + 1][0] == "ل": nxt = L[i + 2][0] if i + 2 < len(L) else "" if not pro: wasl = True if first_in_phrase: out += [("ʔ", False), ("a", False)] i += 1 # skip the alif if nxt in SUN: i += 1 # silent l; the sun letter carries shadda if L[i][0] != "ل" and SHADDA not in L[i][1]: L[i][1].add(SHADDA) else: out.append(("l", False)); i += 1 elif art_l: i = 1 nxt = L[2][0] if len(L) > 2 else "" if nxt in SUN and nxt != "ل": i = 2 if SHADDA not in L[2][1]: L[2][1].add(SHADDA) else: out.append(("l", False)); i = 2 elif i == 0 and L[0][0] in "اٱ": # other hamzat al-wasl (verbs, ism, ibn ...) wasl = True v = SHORT.get(next(iter(L[0][1] & set(SHORT)), KASRA), "i") if first_in_phrase: out += [("ʔ", False), (v, False)] i = 1 n = len(L) while i < n: c, m = L[i] last = i == n - 1 nxt = L[i + 1] if i + 1 < n else None prev_v = out[-1][0] if out else "" if c == "ا": if prev_v in ("a", "ɑ"): out[-1] = ("aː", False) elif i == n - 1 and len(L) > 1 and L[i - 1][0] == "و": pass # silent alif after plural waw (كتبوا) elif FATHATAN in L[i - 1][1] if i else False: pass else: out.append(("aː", False)) i += 1; continue if c == "آ": out += [("ʔ", False), ("aː", False)]; i += 1; continue if c == "ى": if prev_v in ("a", "ɑ") or not prev_v: if out: out[-1] = ("aː", False) else: out.append(("aː", False)) elif prev_v == "i": out[-1] = ("iː", False) else: out.append(("aː", False)) i += 1; continue if c in "وي" and not (m & (set(SHORT) | set(TANWEEN) | {SHADDA})): longv = {"و": ("u", "uː"), "ي": ("i", "iː")}[c] if prev_v == longv[0]: out[-1] = (longv[1], False); i += 1; continue if prev_v in ("a", "ɑ") and SUKUN in m: out.append((CONS[c], False)); i += 1; continue # diphthong aw / aj if not prev_v or prev_v in VOWELS: if SUKUN not in m and not m and prev_v not in VOWELS: out.append((longv[1], False)); i += 1; continue if c == "ة": if last_in_phrase: i += 1; continue # pausal: ...a(h) cons = "t" else: cons = CONS.get(c) if cons is None: i += 1; continue out.append((cons, False)) if c in "أإ" and not (m & (set(SHORT) | set(TANWEEN) | {SUKUN})) and nxt is not None and nxt[0] not in "اوي": m = m | {KASRA if c == "إ" else FATHA} if SHADDA in m: out.append((cons, False)) if DAGGER in m: out.append(("aː", False)) tv = next(iter(m & set(TANWEEN)), None) sv = next(iter(m & set(SHORT)), None) if tv: v = TANWEEN[tv] if last_in_phrase: if v == "a" and c != "ة": out.append(("aː", False)) else: out += [(v, True), ("n", True)] elif sv: v = SHORT[sv] if last and last_in_phrase: pass # pausal: final short vowel dropped else: out.append((v, last)) i += 1 return out, wasl
def emphasis(seq): """Back a/aː near emphatics. seq: list of phone strings (one word, or the whole phrase).""" out = list(seq) for k, p in enumerate(out): if p not in ("a", "aː"): continue prev = out[k - 1] if k else ""; nxt = out[k + 1] if k + 1 < len(out) else "" nxt2 = out[k + 2] if k + 2 < len(out) else "" if prev in EMPHATIC or prev in BACKING_BEFORE or nxt in EMPHATIC or (nxt not in VOWELS and nxt2 in EMPHATIC and False): out[k] = "ɑ" if p == "a" else "ɑː" return out
def syllable_stress(phones): """Index (into phones) of the stressed vowel of one word, by MSA syllable weight.""" vidx = [k for k, p in enumerate(phones) if p in VOWELS] if not vidx: return None syl = [] # (vowel index, weight) weight: 1 light, 2 heavy, 3 superheavy for j, k in enumerate(vidx): end = vidx[j + 1] - 1 if j + 1 < len(vidx) else len(phones) # next onset consonant belongs to next syllable coda = (vidx[j + 1] - k - 2) if j + 1 < len(vidx) else (len(phones) - k - 1) coda = max(coda, 0) w = (2 if phones[k] in LONG else 1) + min(coda, 2) - (0 if phones[k] in LONG or coda else 0) w = 1 if (phones[k] not in LONG and coda == 0) else (2 if (phones[k] in LONG) + coda == 1 else 3) syl.append((k, w)) if len(syl) == 1: return syl[0][0] if syl[-1][1] == 3: return syl[-1][0] if syl[-2][1] >= 2 or len(syl) == 2: return syl[-2][0] return syl[-3][0]
def phonemize(text, diacritized=None): """text -> Result. Tokens: '^' start, '$' end, ' ' word boundary, punctuation marks, phones.""" parts = split_phrases(text) dia = diacritized if diacritized is not None else diacritize([p for p, _ in parts]) res = Result(phrases=dia) res.phones.append(Phone("^", -1)) wi = 0 for (phrase, punct), dphrase in zip(parts, dia): words = dphrase.split() pw = [] for j, w in enumerate(words): seq, wasl = word_phones(w, j == 0, j == len(words) - 1) pw.append([seq, wasl]) # elision across words: wasl after a long vowel shortens it; after a consonant add a helping vowel for j in range(1, len(pw)): if pw[j][1] and pw[j - 1][0]: prev = pw[j - 1][0] last = prev[-1][0] if last in LONG: prev[-1] = ({"aː": "a", "iː": "i", "uː": "u", "ɑː": "ɑ"}[last], False) elif last not in VOWELS: helper = "u" if strip_marks(words[j - 1]) in ("هم", "أنتم", "لكم", "عليهم", "بكم", "منهم") else \ ("a" if strip_marks(words[j - 1]) == "من" else "i") prev.append((helper, False)) elif prev[-1][1]: prev[-1] = (last, False) # the case vowel carries the liaison: no longer optional for j in range(1, len(pw)): if strip_marks(words[j]) == "الله" and pw[j - 1][0] and pw[j - 1][0][-1][0] == "i": pw[j][0] = [("l" if p == "lˤ" else p, o) for p, o in pw[j][0]] for j, (seq, _) in enumerate(pw): if not seq: continue ps = emphasis([p for p, _ in seq]) st = syllable_stress(ps) if j: res.phones.append(Phone(" ", -1)) for k, (p, (_, opt)) in enumerate(zip(ps, seq)): res.phones.append(Phone(p, wi, 1 if k == st else 0, opt)) wi += 1 res.phones.append(Phone(punct if punct else " ", -1) if punct else Phone(" ", -1)) if res.phones[-1].p == " ": res.phones.pop() res.phones.append(Phone("$", -1)) return res
def show(res): s = [] for x in res.phones: if x.word < 0: s.append({"^": "", "$": "", " ": " "}.get(x.p, f" {x.p} ")) else: s.append(("ˈ" if x.stress else "") + x.p + ("?" if x.optional else "")) return "".join(s).strip()
if __name__ == "__main__": import sys for line in sys.argv[1:] or ["نعم، يمكن أن تقدم لهم قطع صغيرة من الحلويات.", "ابدأ بخطوة صغيرة، مثل ترتيب جدولك في الأسبوع القادم."]: r = phonemize(line) print(line); print(" ", " | ".join(r.phrases)); print(" ", show(r))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475"""Read digits as Modern Standard Arabic words before diacritization.
Cardinals use the masculine nominative form without gender agreement with the counted noun, which ishow numbers are most often read aloud. Handles Western and Arabic-Indic digits, thousands separators,decimals (فاصلة), percent (في المائة) and a leading minus (سالب)."""import re
ONES = ["صفر", "واحد", "اثنان", "ثلاثة", "أربعة", "خمسة", "ستة", "سبعة", "ثمانية", "تسعة"]TEENS = ["عشرة", "أحد عشر", "اثنا عشر", "ثلاثة عشر", "أربعة عشر", "خمسة عشر", "ستة عشر", "سبعة عشر", "ثمانية عشر", "تسعة عشر"]TENS = ["", "", "عشرون", "ثلاثون", "أربعون", "خمسون", "ستون", "سبعون", "ثمانون", "تسعون"]HUNDREDS = ["", "مائة", "مئتان", "ثلاثمائة", "أربعمائة", "خمسمائة", "ستمائة", "سبعمائة", "ثمانمائة", "تسعمائة"]# (value, singular, dual, plural for 3-10)SCALES = [(10 ** 9, "مليار", "ملياران", "مليارات"), (10 ** 6, "مليون", "مليونان", "ملايين"), (1000, "ألف", "ألفان", "آلاف")]INDIC = str.maketrans("٠١٢٣٤٥٦٧٨٩۰۱۲۳۴۵۶۷۸۹", "01234567890123456789")
def _below_1000(n): parts = [] h, rest = divmod(n, 100) if h: parts.append(HUNDREDS[h]) if rest: if rest < 10: parts.append(ONES[rest]) elif rest < 20: parts.append(TEENS[rest - 10]) else: t, o = divmod(rest, 10) parts.append(f"{ONES[o]} و{TENS[t]}" if o else TENS[t]) return " و".join(parts)
def number_words(n): if n == 0: return ONES[0] if n >= 10 ** 12: return " ".join(ONES[int(d)] for d in str(n)) parts = [] for value, one, two, few in SCALES: k, n = divmod(n, value) if not k: continue if k == 1: parts.append(one) elif k == 2: parts.append(two) elif k <= 10: parts.append(f"{_below_1000(k)} {few}") else: parts.append(f"{_below_1000(k)} {one}") if n: parts.append(_below_1000(n)) return " و".join(parts)
_NUMBER = re.compile(r"(-?)(\d{1,3}(?:[,٬]\d{3})+|\d+)(?:[.٫](\d+))?(\s*[%٪])?")
def _read(m): sign, whole, frac, pct = m.groups() out = number_words(int(re.sub(r"[,٬]", "", whole))) if frac: out += " فاصلة " + (number_words(int(frac)) if not frac.startswith("0") else " ".join(ONES[int(d)] for d in frac)) if sign: out = "سالب " + out if pct: out += " في المائة" return f" {out} "
def expand_numbers(text): return re.sub(r"[ \t]+", " ", _NUMBER.sub(_read, text.translate(INDIC))).strip()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138"""Modern Standard Arabic front end: text -> phoneme tokens with a stress feature.
Same interface as the English front end it replaces (text_english.py), so the model, annotationand training code are unchanged. The pipeline is in ``arabic_frontend``:
undiacritized text -> phrases (split at punctuation) -> CATT diacritizer -> MSA rules -> phonemes
* A token is one phoneme; geminates are two identical consonant tokens.* Stress (0/1) is a parallel feature from MSA syllable weight, not a token.* Punctuation, word boundaries and the utterance edges are tokens that may last zero frames.* ``Phonemized.optional`` marks case endings inside a phrase. The aligner keeps one only when the recording has it; inference always says them (formal MSA).
Diacritizations can be served from a cache (``TINY_VOCA_DIACRITIZED`` = jsonl of {"p", "d"}) soannotation and training use exactly the vowels that were aligned."""
from dataclasses import dataclass, fieldimport hashlibimport jsonimport os
from . import arabic_frontend as af
FRONTEND_VERSION = "ar-1"FRONTENDS = ("arabic",)FRONTEND_VARIABLE = "TINY_VOCA_FRONTEND"_frontend = "arabic"
PAD, BOS, EOS, SP, UNK = "<pad>", "<bos>", "<eos>", "<sp>", "<unk>"SPECIALS = (PAD, BOS, EOS, SP, UNK)PUNCTUATION = (",", ".", "?", "!", ";", ":", "…")_PUNCT_MAP = {"،": ",", ",": ",", ".": ".", "؟": "?", "?": "?", "!": "!", "؛": ";", ";": ";", ":": ":", "…": "…"}CONSONANTS = tuple(af.CONSONANTS)VOWELS = tuple(af.VOWELS)PHONES = CONSONANTS + VOWELS# Append-only: changing the order or removing a symbol invalidates checkpoints.SYMBOLS = SPECIALS + PUNCTUATION + PHONESSYMBOL_TO_ID = {symbol: index for index, symbol in enumerate(SYMBOLS)}PHONE_SET = frozenset(PHONES)PHONE_IDS = frozenset(SYMBOL_TO_ID[p] for p in PHONES) | {SYMBOL_TO_ID[UNK]}VOICELESS = frozenset(af.VOICELESS)VOWEL_SET = frozenset(VOWELS)
class NothingToPronounce(ValueError): """The text has no Arabic word to say."""
@dataclass(frozen=True)class Phonemized: symbols: tuple ids: tuple stress: tuple unknown: tuple optional: tuple = field(default=()) diacritized: tuple = field(default=())
def __len__(self): return len(self.ids)
def frontend(): return _frontend
def set_frontend(name): if name not in FRONTENDS: raise ValueError(f"front end must be one of {FRONTENDS}, not {name!r}")
def frontend_identity(): return {"frontend_version": FRONTEND_VERSION, "phonemizer": "tiny_voca.arabic_frontend", "diacritizer": "catt-tashkeel ed_model v2", "symbols": list(SYMBOLS)}
def frontend_runtime(): return {"phonemizer": hashlib.sha256(open(af.__file__, "rb").read()).hexdigest()}
def frontend_fingerprint(): return hashlib.sha256(json.dumps(frontend_identity(), sort_keys=True, ensure_ascii=False).encode()).hexdigest()
_cache = None
def _diacritized(phrases): global _cache if _cache is None: _cache = {} path = os.environ.get("TINY_VOCA_DIACRITIZED") if path and os.path.exists(path): with open(path, encoding="utf-8") as f: for line in f: r = json.loads(line); _cache[r["p"]] = r["d"] missing = [p for p in phrases if p not in _cache] if missing: for p, d in zip(missing, af.diacritize(missing)): _cache[p] = d return [_cache[p] for p in phrases]
def phonemize(text): if not isinstance(text, str) or not text.strip(): raise ValueError("text must not be empty") parts = af.split_phrases(text) if not parts: raise NothingToPronounce("the text has nothing to pronounce") res = af.phonemize(text, _diacritized([p for p, _ in parts])) symbols, stress, optional = [], [], [] for x in res.phones: if x.p == "^": s = BOS elif x.p == "$": s = EOS elif x.p == " ": s = SP elif x.word < 0: s = _PUNCT_MAP.get(x.p, ",") else: s = x.p if s in PUNCTUATION and symbols and symbols[-1] in PUNCTUATION: continue if s in PUNCTUATION and symbols and symbols[-1] == SP: symbols.pop(); stress.pop(); optional.pop() symbols.append(s); stress.append(x.stress); optional.append(int(x.optional)) if not any(s in PHONE_SET for s in symbols): raise NothingToPronounce("the text has nothing to pronounce") return Phonemized(tuple(symbols), tuple(SYMBOL_TO_ID[s] for s in symbols), tuple(stress), (), tuple(optional), tuple(res.phrases))
def drop(ph, remove): """Copy of ``ph`` without the token positions in ``remove`` (dropped optional case endings).""" remove = set(remove) keep = [i for i in range(len(ph.symbols)) if i not in remove] pick = lambda seq: tuple(seq[i] for i in keep) if seq else seq return Phonemized(pick(ph.symbols), pick(ph.ids), pick(ph.stress), ph.unknown, pick(ph.optional), ph.diacritized)
def is_phone(token_ids): return [int(i) in PHONE_IDS for i in token_ids]12345678910111213141516171819202122232425262728293031323334353637383940414243{ "sample_rate": 24000, "hop": 256, "n_fft": 1024, "n_mels": 80, "f0_min": 50.0, "f0_max": 600.0, "speakers": [ "a000", "am6", "nf2", "nm2", "sf1", "sm3", "pf4", "pm2" ], "vocab_size": 49, "channels": 32, "heads": 4, "feedforward": 112, "kernel": 7, "encoder_layers": 4, "prosody_layers": 2, "acoustic_layers": 5, "dropout": 0.1, "predictor_channels": 24, "synth_fft": 512, "synth_hop": 128, "noise_fft": 256, "noise_hop": 64, "cep_causal": 80, "cep_anti": 16, "noise_cep": 32, "harmonic_limit": 0.47, "max_tokens": 512, "max_frames": 3000, "mel_mean": -5.0, "mel_scale": 5.0, "energy_mean": -4.0, "energy_scale": 2.0, "pitch_reference_hz": 200.0}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182{ "sample_rate": 24000, "hop": 256, "voices": [ "a000", "am6", "nf2", "nm2", "sf1", "sm3", "pf4", "pm2" ], "symbols": [ "<pad>", "<bos>", "<eos>", "<sp>", "<unk>", ",", ".", "?", "!", ";", ":", "…", "b", "d", "dʒ", "dˤ", "f", "h", "j", "k", "l", "lˤ", "m", "n", "q", "r", "s", "sˤ", "t", "tˤ", "w", "x", "z", "ð", "ðˤ", "ħ", "ɣ", "ʃ", "ʔ", "ʕ", "θ", "a", "i", "u", "aː", "iː", "uː", "ɑ", "ɑː" ], "max_tokens": 512, "max_frames": 3000, "step": 200000, "frontend": "tiny_voca.arabic_frontend", "frontend_fingerprint": "8b5781d0348623398ce7ce16b5013e1ccea1ee8dd2d6e9f9f3db0398ab0d32c2", "inputs": [ "tokens", "stress", "voice", "speed", "pitch_shift", "pitch_range" ], "outputs": [ "audio", "durations" ]}123version https://git-lfs.github.com/spec/v1oid sha256:31764dabc354a650efb8d49c65c09112e154dda513be6c4779bce2ab421825d0size 3806532123version https://git-lfs.github.com/spec/v1oid sha256:8f323fcb0c88d0be4f3f8e1e7190d8850d5107cb838f2096b8f82ed84332dd1fsize 328748123version https://git-lfs.github.com/spec/v1oid sha256:b800aea64a103a1b7c5023850f132d6ed4343f24bb224bd9728227f17c17bc41size 309804123version https://git-lfs.github.com/spec/v1oid sha256:a66e1913bc646e92281844cf85218b7094df7fdcd0bc6140a26a5dd8b290b57bsize 319660123version https://git-lfs.github.com/spec/v1oid sha256:cef0d08fdb4ca3b448031bc8f257fd3322bdfbfbd0b3442d9b47d1306092c1bdsize 301612123version https://git-lfs.github.com/spec/v1oid sha256:fb8e8ea9e8c6cc27f1b74cd608642211fb2cf56c3afa8bd6eea4ecfb5a41c664size 275116123version https://git-lfs.github.com/spec/v1oid sha256:3bd72b46cc85d127c4b061a37c243bd099b48636d2fd6f44776a141a351d0a34size 313900123version https://git-lfs.github.com/spec/v1oid sha256:7ab0936634ba2b5e94f743d156c432ae893405aa6cba0ec7b3a60eb8f572a344size 297004123version https://git-lfs.github.com/spec/v1oid sha256:a05ad0fcca1c8c9f8b9279c7ff5ea73df7601130388a9cba874b41e2d58f6273size 304300123version https://git-lfs.github.com/spec/v1oid sha256:922ecbbcd17fc630cb29a32899a68085dd127a7bbd4389705e036db471e5a954size 271404123version https://git-lfs.github.com/spec/v1oid sha256:1028bc362400b74944c6f41d066ef966cca19c13cfe099817a7a97da0c22f3b7size 293548123version https://git-lfs.github.com/spec/v1oid sha256:f03bfabca4e1a8898bcc701c20117c7f7fa36d7573048e716ccf34d3742bd118size 323628123version https://git-lfs.github.com/spec/v1oid sha256:c1846c2f896edd1c61bd1a327cca2df6a29eab923b64adc528225e372ec64b41size 307756123version https://git-lfs.github.com/spec/v1oid sha256:24e4754479ab820e677b9463202f54db51018dbfd80657fa0cdafb32df5e97cesize 337580123version https://git-lfs.github.com/spec/v1oid sha256:22f29ba0a1a68e550ceb8b7790c4dd9cd994656a063df7fbf513d79b99bed85fsize 294444123version https://git-lfs.github.com/spec/v1oid sha256:0ba6e87ec388e643f2122fd5f45e26d3780178a16b861f3fd3052e3114cd6fa1size 304300123version https://git-lfs.github.com/spec/v1oid sha256:f41828fc85458532298066850c19880b850657553c09368275e9f9aa3432e34fsize 390188123version https://git-lfs.github.com/spec/v1oid sha256:2fb85e200d2cc01226276946009aea888593201f3808644e6bbb5f9ffe5b8bb2size 369708123version https://git-lfs.github.com/spec/v1oid sha256:972bf9c1530829fd85bec273b36860692336d70e69433b77cfb1d6cbf7fbe480size 389292123version https://git-lfs.github.com/spec/v1oid sha256:a3e4b51a000eb425480df4ec011f409ca4568d583f36ec3bbcddbb5c086dc8a8size 352812123version https://git-lfs.github.com/spec/v1oid sha256:450c7899434be2e04bc7f39c21c99ed68da21c0ce6c180679e7d404fd4f56733size 351404123version https://git-lfs.github.com/spec/v1oid sha256:90cd736af4ff33ca1c44bffd5194b76bd24f0c3f18441c137cbef3972e96c114size 305196123version https://git-lfs.github.com/spec/v1oid sha256:11d23a18a86c00c82ac35b67b389a8ea840bf4967c926011d6080c1661f1fbf0size 289324123version https://git-lfs.github.com/spec/v1oid sha256:ac3287b9de95611918d33dedc8546b9fa1faab503499bc2331b1875595566726size 317612123version https://git-lfs.github.com/spec/v1oid sha256:a20237fdfc4c814b10e9a112af864b1b5747571a604a72eb9f339b9326c8f512size 282156123version https://git-lfs.github.com/spec/v1oid sha256:db3e43f453741fba92fa534f8920a5fa80008c98e10ba38a6541c8bfb4e48c08size 269484123version https://git-lfs.github.com/spec/v1oid sha256:880bf8c5f9302db0f2adf81e9e57ab49973b27939bf0545e1ecb6345c0f18235size 266284123version https://git-lfs.github.com/spec/v1oid sha256:75374d83df4f03b9b462e12bd8a617abe22391aeade631a32f9eb541ceae5d89size 252460123version https://git-lfs.github.com/spec/v1oid sha256:c35e412866769ed0df5ef649c48919d1978335e7e51f0b4bc00db59a8ce26d81size 286380123version https://git-lfs.github.com/spec/v1oid sha256:94df349f572d9c5b63a4dade6aefa8cd7194f7bb3e17b707895bd871d0f7b643size 252460123version https://git-lfs.github.com/spec/v1oid sha256:26e89a40a1a4e360e8752a0a144c0ea28b79816e9d483a7cd2ba44544717d78dsize 235180123version https://git-lfs.github.com/spec/v1oid sha256:9bcf6c4ace1a115d57edc8ab567541a28b71732d601d5f669bd2e3a050ec4925size 387116123version https://git-lfs.github.com/spec/v1oid sha256:2fd5ea947c57e8f686cf0d3f29eb39baeabc1eebae2293158f01fe3d31ceef34size 366636123version https://git-lfs.github.com/spec/v1oid sha256:810be326e0b67764c0014f1b012257e5d24d557c854031cda36d4b98b58318e5size 400044123version https://git-lfs.github.com/spec/v1oid sha256:e85ac5ed3e2dc2ff578619c56cc36fe4d3cb1a859b5297ed47310e7d03e173dasize 353324123version https://git-lfs.github.com/spec/v1oid sha256:a6fa9e1ed42d42112f1aaabf0636e1b18aee33283ffaccd02fb5162137105b5bsize 346796123version https://git-lfs.github.com/spec/v1oid sha256:02c4e139e86b2101c4a70f9b3ac9b542cf59f7f732c14830dbfe4d31fef948a8size 366636123version https://git-lfs.github.com/spec/v1oid sha256:36c14d1803f7bd5f2410253208504807ba94125c7cb8941d6b3082920dac6d5dsize 349740123version https://git-lfs.github.com/spec/v1oid sha256:e1a67534fcc4622f89630e299f5563f69a3c587bee048919d95d4b622800e59bsize 352940123version https://git-lfs.github.com/spec/v1oid sha256:9b13f62d456c3a8ce6d9295025c71b2b91586c6fb8a28879367150518604138dsize 324140123version https://git-lfs.github.com/spec/v1oid sha256:1e53f46f7f9c4a0f02ac89b0fa723fb69e7ec2a3e6a8a3d8b0a0398c71e606casize 318124.gitattributes+40
LICENSEAdded+202
README.mdAdded+184
atto-voca-arabic.ptAdded+3
code/arabic_frontend.pyAdded+337
code/numbers.pyAdded+75
code/text.pyAdded+138
config.jsonAdded+43
onnx/model.jsonAdded+82
onnx/model.onnxAdded+3
samples/a000-0.wavAdded+3
samples/a000-1.wavAdded+3
samples/a000-2.wavAdded+3
samples/a000-3.wavAdded+3
samples/a000-4.wavAdded+3
samples/am6-0.wavAdded+3
samples/am6-1.wavAdded+3
samples/am6-2.wavAdded+3
samples/am6-3.wavAdded+3
samples/am6-4.wavAdded+3
samples/nf2-0.wavAdded+3
samples/nf2-1.wavAdded+3
samples/nf2-2.wavAdded+3
samples/nf2-3.wavAdded+3
samples/nf2-4.wavAdded+3
samples/nm2-0.wavAdded+3
samples/nm2-1.wavAdded+3
samples/nm2-2.wavAdded+3
samples/nm2-3.wavAdded+3
samples/nm2-4.wavAdded+3
samples/pf4-0.wavAdded+3
samples/pf4-1.wavAdded+3
samples/pf4-2.wavAdded+3
samples/pf4-3.wavAdded+3
samples/pf4-4.wavAdded+3
samples/pm2-0.wavAdded+3
samples/pm2-1.wavAdded+3
samples/pm2-2.wavAdded+3
samples/pm2-3.wavAdded+3
samples/pm2-4.wavAdded+3
samples/sf1-0.wavAdded+3
samples/sf1-1.wavAdded+3
samples/sf1-2.wavAdded+3
samples/sf1-3.wavAdded+3
samples/sf1-4.wavAdded+3
samples/sm3-0.wavAdded+3
samples/sm3-1.wavAdded+3
samples/sm3-2.wavAdded+3
samples/sm3-3.wavAdded+3
samples/sm3-4.wavAdded+3