Text-to-Speech
English
deno34 commited on
Commit
42ca46a
·
verified ·
1 Parent(s): f644e49

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +146 -0
README.md ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - yl4579/StyleTTS2-LJSpeech
7
+ pipeline_tag: text-to-speech
8
+ ---
9
+ **Kokoro** is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, Kokoro can be deployed anywhere from production environments to personal projects.
10
+
11
+ <audio controls><source src="https://huggingface.co/hexgrad/Kokoro-82M/resolve/main/samples/HEARME.wav" type="audio/wav"></audio>
12
+
13
+ ⬆️ **Kokoro has been upgraded to v1.0!** See [Releases](https://huggingface.co/hexgrad/Kokoro-82M#releases).
14
+
15
+ 🚀 No-code Demo: https://hf.co/spaces/hexgrad/Kokoro-TTS
16
+
17
+ ✨ You can now [`pip install kokoro`](https://github.com/hexgrad/kokoro)! See [Usage](https://huggingface.co/hexgrad/Kokoro-82M#usage).
18
+
19
+ - [Releases](#releases)
20
+ - [Usage](#usage)
21
+ - [EVAL.md](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/EVAL.md) ↗️
22
+ - [SAMPLES.md](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/SAMPLES.md) ↗️
23
+ - [VOICES.md](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md) ↗️
24
+ - [Model Facts](#model-facts)
25
+ - [Training Details](#training-details)
26
+ - [Creative Commons Attribution](#creative-commons-attribution)
27
+ - [Acknowledgements](#acknowledgements)
28
+
29
+ ### Releases
30
+
31
+ | Model | Published | Training Data | Langs & Voices | SHA256 |
32
+ | ----- | --------- | ------------- | -------------- | ------ |
33
+ | **v1.0** | **2025 Jan 27** | **Few hundred hrs** | [**8 & 54**](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md) | `496dba11` |
34
+ | [v0.19](https://huggingface.co/hexgrad/kLegacy/tree/main/v0.19) | 2024 Dec 25 | <100 hrs | 1 & 10 | `3b0c392f` |
35
+
36
+ | Training Costs | v0.19 | v1.0 | **Total** |
37
+ | -------------- | ----- | ---- | ----- |
38
+ | in A100 80GB GPU hours | 500 | 500 | **1000** |
39
+ | average hourly rate | $0.80/h | $1.20/h | **$1/h** |
40
+ | in USD | $400 | $600 | **$1000** |
41
+
42
+ ### Usage
43
+
44
+ [`pip install kokoro`](https://pypi.org/project/kokoro/) installs the inference library at https://github.com/hexgrad/kokoro
45
+
46
+ You can run this cell on [Google Colab](https://colab.research.google.com/). [Listen to samples](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/SAMPLES.md).
47
+ ```py
48
+ # 1️⃣ Install kokoro
49
+ !pip install -q kokoro>=0.8.2 soundfile
50
+ # 2️⃣ Install espeak, used for English OOD fallback and some non-English languages
51
+ !apt-get -qq -y install espeak-ng > /dev/null 2>&1
52
+ # 🇪🇸 'e' => Spanish es
53
+ # 🇫🇷 'f' => French fr-fr
54
+ # 🇮🇳 'h' => Hindi hi
55
+ # 🇮🇹 'i' => Italian it
56
+ # 🇧🇷 'p' => Brazilian Portuguese pt-br
57
+
58
+ # 3️⃣ Initalize a pipeline
59
+ from kokoro import KPipeline
60
+ from IPython.display import display, Audio
61
+ import soundfile as sf
62
+ # 🇺🇸 'a' => American English, 🇬🇧 'b' => British English
63
+ # 🇯🇵 'j' => Japanese: pip install misaki[ja]
64
+ # 🇨🇳 'z' => Mandarin Chinese: pip install misaki[zh]
65
+ pipeline = KPipeline(lang_code='a') # <= make sure lang_code matches voice
66
+
67
+ # This text is for demonstration purposes only, unseen during training
68
+ text = '''
69
+ The sky above the port was the color of television, tuned to a dead channel.
70
+ "It's not like I'm using," Case heard someone say, as he shouldered his way through the crowd around the door of the Chat. "It's like my body's developed this massive drug deficiency."
71
+ It was a Sprawl voice and a Sprawl joke. The Chatsubo was a bar for professional expatriates; you could drink there for a week and never hear two words in Japanese.
72
+
73
+ These were to have an enormous impact, not only because they were associated with Constantine, but also because, as in so many other areas, the decisions taken by Constantine (or in his name) were to have great significance for centuries to come. One of the main issues was the shape that Christian churches were to take, since there was not, apparently, a tradition of monumental church buildings when Constantine decided to help the Christian church build a series of truly spectacular structures. The main form that these churches took was that of the basilica, a multipurpose rectangular structure, based ultimately on the earlier Greek stoa, which could be found in most of the great cities of the empire. Christianity, unlike classical polytheism, needed a large interior space for the celebration of its religious services, and the basilica aptly filled that need. We naturally do not know the degree to which the emperor was involved in the design of new churches, but it is tempting to connect this with the secular basilica that Constantine completed in the Roman forum (the so-called Basilica of Maxentius) and the one he probably built in Trier, in connection with his residence in the city at a time when he was still caesar.
74
+
75
+ [Kokoro](/kˈOkəɹO/) is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, [Kokoro](/kˈOkəɹO/) can be deployed anywhere from production environments to personal projects.
76
+ '''
77
+ # text = '「もしおれがただ偶然、そしてこうしようというつもりでなくここに立っているのなら、ちょっとばかり絶望するところだな」と、そんなことが彼の頭に思い浮かんだ。'
78
+ # text = '中國人民不信邪也不怕邪,不惹事也不怕事,任何外國不要指望我們會拿自己的核心利益做交易,不要指望我們會吞下損害我國主權、安全、發展利益的苦果!'
79
+ # text = 'Los partidos políticos tradicionales compiten con los populismos y los movimientos asamblearios.'
80
+ # text = 'Le dromadaire resplendissant déambulait tranquillement dans les méandres en mastiquant de petites feuilles vernissées.'
81
+ # text = 'ट्रांसपोर्टरों की हड़ताल लगातार पांचवें दिन जारी, दिसंबर से इलेक्ट्रॉनिक टोल कलेक्शनल सिस्टम'
82
+ # text = "Allora cominciava l'insonnia, o un dormiveglia peggiore dell'insonnia, che talvolta assumeva i caratteri dell'incubo."
83
+ # text = 'Elabora relatórios de acompanhamento cronológico para as diferentes unidades do Departamento que propõem contratos.'
84
+
85
+ # 4️⃣ Generate, display, and save audio files in a loop.
86
+ generator = pipeline(
87
+ text, voice='af_heart', # <= change voice here
88
+ speed=1, split_pattern=r'\n+'
89
+ )
90
+ for i, (gs, ps, audio) in enumerate(generator):
91
+ print(i) # i => index
92
+ print(gs) # gs => graphemes/text
93
+ print(ps) # ps => phonemes
94
+ display(Audio(data=audio, rate=24000, autoplay=i==0))
95
+ sf.write(f'{i}.wav', audio, 24000) # save each audio file
96
+ ```
97
+
98
+ Under the hood, `kokoro` uses [`misaki`](https://pypi.org/project/misaki/), a G2P library at https://github.com/hexgrad/misaki
99
+
100
+ ### Model Facts
101
+
102
+ **Architecture:**
103
+ - StyleTTS 2: https://arxiv.org/abs/2306.07691
104
+ - ISTFTNet: https://arxiv.org/abs/2203.02395
105
+ - Decoder only: no diffusion, no encoder release
106
+
107
+ **Architected by:** Li et al @ https://github.com/yl4579/StyleTTS2
108
+
109
+ **Trained by**: `@rzvzn` on Discord
110
+
111
+ **Languages:** Multiple
112
+
113
+ **Model SHA256 Hash:** `496dba118d1a58f5f3db2efc88dbdc216e0483fc89fe6e47ee1f2c53f18ad1e4`
114
+
115
+ ### Training Details
116
+
117
+ **Data:** Kokoro was trained exclusively on **permissive/non-copyrighted audio data** and IPA phoneme labels. Examples of permissive/non-copyrighted audio include:
118
+ - Public domain audio
119
+ - Audio licensed under Apache, MIT, etc
120
+ - Synthetic audio<sup>[1]</sup> generated by closed<sup>[2]</sup> TTS models from large providers<br/>
121
+ [1] https://copyright.gov/ai/ai_policy_guidance.pdf<br/>
122
+ [2] No synthetic audio from open TTS models or "custom voice clones"
123
+
124
+ **Total Dataset Size:** A few hundred hours of audio
125
+
126
+ **Total Training Cost:** About $1000 for 1000 hours of A100 80GB vRAM
127
+
128
+ ### Creative Commons Attribution
129
+
130
+ The following CC BY audio was part of the dataset used to train Kokoro v1.0.
131
+
132
+ | Audio Data | Duration Used | License | Added to Training Set After |
133
+ | ---------- | ------------- | ------- | --------------------------- |
134
+ | [Koniwa](https://github.com/koniwa/koniwa) `tnc` | <1h | [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/deed.ja) | v0.19 / 22 Nov 2024 |
135
+ | [SIWIS](https://datashare.ed.ac.uk/handle/10283/2353) | <11h | [CC BY 4.0](https://datashare.ed.ac.uk/bitstream/handle/10283/2353/license_text) | v0.19 / 22 Nov 2024 |
136
+
137
+ ### Acknowledgements
138
+
139
+ - 🛠️ [@yl4579](https://huggingface.co/yl4579) for architecting StyleTTS 2.
140
+ - 🏆 [@Pendrokar](https://huggingface.co/Pendrokar) for adding Kokoro as a contender in the TTS Spaces Arena.
141
+ - 📊 Thank you to everyone who contributed synthetic training data.
142
+ - ❤️ Special thanks to all compute sponsors.
143
+ - 👾 Discord server: https://discord.gg/QuGxSWBfQy
144
+ - 🪽 Kokoro is a Japanese word that translates to "heart" or "spirit". Kokoro is also the name of an [AI in the Terminator franchise](https://terminator.fandom.com/wiki/Kokoro).
145
+
146
+ <img src="https://static0.gamerantimages.com/wordpress/wp-content/uploads/2024/08/terminator-zero-41-1.jpg" width="400" alt="kokoro" />