omnivoice 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. omnivoice-0.1.0/.gitignore +30 -0
  2. omnivoice-0.1.0/LICENSE +201 -0
  3. omnivoice-0.1.0/PKG-INFO +333 -0
  4. omnivoice-0.1.0/README.md +295 -0
  5. omnivoice-0.1.0/omnivoice/__init__.py +28 -0
  6. omnivoice-0.1.0/omnivoice/cli/__init__.py +0 -0
  7. omnivoice-0.1.0/omnivoice/cli/demo.py +533 -0
  8. omnivoice-0.1.0/omnivoice/cli/infer.py +157 -0
  9. omnivoice-0.1.0/omnivoice/cli/infer_batch.py +523 -0
  10. omnivoice-0.1.0/omnivoice/cli/train.py +74 -0
  11. omnivoice-0.1.0/omnivoice/data/__init__.py +0 -0
  12. omnivoice-0.1.0/omnivoice/data/batching.py +166 -0
  13. omnivoice-0.1.0/omnivoice/data/collator.py +92 -0
  14. omnivoice-0.1.0/omnivoice/data/dataset.py +551 -0
  15. omnivoice-0.1.0/omnivoice/data/processor.py +258 -0
  16. omnivoice-0.1.0/omnivoice/eval/__init__.py +4 -0
  17. omnivoice-0.1.0/omnivoice/eval/models/ecapa_tdnn_wavlm.py +374 -0
  18. omnivoice-0.1.0/omnivoice/eval/models/utmos.py +370 -0
  19. omnivoice-0.1.0/omnivoice/eval/mos/utmos.py +299 -0
  20. omnivoice-0.1.0/omnivoice/eval/speaker_similarity/sim.py +321 -0
  21. omnivoice-0.1.0/omnivoice/eval/utils.py +80 -0
  22. omnivoice-0.1.0/omnivoice/eval/wer/common.py +88 -0
  23. omnivoice-0.1.0/omnivoice/eval/wer/fleurs.py +517 -0
  24. omnivoice-0.1.0/omnivoice/eval/wer/hubert.py +318 -0
  25. omnivoice-0.1.0/omnivoice/eval/wer/minimax.py +596 -0
  26. omnivoice-0.1.0/omnivoice/eval/wer/norm_config_module.py +291 -0
  27. omnivoice-0.1.0/omnivoice/eval/wer/punctuations.lst +188 -0
  28. omnivoice-0.1.0/omnivoice/eval/wer/seedtts.py +413 -0
  29. omnivoice-0.1.0/omnivoice/eval/wer/sensevoice.py +344 -0
  30. omnivoice-0.1.0/omnivoice/eval/wer/text_norm_omni.py +113 -0
  31. omnivoice-0.1.0/omnivoice/models/__init__.py +0 -0
  32. omnivoice-0.1.0/omnivoice/models/omnivoice.py +1502 -0
  33. omnivoice-0.1.0/omnivoice/scripts/__init__.py +0 -0
  34. omnivoice-0.1.0/omnivoice/scripts/denoise_audio.py +1048 -0
  35. omnivoice-0.1.0/omnivoice/scripts/extract_audio_tokens.py +625 -0
  36. omnivoice-0.1.0/omnivoice/scripts/extract_audio_tokens_add_noise.py +825 -0
  37. omnivoice-0.1.0/omnivoice/scripts/jsonl_to_webdataset.py +439 -0
  38. omnivoice-0.1.0/omnivoice/training/__init__.py +0 -0
  39. omnivoice-0.1.0/omnivoice/training/builder.py +180 -0
  40. omnivoice-0.1.0/omnivoice/training/checkpoint.py +180 -0
  41. omnivoice-0.1.0/omnivoice/training/config.py +98 -0
  42. omnivoice-0.1.0/omnivoice/training/trainer.py +342 -0
  43. omnivoice-0.1.0/omnivoice/utils/__init__.py +0 -0
  44. omnivoice-0.1.0/omnivoice/utils/audio.py +355 -0
  45. omnivoice-0.1.0/omnivoice/utils/common.py +56 -0
  46. omnivoice-0.1.0/omnivoice/utils/data_utils.py +63 -0
  47. omnivoice-0.1.0/omnivoice/utils/duration.py +282 -0
  48. omnivoice-0.1.0/omnivoice/utils/lang_map.py +698 -0
  49. omnivoice-0.1.0/omnivoice/utils/text.py +219 -0
  50. omnivoice-0.1.0/omnivoice/utils/voice_design.py +66 -0
  51. omnivoice-0.1.0/pyproject.toml +90 -0
@@ -0,0 +1,30 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ *.egg
6
+ dist/
7
+ build/
8
+ .venv/
9
+ .env
10
+ .DS_Store
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ *.so
15
+ /.cache*
16
+ /exp*/
17
+ /.tmp/
18
+ /results/
19
+ /data/
20
+ /download
21
+ /local/
22
+ /run*
23
+ example.py
24
+ results/
25
+ examples/data*
26
+ examples/download*
27
+ examples/exp*/
28
+ .claude/
29
+ *.wav
30
+ *.jsonl
@@ -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 2026 Xiaomi Corp.
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.
@@ -0,0 +1,333 @@
1
+ Metadata-Version: 2.4
2
+ Name: omnivoice
3
+ Version: 0.1.0
4
+ Summary: OmniVoice: Towards Omnilingual Zero-Shot Text-to-Speech with Diffusion Language Models
5
+ Project-URL: Homepage, https://github.com/k2-fsa/OmniVoice
6
+ Project-URL: Repository, https://github.com/k2-fsa/OmniVoice
7
+ Project-URL: Bug Tracker, https://github.com/k2-fsa/OmniVoice/issues
8
+ Author: Han Zhu
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: diffusion,multilingual,speech-synthesis,text-to-speech,tts,voice-cloning,zero-shot
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: accelerate
20
+ Requires-Dist: gradio
21
+ Requires-Dist: numpy
22
+ Requires-Dist: pydub
23
+ Requires-Dist: soundfile
24
+ Requires-Dist: tensorboardx
25
+ Requires-Dist: torch==2.8.*
26
+ Requires-Dist: torchaudio==2.8.*
27
+ Requires-Dist: transformers==5.3.0
28
+ Requires-Dist: webdataset
29
+ Provides-Extra: eval
30
+ Requires-Dist: funasr; extra == 'eval'
31
+ Requires-Dist: jiwer==3.1.0; extra == 'eval'
32
+ Requires-Dist: librosa; extra == 'eval'
33
+ Requires-Dist: s3prl; extra == 'eval'
34
+ Requires-Dist: unidecode; extra == 'eval'
35
+ Requires-Dist: zhconv; extra == 'eval'
36
+ Requires-Dist: zhon; extra == 'eval'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # OmniVoice 🌍
40
+
41
+ <p align="center">
42
+ <img width="200" height="200" alt="OmniVoice" src="assets/omnivoice.jpg" />
43
+ </p>
44
+
45
+ <p align="center">
46
+ <a href="https://huggingface.co/k2-fsa/OmniVoice"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Model-FFD21E" alt="Hugging Face Model"></a>
47
+ &nbsp;
48
+ <a href="https://huggingface.co/spaces/k2-fsa/OmniVoice"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Space-blue" alt="Hugging Face Space"></a>
49
+ &nbsp;
50
+ <a href="https://arxiv.org/abs/2604.00688"><img src="https://img.shields.io/badge/arXiv-Paper-B31B1B.svg"></a>
51
+ &nbsp;
52
+ <a href="https://zhu-han.github.io/omnivoice"><img src="https://img.shields.io/badge/GitHub.io-Demo_Page-blue?logo=GitHub&style=flat-square"></a>
53
+ </p>
54
+
55
+ OmniVoice is a state-of-the-art zero-shot multilingual TTS model supporting more than 600 languages. Built on a novel diffusion language model architecture, it generates high-quality speech with superior inference speed, supporting voice cloning and voice design.
56
+
57
+ **Contents**: [Key Features](#key-features) | [Installation](#installation) | [Quick Start](#quick-start) | [Python API](#python-api) | [Command-Line Tools](#command-line-tools) | [Training & Evaluation](#training--evaluation) | [Discussion](#discussion--communication) | [Citation](#citation)
58
+
59
+ ## Key Features
60
+
61
+ - **600+ Languages Supported**: The broadest language coverage among zero-shot TTS models ([full list](docs/languages.md))
62
+ - **Voice Cloning**: State-of-the-art voice cloning quality.
63
+ - **Voice Design**: Control voices via assigned speaker attributes (gender, age, pitch, dialect/accent, whisper, etc.).
64
+ - **Fast Inference**: RTF as low as 0.025 (40x faster than real-time).
65
+ - **Diffusion Language Model Architecture**: A clean, streamlined, and scalable design that delivers both quality and speed.
66
+
67
+ ---
68
+
69
+ ## Installation
70
+
71
+ Choose **one** of the following methods: **pip** or **uv**.
72
+
73
+ ### pip
74
+
75
+ > We recommend using a fresh virtual environment (e.g., `conda`, `venv`, etc.) to avoid conflicts.
76
+
77
+ **Step 1**: Install PyTorch
78
+
79
+ <details>
80
+ <summary>NVIDIA GPU</summary>
81
+
82
+ ```bash
83
+ # Install pytorch with your CUDA version, e.g.
84
+ pip install torch==2.8.0+cu128 torchaudio==2.8.0+cu128 --extra-index-url https://download.pytorch.org/whl/cu128
85
+ ```
86
+ > See [PyTorch official site](https://pytorch.org/get-started/locally/) for other versions installation.
87
+
88
+ </details>
89
+
90
+ <details>
91
+ <summary>Apple Silicon</summary>
92
+
93
+ ```bash
94
+ pip install torch==2.8.0 torchaudio==2.8.0
95
+ ```
96
+
97
+ </details>
98
+
99
+ **Step 2**: Install OmniVoice (choose one)
100
+
101
+ ```bash
102
+ # From PyPI (stable release)
103
+ pip install omnivoice
104
+
105
+ # From the latest source on GitHub (no need to clone)
106
+ pip install git+https://github.com/k2-fsa/OmniVoice.git
107
+
108
+ # For development (clone first, editable install)
109
+ git clone https://github.com/k2-fsa/OmniVoice.git
110
+ cd OmniVoice
111
+ pip install -e .
112
+ ```
113
+
114
+ ### uv
115
+
116
+ Clone the repository and sync dependencies:
117
+
118
+ ```bash
119
+ git clone https://github.com/k2-fsa/OmniVoice.git
120
+ cd OmniVoice
121
+ uv sync
122
+ ```
123
+
124
+ > **Tip**: Can use mirror with `uv sync --default-index "https://mirrors.aliyun.com/pypi/simple"`
125
+
126
+ ---
127
+
128
+ ## Quick Start
129
+
130
+ Try OmniVoice without coding:
131
+
132
+ - Launch the local web UI: `omnivoice-demo --ip 0.0.0.0 --port 8001`
133
+
134
+
135
+ - Or try it directly on [HuggingFace Space](https://huggingface.co/spaces/k2-fsa/OmniVoice)
136
+
137
+ > If you have trouble connecting to HuggingFace when downloading the pre-trained models, set `export HF_ENDPOINT="https://hf-mirror.com"` before running.
138
+
139
+ For full usage, see the [Python API](#python-api) and [Command-Line Tools](#command-line-tools) sections below.
140
+
141
+ ---
142
+
143
+ ## Python API
144
+
145
+ The OmniVoice model supports three generation modes. All features in this section are also available via [command-line tools](#command-line-tools).
146
+
147
+ ### Voice Cloning
148
+
149
+ Clone a voice from a short reference audio. Provide `ref_audio` and `ref_text`:
150
+
151
+ ```python
152
+ from omnivoice import OmniVoice
153
+ import torch
154
+ import torchaudio
155
+
156
+ model = OmniVoice.from_pretrained(
157
+ "k2-fsa/OmniVoice",
158
+ device_map="cuda:0",
159
+ dtype=torch.float16
160
+ )
161
+ # Apple Silicon users: use device_map="mps" instead
162
+
163
+ audio = model.generate(
164
+ text="Hello, this is a test of zero-shot voice cloning.",
165
+ ref_audio="ref.wav",
166
+ ref_text="Transcription of the reference audio.",
167
+ ) # audio is a list of `torch.Tensor` with shape (1, T) at 24 kHz.
168
+
169
+ # If you don't want to input `ref_text` manually, you can directly omit the `ref_text`.
170
+ # The model will use Whisper ASR to auto-transcribe it.
171
+
172
+ torchaudio.save("out.wav", audio[0], 24000)
173
+ ```
174
+
175
+ ### Voice Design
176
+
177
+ Describe the desired voice with speaker attributes — no reference audio needed.
178
+ Supported attributes: **gender** (male/female), **age** (child to elderly),
179
+ **pitch** (very low to very high), **style** (whisper), **English accent**
180
+ (American, British, etc.), and **Chinese dialect** (四川话, 陕西话, etc.).
181
+ Attributes are comma-separated and freely combinable across categories.
182
+
183
+ ```python
184
+ audio = model.generate(
185
+ text="Hello, this is a test of zero-shot voice design.",
186
+ instruct="female, low pitch, british accent",
187
+ )
188
+ ```
189
+
190
+ See [docs/voice-design.md](docs/voice-design.md) for the full attribute
191
+ reference, Chinese equivalents, and usage tips.
192
+
193
+ ### Auto Voice
194
+
195
+ Let the model choose a voice automatically:
196
+
197
+ ```python
198
+ audio = model.generate(text="This is a sentence without any voice prompt.")
199
+ ```
200
+
201
+ ### Generation Parameters
202
+
203
+ All above three modes share the same `model.generate()` API. You can further control the generation behavior via keyword arguments:
204
+
205
+ ```python
206
+ audio = model.generate(
207
+ text="...",
208
+ num_step=32, # diffusion steps (or 16 for faster inference)
209
+ speed=1.0, # speed factor (>1.0 faster, <1.0 slower)
210
+ duration=10.0, # fixed output duration in seconds (overrides speed)
211
+ # ... more options
212
+ )
213
+ ```
214
+ See more detailed control in [docs/generation-parameters.md](docs/generation-parameters.md).
215
+
216
+ ### Non-Verbal & Pronunciation Control
217
+
218
+ OmniVoice supports inline **non-verbal symbols** and **pronunciation hints** within the input text.
219
+
220
+ **Non-verbal symbols**: Insert tags like `[laughter]` directly in the text to add expressive non-verbal sounds.
221
+
222
+ ```python
223
+ audio = model.generate(text="[laughter] You really got me. I didn't see that coming at all.")
224
+ ```
225
+
226
+ Supported tags: `[laughter]`, `[confirmation-en]`, `[question-en]`, `[question-ah]`, `[question-oh]`, `[question-ei]`, `[question-yi]`, `[surprise-ah]`, `[surprise-oh]`, `[surprise-wa]`, `[surprise-yo]`, `[dissatisfaction-hnn]`, `[sniff]`, `[sigh]`
227
+
228
+ **Pronunciation control (Chinese)**: Use pinyin with tone numbers to correct specific character pronunciations.
229
+
230
+ ```python
231
+ audio = model.generate(text="这批货物打ZHE2出售后他严重SHE2本了,再也经不起ZHE1腾了。")
232
+ ```
233
+
234
+ **Pronunciation control (English)**: Use [CMU pronunciation dictionary](https://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict.0.7a) (uppercase, in brackets) to override default English pronunciations.
235
+
236
+ ```python
237
+ audio = model.generate(text="You could probably still make [IH1 T] look good.")
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Command-Line Tools
243
+
244
+ Three CLI entry points are provided. The CLI tools support all features available in the Python API (voice cloning, voice design, auto voice, generation parameters, etc.) — all controlled via command-line arguments.
245
+
246
+ | Command | Description | Source |
247
+ |---|---|---|
248
+ | `omnivoice-demo` | Interactive Gradio web demo | [omnivoice/cli/demo.py](omnivoice/cli/demo.py) |
249
+ | `omnivoice-infer` | Single-item inference | [omnivoice/cli/infer.py](omnivoice/cli/infer.py) |
250
+ | `omnivoice-infer-batch` | Batch inference across multiple GPUs | [omnivoice/cli/infer_batch.py](omnivoice/cli/infer_batch.py) |
251
+
252
+ ### Demo
253
+
254
+ ```bash
255
+ omnivoice-demo --ip 0.0.0.0 --port 8001
256
+ ```
257
+
258
+ Provides a web UI for voice cloning and voice design. See `omnivoice-demo --help` for all options.
259
+
260
+ ### Single Inference
261
+
262
+ ```bash
263
+ # Voice Cloning
264
+ # ref_text can be omitted (Whisper will auto-transcribe ref_audio to get it).
265
+ omnivoice-infer \
266
+ --model k2-fsa/OmniVoice \
267
+ --text "This is a test for text to speech." \
268
+ --ref_audio ref.wav \
269
+ --ref_text "Transcription of the reference audio." \
270
+ --output hello.wav
271
+
272
+ # Voice Design
273
+ omnivoice-infer --model k2-fsa/OmniVoice \
274
+ --text "This is a test for text to speech." \
275
+ --instruct "male, British accent" \
276
+ --output hello.wav
277
+
278
+ # Auto Voice
279
+ omnivoice-infer \
280
+ --model k2-fsa/OmniVoice \
281
+ --text "This is a test for text to speech."\
282
+ --output hello.wav
283
+ ```
284
+
285
+ ### Batch Inference
286
+
287
+ `omnivoice-infer-batch` can distribute batch inference across multiple GPUs, designed for large-scale TTS tasks.
288
+
289
+ ```bash
290
+ omnivoice-infer-batch \
291
+ --model k2-fsa/OmniVoice \
292
+ --test_list test.jsonl \
293
+ --res_dir results/
294
+ ```
295
+
296
+ The test list is a JSONL file where each line is a JSON object:
297
+ ```json
298
+ {"id": "sample_001", "text": "Hello world", "ref_audio": "/path/to/ref.wav", "ref_text": "Reference transcript", "instruct": "female, british accent", "language_id": "en", "language_name": "English", "duration": 10.0, "speed": 1.0}
299
+ ```
300
+ Only `id` and `text` are mandatory fields. `ref_audio` and `ref_text` are used in voice cloning mode. `instruct` is used in voice design mode. If no reference audio or instruct are provided, the model will generate text in a random voice.
301
+
302
+ `language_id`, `language_name`, `duration`, and `speed` are optional. `duration` (in seconds) fixes the output length; `speed` controls the speaking rate. If `duration` and `speed` are both provided, `speed` will be ignored.
303
+
304
+ ---
305
+
306
+ ## Training & Evaluation
307
+
308
+ See [examples/](examples/) for the complete pipeline — from data preparation to training, evaluation, and finetuning.
309
+
310
+ ---
311
+
312
+ ## Discussion & Communication
313
+
314
+ You can directly discuss on [GitHub Issues](https://github.com/k2-fsa/OmniVoice/issues).
315
+
316
+ You can also scan the QR code to join our wechat group or follow our wechat official account.
317
+
318
+ | Wechat Group | Wechat Official Account |
319
+ | ------------ | ----------------------- |
320
+ |![wechat](https://k2-fsa.org/zh-CN/assets/pic/wechat_group.jpg) |![wechat](https://k2-fsa.org/zh-CN/assets/pic/wechat_account.jpg) |
321
+
322
+ ---
323
+
324
+ ## Citation
325
+
326
+ ```bibtex
327
+ @article{zhu2026omnivoice,
328
+ title={OmniVoice: Towards Omnilingual Zero-Shot Text-to-Speech with Diffusion Language Models},
329
+ author={Zhu, Han and Ye, Lingxuan and Kang, Wei and Yao, Zengwei and Guo, Liyong and Kuang, Fangjun and Han, Zhifeng and Zhuang, Weiji and Lin, Long and Povey, Daniel},
330
+ journal={arXiv preprint arXiv:2604.00688},
331
+ year={2026}
332
+ }
333
+ ```