QbethQ commited on
Commit
13787d9
·
0 Parent(s):

Initial commit

Browse files
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
LICENSE ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Tencent is pleased to support the open source community by making Universal_Audio_Tokenizer available.
2
+
3
+ Copyright (C) 2026 Tencent. All rights reserved.
4
+
5
+ The open-source software and/or models included in this distribution may have been modified by Tencent (“Tencent Modifications”). All Tencent Modifications are Copyright (C) Tencent.
6
+
7
+ Universal_Audio_Tokenizer is licensed under the License Terms of Universal_Audio_Tokenizer, except for the third-party components listed below, which remain licensed under their respective original terms. Universal_Audio_Tokenizer does not impose any additional restrictions beyond those specified in the original licenses of these third-party components. Users are required to comply with all applicable terms and conditions of the original licenses and to ensure that the use of these third-party components conforms to all relevant laws and regulations.
8
+
9
+ For the avoidance of doubt, Universal_Audio_Tokenizer refers solely to code, parameters, and weights made publicly available by Tencent in accordance with the License Terms of Universal_Audio_Tokenizer.
10
+
11
+ Terms of the License Terms of Universal_Audio_Tokenizer:
12
+ --------------------------------------------------------------------
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
14
+
15
+ 1. Universal_Audio_Tokenizer IS NOT INTENDED FOR USE WITHIN THE EUROPEAN UNION.
16
+
17
+ 2. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+
21
+
22
+
23
+ Dependencies and Licenses:
24
+
25
+ This open-source project, Universal_Audio_Tokenizer, builds upon the following open-source models and/or software components, each of which remains licensed under its original license. Certain models or software may include modifications made by Tencent (“Tencent Modifications”), which are Copyright (C) Tencent.
26
+
27
+ In case you believe there have been errors in the attribution below, you may submit the concerns to us for review and correction.
28
+
29
+
30
+ Open Source Model Licensed under the Apache-2.0:
31
+ --------------------------------------------------------------------
32
+ 1. whisper-large-v3
33
+ Copyright (c) whisper-large-v3 original author and authors
34
+ Please note this model has been modified by Tencent in this distribution.
35
+
36
+
37
+
38
+ Terms of the Apache-2.0:
39
+ --------------------------------------------------------------------
40
+ Apache License
41
+ Version 2.0, January 2004
42
+ http://www.apache.org/licenses/
43
+
44
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
45
+
46
+ 1. Definitions.
47
+
48
+ "License" shall mean the terms and conditions for use, reproduction,
49
+ and distribution as defined by Sections 1 through 9 of this document.
50
+
51
+ "Licensor" shall mean the copyright owner or entity authorized by
52
+ the copyright owner that is granting the License.
53
+
54
+ "Legal Entity" shall mean the union of the acting entity and all
55
+ other entities that control, are controlled by, or are under common
56
+ control with that entity. For the purposes of this definition,
57
+ "control" means (i) the power, direct or indirect, to cause the
58
+ direction or management of such entity, whether by contract or
59
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
60
+ outstanding shares, or (iii) beneficial ownership of such entity.
61
+
62
+ "You" (or "Your") shall mean an individual or Legal Entity
63
+ exercising permissions granted by this License.
64
+
65
+ "Source" form shall mean the preferred form for making modifications,
66
+ including but not limited to software source code, documentation
67
+ source, and configuration files.
68
+
69
+ "Object" form shall mean any form resulting from mechanical
70
+ transformation or translation of a Source form, including but
71
+ not limited to compiled object code, generated documentation,
72
+ and conversions to other media types.
73
+
74
+ "Work" shall mean the work of authorship, whether in Source or
75
+ Object form, made available under the License, as indicated by a
76
+ copyright notice that is included in or attached to the work
77
+ (an example is provided in the Appendix below).
78
+
79
+ "Derivative Works" shall mean any work, whether in Source or Object
80
+ form, that is based on (or derived from) the Work and for which the
81
+ editorial revisions, annotations, elaborations, or other modifications
82
+ represent, as a whole, an original work of authorship. For the purposes
83
+ of this License, Derivative Works shall not include works that remain
84
+ separable from, or merely link (or bind by name) to the interfaces of,
85
+ the Work and Derivative Works thereof.
86
+
87
+ "Contribution" shall mean any work of authorship, including
88
+ the original version of the Work and any modifications or additions
89
+ to that Work or Derivative Works thereof, that is intentionally
90
+ submitted to Licensor for inclusion in the Work by the copyright owner
91
+ or by an individual or Legal Entity authorized to submit on behalf of
92
+ the copyright owner. For the purposes of this definition, "submitted"
93
+ means any form of electronic, verbal, or written communication sent
94
+ to the Licensor or its representatives, including but not limited to
95
+ communication on electronic mailing lists, source code control systems,
96
+ and issue tracking systems that are managed by, or on behalf of, the
97
+ Licensor for the purpose of discussing and improving the Work, but
98
+ excluding communication that is conspicuously marked or otherwise
99
+ designated in writing by the copyright owner as "Not a Contribution."
100
+
101
+ "Contributor" shall mean Licensor and any individual or Legal Entity
102
+ on behalf of whom a Contribution has been received by Licensor and
103
+ subsequently incorporated within the Work.
104
+
105
+ 2. Grant of Copyright License. Subject to the terms and conditions of
106
+ this License, each Contributor hereby grants to You a perpetual,
107
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
108
+ copyright license to reproduce, prepare Derivative Works of,
109
+ publicly display, publicly perform, sublicense, and distribute the
110
+ Work and such Derivative Works in Source or Object form.
111
+
112
+ 3. Grant of Patent License. Subject to the terms and conditions of
113
+ this License, each Contributor hereby grants to You a perpetual,
114
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
115
+ (except as stated in this section) patent license to make, have made,
116
+ use, offer to sell, sell, import, and otherwise transfer the Work,
117
+ where such license applies only to those patent claims licensable
118
+ by such Contributor that are necessarily infringed by their
119
+ Contribution(s) alone or by combination of their Contribution(s)
120
+ with the Work to which such Contribution(s) was submitted. If You
121
+ institute patent litigation against any entity (including a
122
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
123
+ or a Contribution incorporated within the Work constitutes direct
124
+ or contributory patent infringement, then any patent licenses
125
+ granted to You under this License for that Work shall terminate
126
+ as of the date such litigation is filed.
127
+
128
+ 4. Redistribution. You may reproduce and distribute copies of the
129
+ Work or Derivative Works thereof in any medium, with or without
130
+ modifications, and in Source or Object form, provided that You
131
+ meet the following conditions:
132
+
133
+ (a) You must give any other recipients of the Work or
134
+ Derivative Works a copy of this License; and
135
+
136
+ (b) You must cause any modified files to carry prominent notices
137
+ stating that You changed the files; and
138
+
139
+ (c) You must retain, in the Source form of any Derivative Works
140
+ that You distribute, all copyright, patent, trademark, and
141
+ attribution notices from the Source form of the Work,
142
+ excluding those notices that do not pertain to any part of
143
+ the Derivative Works; and
144
+
145
+ (d) If the Work includes a "NOTICE" text file as part of its
146
+ distribution, then any Derivative Works that You distribute must
147
+ include a readable copy of the attribution notices contained
148
+ within such NOTICE file, excluding those notices that do not
149
+ pertain to any part of the Derivative Works, in at least one
150
+ of the following places: within a NOTICE text file distributed
151
+ as part of the Derivative Works; within the Source form or
152
+ documentation, if provided along with the Derivative Works; or,
153
+ within a display generated by the Derivative Works, if and
154
+ wherever such third-party notices normally appear. The contents
155
+ of the NOTICE file are for informational purposes only and
156
+ do not modify the License. You may add Your own attribution
157
+ notices within Derivative Works that You distribute, alongside
158
+ or as an addendum to the NOTICE text from the Work, provided
159
+ that such additional attribution notices cannot be construed
160
+ as modifying the License.
161
+
162
+ You may add Your own copyright statement to Your modifications and
163
+ may provide additional or different license terms and conditions
164
+ for use, reproduction, or distribution of Your modifications, or
165
+ for any such Derivative Works as a whole, provided Your use,
166
+ reproduction, and distribution of the Work otherwise complies with
167
+ the conditions stated in this License.
168
+
169
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
170
+ any Contribution intentionally submitted for inclusion in the Work
171
+ by You to the Licensor shall be under the terms and conditions of
172
+ this License, without any additional terms or conditions.
173
+ Notwithstanding the above, nothing herein shall supersede or modify
174
+ the terms of any separate license agreement you may have executed
175
+ with Licensor regarding such Contributions.
176
+
177
+ 6. Trademarks. This License does not grant permission to use the trade
178
+ names, trademarks, service marks, or product names of the Licensor,
179
+ except as required for reasonable and customary use in describing the
180
+ origin of the Work and reproducing the content of the NOTICE file.
181
+
182
+ 7. Disclaimer of Warranty. Unless required by applicable law or
183
+ agreed to in writing, Licensor provides the Work (and each
184
+ Contributor provides its Contributions) on an "AS IS" BASIS,
185
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
186
+ implied, including, without limitation, any warranties or conditions
187
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
188
+ PARTICULAR PURPOSE. You are solely responsible for determining the
189
+ appropriateness of using or redistributing the Work and assume any
190
+ risks associated with Your exercise of permissions under this License.
191
+
192
+ 8. Limitation of Liability. In no event and under no legal theory,
193
+ whether in tort (including negligence), contract, or otherwise,
194
+ unless required by applicable law (such as deliberate and grossly
195
+ negligent acts) or agreed to in writing, shall any Contributor be
196
+ liable to You for damages, including any direct, indirect, special,
197
+ incidental, or consequential damages of any character arising as a
198
+ result of this License or out of the use or inability to use the
199
+ Work (including but not limited to damages for loss of goodwill,
200
+ work stoppage, computer failure or malfunction, or any and all
201
+ other commercial damages or losses), even if such Contributor
202
+ has been advised of the possibility of such damages.
203
+
204
+ 9. Accepting Warranty or Additional Liability. While redistributing
205
+ the Work or Derivative Works thereof, You may choose to offer,
206
+ and charge a fee for, acceptance of support, warranty, indemnity,
207
+ or other liability obligations and/or rights consistent with this
208
+ License. However, in accepting such obligations, You may act only
209
+ on Your own behalf and on Your sole responsibility, not on behalf
210
+ of any other Contributor, and only if You agree to indemnify,
211
+ defend, and hold each Contributor harmless for any liability
212
+ incurred by, or claims asserted against, such Contributor by reason
213
+ of your accepting any such warranty or additional liability.
214
+
215
+ END OF TERMS AND CONDITIONS
216
+
217
+ APPENDIX: How to apply the Apache License to your work.
218
+
219
+ To apply the Apache License to your work, attach the following
220
+ boilerplate notice, with the fields enclosed by brackets "[]"
221
+ replaced with your own identifying information. (Don't include
222
+ the brackets!) The text should be enclosed in the appropriate
223
+ comment syntax for the file format. We also recommend that a
224
+ file or class name and description of purpose be included on the
225
+ same "printed page" as the copyright notice for easier
226
+ identification within third-party archives.
227
+
228
+ Copyright [yyyy] [name of copyright owner]
229
+
230
+ Licensed under the Apache License, Version 2.0 (the "License");
231
+ you may not use this file except in compliance with the License.
232
+ You may obtain a copy of the License at
233
+
234
+ http://www.apache.org/licenses/LICENSE-2.0
235
+
236
+ Unless required by applicable law or agreed to in writing, software
237
+ distributed under the License is distributed on an "AS IS" BASIS,
238
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239
+ See the License for the specific language governing permissions and
240
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: license-term-of-universal-audio-tokenizer
4
+ language:
5
+ - en
6
+ - zh
7
+ tags:
8
+ - audio
9
+ - audio-tokenizer
10
+ - speech-tokenizer
11
+ - speech
12
+ - sound
13
+ - music
14
+ ---
15
+ # Universal Audio Tokenizer: Empowering Semantic Speech Tokenizers with General Audio Perception
16
+
17
+ **Universal Audio Tokenizer** is a compact single-codebook audio tokenizer that unifies general audio perception and
18
+ linguistic alignment for downstream Audio-LLMs.
19
+
20
+ 📄 [Paper](https://arxiv.org/abs/2605.31521) | 💻 [GitHub](https://github.com/Tencent/Universal_Audio_Tokenizer)
21
+
22
+ For code and more detailed information, please refer to the corresponding [GitHub repository](https://github.com/Tencent/Universal_Audio_Tokenizer).
23
+
24
+ ## 💡 Highlights
25
+
26
+ Existing semantic speech tokenizers often suffer from *acoustic blindness*, while acoustic tokenizers typically lack *linguistic alignment*.
27
+
28
+ **Universal Audio Tokenizer** bridges this gap through:
29
+ - 🧩 **Semantic-Acoustic Primitives (SAP) supervision** that decomposes raw audio into fundamental linguistic content, vocal attributes, and auditory-scene primitives
30
+ - ⚖️ **Semantic-Acoustic Equilibrium (SAE) mechanism** that adaptively injects fine-grained acoustic details from shallow encoder layers into deep semantic streams
31
+
32
+ This results in a compact single-codebook audio tokenizer that **simultaneously** enables:
33
+ * 🧠 **Seamless LLM Integration**: A unified audio input/output interface in Audio-LLMs
34
+ * 🗣️ **Linguistic Alignment**: Superior performance on speech reconstruction and TTS synthesis tasks
35
+ * 🎯 **General Audio Perception**: Discriminative representations for diverse audio events and strong performance on downstream audio understanding benchmarks
36
+
37
+ ## 📌 Model Details
38
+
39
+ | Attribute | Value |
40
+ |:----------|:------|
41
+ | Frame Rate | 25 Hz |
42
+ | Codebook Size | 8,192 |
43
+ | Bits Per Second (BPS) | 325 |
44
+
45
+ ## 🚀 Quick Start
46
+
47
+ To use Universal Audio Tokenizer, please clone the official repository and install dependencies.
48
+
49
+ ### Installation
50
+
51
+ ```bash
52
+ # 1. Clone the repository with all submodules
53
+ git clone --recursive https://github.com/Tencent/Universal_Audio_Tokenizer.git
54
+ cd Universal_Audio_Tokenizer
55
+
56
+ # If you have already cloned the repository without --recursive,
57
+ # initialize submodules with:
58
+ git submodule update --init --recursive
59
+
60
+ # 2. Create a conda environment
61
+ conda create -n universal-audio-tokenizer python=3.10.13 -y
62
+ conda activate universal-audio-tokenizer
63
+
64
+ # 3. Install dependencies
65
+ conda install -c conda-forge libsndfile -y
66
+ pip install -r requirements.txt
67
+ ```
68
+
69
+ ### Download Pretrained Checkpoints
70
+
71
+ Using `huggingface-cli`:
72
+
73
+ ```bash
74
+ huggingface-cli download tencent/Universal_Audio_Tokenizer \
75
+ --local-dir checkpoints/Universal_Audio_Tokenizer
76
+ ```
77
+
78
+ Or using Python:
79
+
80
+ ```python
81
+ from huggingface_hub import snapshot_download
82
+
83
+ snapshot_download(
84
+ repo_id="tencent/Universal_Audio_Tokenizer",
85
+ local_dir="checkpoints/Universal_Audio_Tokenizer"
86
+ )
87
+ ```
88
+
89
+ ### Run Inference
90
+
91
+ We provide a simple inference demo in `example_usage.py`.
92
+
93
+ ```bash
94
+ python example_usage.py \
95
+ --device auto \
96
+ --model_path checkpoints/Universal_Audio_Tokenizer \
97
+ --audio_path /path/to/audio.wav
98
+ ```
99
+
100
+ The script will:
101
+
102
+ - load the tokenizer and feature extractor;
103
+ - extract discrete audio tokens from input audio clips;
104
+ - reconstruct waveforms from the tokens and save reconstructed audio under `reconstruction/`.
105
+
106
+ Also, you can directly run the inference code snippet below:
107
+
108
+ ```python
109
+ import os
110
+ import torch
111
+ from transformers import WhisperFeatureExtractor
112
+ from src.model.modeling_whisper import WhisperVQEncoder
113
+ from src.model.flow_inference import AudioDecoder
114
+ from src.model.utils import extract_audio_token, speech_token_to_wav
115
+
116
+ # 1. Download & Load Models
117
+ model_dir = snapshot_download("tencent/Universal_Audio_Tokenizer")
118
+
119
+ # Load tokenizer and feature extractor
120
+ tokenizer_path = os.path.join(model_dir, "tokenizer")
121
+ tokenizer = WhisperVQEncoder.from_pretrained(tokenizer_path).eval().cuda()
122
+ feature_extractor = WhisperFeatureExtractor.from_pretrained(tokenizer_path)
123
+
124
+ # Load decoder
125
+ decoder_path = os.path.join(model_dir, "decoder")
126
+ decoder = AudioDecoder(
127
+ config_path=os.path.join(decoder_path, "config.yaml"),
128
+ flow_ckpt_path=os.path.join(decoder_path, "flow.pt"),
129
+ hift_ckpt_path=os.path.join(decoder_path, "hift.pt"),
130
+ device="cuda"
131
+ )
132
+
133
+ # 2. Tokenize
134
+ tokens = extract_audio_token(tokenizer, feature_extractor, ["/path/to/audio.wav"], device="cuda")[0]
135
+
136
+ # 3. Reconstruct
137
+ tts_speech, sampling_rate = speech_token_to_wav(decoder, tokens)
138
+ ```
139
+
140
+ ## 📊 Performance
141
+
142
+ Universal Audio Tokenizer learns discriminative representations for diverse audio events, and achieves strong performance on speech reconstruction, downstream audio understanding, and TTS synthesis tasks.
143
+
144
+ ### Latent Space Disentanglement
145
+
146
+ We use high-dimensional token histogram vectors for cluster analysis. The results (Silhouette Score and Cluster Purity) show that our model effectively encodes general audio, with clearer cluster separation in the latent space.
147
+
148
+ | Model | ESC-10 Sil. (↑) | ESC-10 Purity (↑) | ESC-50 Sil. (↑) | ESC-50 Purity (↑) |
149
+ |:---|:---:|:---:|:---:|:---:|
150
+ | [WavTokenizer](https://github.com/jishengpeng/WavTokenizer) | -0.030 | 0.450 | -0.108 | 0.215 |
151
+ | [GLM-4-Voice-Tokenizer](https://github.com/zai-org/GLM-4-Voice) | -0.182 | 0.373 | -0.304 | 0.133 |
152
+ | [CosyVoice2](https://github.com/FunAudioLLM/CosyVoice) | -0.016 | 0.413 | -0.100 | 0.216 |
153
+ | [StableToken](https://github.com/Tencent/StableToken) | -0.035 | 0.468 | -0.096 | 0.174 |
154
+ | **Ours** | **0.091** | **0.730** | **0.023** | **0.390** |
155
+
156
+ ### High-Quality Speech Reconstruction
157
+
158
+ Our Universal Audio Tokenizer achieves high-quality speech reconstruction with a compact single-codebook design, significantly improving Word Error Rate (WER) and Mean Opinion Score (MOS) compared to existing supervised semantic tokenizers.
159
+
160
+ | Model | Frame<br>Rate | BPS | WER (↓)<br>LS-clean | WER (↓)<br>LS-other | WER (↓)<br>SEED-en | WER (↓)<br>SEED-zh | MOS (↑)<br>LS-clean | MOS (↑)<br>LS-other | MOS (↑)<br>SEED-en | MOS (↑)<br>SEED-zh |
161
+ |:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
162
+ | [WavTokenizer](https://github.com/jishengpeng/WavTokenizer) | 75Hz | 900 | 5.07 | 13.09 | 5.60 | 4.02 | 3.37 | 3.09 | 3.01 | 3.13 |
163
+ | [GLM-4-Voice-Tokenizer](https://github.com/zai-org/GLM-4-Voice) | 12.5Hz | 175 | 4.04 | 9.33 | 3.54 | 3.23 | 4.07 | 3.99 | **4.16** | 4.10 |
164
+ | [CosyVoice2](https://github.com/FunAudioLLM/CosyVoice) | 25Hz | 325 | 4.25 | 9.68 | 4.34 | 2.75 | 3.36 | 3.25 | 3.31 | 3.58 |
165
+ | [StableToken](https://github.com/Tencent/StableToken) | 25Hz | 325 | 3.84 | 7.99 | 3.44 | 2.62 | 4.09 | 3.83 | 4.01 | 4.18 |
166
+ | **Ours** | 25Hz | 325 | **3.47** | **6.79** | **2.55** | **1.90** | **4.19** | **4.18** | 4.13 | **4.25** |
167
+
168
+ ### Superior Downstream Audio-LLM Performance
169
+
170
+ When integrated with the Qwen2.5 LLM backbone, our Universal Audio Tokenizer yields superior performance on a wide range of downstream audio understanding benchmarks and controllable TTS synthesis tasks, demonstrating its effectiveness as a unified audio input/output interface for Audio-LLMs.
171
+
172
+ #### Audio Understanding
173
+
174
+ Accuracy on audio understanding benchmarks:
175
+
176
+ | **Tokenizer** | MMAU<br>(Speech) | MMAU<br>(Sound) | MMAU<br>(Music) | **MMAU<br>(Overall)** | MMAR<br>(Speech) | MMAR<br>(Sound) | MMAR<br>(Music) | **MMAR<br>(Overall)** | MMSU<br>(Perception) | MMSU<br>(Reasoning) | **MMSU<br>(Overall)** |
177
+ |:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
178
+ | [WavTokenizer](https://github.com/jishengpeng/WavTokenizer) | 36.94 | 60.36 | 57.78 | 51.70 | 39.80 | 31.52 | 29.61 | 36.30 | 32.83 | 45.37 | 38.90 |
179
+ | [CosyVoice2](https://github.com/FunAudioLLM/CosyVoice) | 39.94 | 61.56 | 62.57 | 54.70 | 41.50 | 35.76 | 30.58 | 38.10 | 27.44 | 45.83 | 36.34 |
180
+ | [GLM-4-Voice-Tokenizer](https://github.com/zai-org/GLM-4-Voice) | 43.24 | 60.06 | 62.28 | 55.20 | 39.46 | 40.00 | 36.89 | 40.10 | 32.40 | 47.64 | 39.78 |
181
+ | [StableToken](https://github.com/Tencent/StableToken) | **45.05** | 58.56 | 55.99 | 53.20 | 42.18 | 39.39 | 31.07 | 39.10 | 31.98 | 49.71 | 40.56 |
182
+ | **Ours** | **45.05** | **70.27** | **67.96** | **61.10** (+5.90) | **45.24** | **43.64** | **40.29** | **45.80** (+5.70) | **35.54** | **52.07** | **43.54** (+2.98) |
183
+
184
+ #### Controllable TTS Synthesis
185
+
186
+ Results on SEED-TTS, measured by speaker similarity (SIM), word error rate (WER), and mean opinion score (MOS).
187
+
188
+ | Tokenizer | SIM (↑) | WER (↓) | MOS (↑) |
189
+ |:---|:---:|:---:|:---:|
190
+ | [CosyVoice2](https://github.com/FunAudioLLM/CosyVoice) | .758 \| **.762** \| .760 | 2.71 \| 1.39 \| 2.05 | 3.75 \| 3.37 \| 3.56 |
191
+ | **Ours** | **.792** \| .742 \| **.767** | **1.78** \| **1.29** \| **1.54** | **4.07** \| **3.68** \| **3.88** |
192
+
193
+ ## Citation
194
+
195
+ If you find our code or model useful for your research, please cite:
196
+
197
+ ```bibtex
198
+ @misc{song2026uniaudiotokenempoweringsemanticspeech,
199
+ title={UniAudio-Token: Empowering Semantic Speech Tokenizers with General Audio Perception},
200
+ author={Yuhan Song and Linhao Zhang and Aiwei Liu and Chuhan Wu and Sijun Zhang and Wei Jia and Yuan Liu and Houfeng Wang and Xiao Zhou},
201
+ year={2026},
202
+ eprint={2605.31521},
203
+ archivePrefix={arXiv},
204
+ primaryClass={cs.CL},
205
+ url={https://arxiv.org/abs/2605.31521},
206
+ }
207
+ ```
208
+
209
+ ## License
210
+
211
+ This project is licensed under the [License Term of Universal_Audio_Tokenizer](LICENSE).
decoder/config.yaml ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # set random seed, so that you may reproduce your result.
2
+ __set_seed1: !apply:random.seed [1986]
3
+ __set_seed2: !apply:numpy.random.seed [1986]
4
+ __set_seed3: !apply:torch.manual_seed [1986]
5
+ __set_seed4: !apply:torch.cuda.manual_seed_all [1986]
6
+
7
+ # fixed params
8
+ sample_rate: 22050
9
+ text_encoder_input_size: 512
10
+ llm_input_size: 1024
11
+ llm_output_size: 1024
12
+ spk_embed_dim: 192
13
+
14
+ # model params
15
+ # for all class/function included in this repo, we use !<name> or !<new> for intialization, so that user may find all corresponding class/function according to one single yaml.
16
+ # for system/third_party class/function, we do not require this.
17
+ llm: !new:cosyvoice.llm.llm.TransformerLM
18
+ text_encoder_input_size: !ref <text_encoder_input_size>
19
+ llm_input_size: !ref <llm_input_size>
20
+ llm_output_size: !ref <llm_output_size>
21
+ text_token_size: 51866
22
+ speech_token_size: 4096
23
+ length_normalized_loss: True
24
+ lsm_weight: 0
25
+ spk_embed_dim: !ref <spk_embed_dim>
26
+ text_encoder: !new:cosyvoice.transformer.encoder.ConformerEncoder
27
+ input_size: !ref <text_encoder_input_size>
28
+ output_size: 1024
29
+ attention_heads: 8
30
+ linear_units: 2048
31
+ num_blocks: 3
32
+ dropout_rate: 0.1
33
+ positional_dropout_rate: 0.1
34
+ attention_dropout_rate: 0
35
+ normalize_before: True
36
+ input_layer: 'linear'
37
+ pos_enc_layer_type: 'rel_pos_espnet'
38
+ selfattention_layer_type: 'rel_selfattn'
39
+ use_cnn_module: False
40
+ macaron_style: False
41
+ use_dynamic_chunk: False
42
+ use_dynamic_left_chunk: False
43
+ static_chunk_size: 1
44
+ llm: !new:cosyvoice.transformer.encoder.TransformerEncoder
45
+ input_size: !ref <llm_input_size>
46
+ output_size: !ref <llm_output_size>
47
+ attention_heads: 8
48
+ linear_units: 2048
49
+ num_blocks: 7
50
+ dropout_rate: 0.1
51
+ positional_dropout_rate: 0.1
52
+ attention_dropout_rate: 0
53
+ input_layer: 'linear_legacy'
54
+ pos_enc_layer_type: 'rel_pos_espnet'
55
+ selfattention_layer_type: 'rel_selfattn'
56
+ static_chunk_size: 1
57
+
58
+ flow: !new:cosyvoice.flow.flow.MaskedDiffWithXvec
59
+ input_size: 512
60
+ output_size: 80
61
+ spk_embed_dim: !ref <spk_embed_dim>
62
+ output_type: 'mel'
63
+ vocab_size: 8192
64
+ input_frame_rate: 25
65
+ only_mask_loss: True
66
+ encoder: !new:cosyvoice.transformer.encoder.BlockConformerEncoder
67
+ output_size: 512
68
+ attention_heads: 8
69
+ linear_units: 2048
70
+ num_blocks: 6
71
+ dropout_rate: 0.1
72
+ positional_dropout_rate: 0.1
73
+ attention_dropout_rate: 0.1
74
+ normalize_before: True
75
+ input_layer: 'linear'
76
+ pos_enc_layer_type: 'rel_pos_espnet'
77
+ selfattention_layer_type: 'block_rel_selfattn'
78
+ block_size: 10
79
+ input_size: 512
80
+ use_cnn_module: False
81
+ macaron_style: False
82
+ length_regulator: !new:cosyvoice.flow.length_regulator.InterpolateRegulator
83
+ channels: 80
84
+ sampling_ratios: [1, 1, 1, 1]
85
+ decoder: !new:cosyvoice.flow.flow_matching.ConditionalCFM
86
+ in_channels: 240
87
+ n_spks: 1
88
+ spk_emb_dim: 80
89
+ cfm_params: !new:omegaconf.DictConfig
90
+ content:
91
+ sigma_min: 1e-06
92
+ solver: 'euler'
93
+ t_scheduler: 'cosine'
94
+ training_cfg_rate: 0.2
95
+ inference_cfg_rate: 0.7
96
+ reg_loss_type: 'l1'
97
+ estimator: !new:cosyvoice.flow.decoder.ConditionalDecoder
98
+ in_channels: 320
99
+ out_channels: 80
100
+ channels: [256, 256]
101
+ dropout: 0
102
+ attention_head_dim: 64
103
+ n_blocks: 4
104
+ num_mid_blocks: 12
105
+ num_heads: 8
106
+ act_fn: 'gelu'
107
+
108
+ hift: !new:cosyvoice.hifigan.generator.HiFTGenerator
109
+ in_channels: 80
110
+ base_channels: 512
111
+ nb_harmonics: 8
112
+ sampling_rate: !ref <sample_rate>
113
+ nsf_alpha: 0.1
114
+ nsf_sigma: 0.003
115
+ nsf_voiced_threshold: 10
116
+ upsample_rates: [8, 8]
117
+ upsample_kernel_sizes: [16, 16]
118
+ istft_params:
119
+ n_fft: 16
120
+ hop_len: 4
121
+ resblock_kernel_sizes: [3, 7, 11]
122
+ resblock_dilation_sizes: [[1, 3, 5], [1, 3, 5], [1, 3, 5]]
123
+ source_resblock_kernel_sizes: [7, 11]
124
+ source_resblock_dilation_sizes: [[1, 3, 5], [1, 3, 5]]
125
+ lrelu_slope: 0.1
126
+ audio_limit: 0.99
127
+ f0_predictor: !new:cosyvoice.hifigan.f0_predictor.ConvRNNF0Predictor
128
+ num_class: 1
129
+ in_channels: 80
130
+ cond_channels: 512
decoder/flow.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b33fc4b95cb498988d350c50de13e6a9061bfdd026c4ba32339978e40edec505
3
+ size 428399772
decoder/hift.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65244bb40ea281173069672868e8f8ce60dfa2e1804661770b3de4b971ea1a63
3
+ size 81897015
tokenizer/config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "openai/whisper-large-v3",
3
+ "activation_dropout": 0.0,
4
+ "activation_function": "gelu",
5
+ "apply_spec_augment": false,
6
+ "architectures": [
7
+ "WhisperVQEncoder"
8
+ ],
9
+ "attention_dropout": 0.0,
10
+ "batch_maximization_weight": 0.3,
11
+ "classifier_proj_size": 256,
12
+ "codebook_gaussian_init": false,
13
+ "d_model": 1280,
14
+ "dropout": 0.0,
15
+ "encoder_attention_heads": 20,
16
+ "encoder_causal_attention": false,
17
+ "encoder_causal_convolution": false,
18
+ "encoder_ffn_dim": 5120,
19
+ "encoder_layerdrop": 0.0,
20
+ "encoder_layers": 32,
21
+ "encoder_residual_source_position": 3,
22
+ "encoder_residual_target_position": 32,
23
+ "init_std": 0.02,
24
+ "is_encoder_decoder": true,
25
+ "mask_feature_length": 10,
26
+ "mask_feature_min_masks": 0,
27
+ "mask_feature_prob": 0.0,
28
+ "mask_time_length": 10,
29
+ "mask_time_min_masks": 2,
30
+ "mask_time_prob": 0.05,
31
+ "max_length": 448,
32
+ "max_source_positions": 1500,
33
+ "max_target_positions": 2048,
34
+ "median_filter_width": 7,
35
+ "model_type": "whisper",
36
+ "num_hidden_layers": 32,
37
+ "num_mel_bins": 128,
38
+ "pooling_kernel_size": 2,
39
+ "pooling_position": 0,
40
+ "pooling_type": "avg",
41
+ "quantize_causal_block_size": null,
42
+ "quantize_causal_encoder": false,
43
+ "quantize_commit_coefficient": 0.25,
44
+ "quantize_ema_decay": 0.95,
45
+ "quantize_encoder_only": true,
46
+ "quantize_loss_scale": 10.0,
47
+ "quantize_position": 16,
48
+ "quantize_restart_interval": 10,
49
+ "quantize_vocab_size": 8192,
50
+ "torch_dtype": "float32",
51
+ "transformers_version": "4.48.0",
52
+ "use_cache": true,
53
+ "use_commit_loss": true,
54
+ "use_residual_adapter": true,
55
+ "use_residual_gate": true,
56
+ "vocab_size": 51869
57
+ }
tokenizer/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a103b6518160d4d4e9833d7ab8e633c66f32677fccf25f3e1c7624ca9d62edde
3
+ size 1409306456
tokenizer/preprocessor_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "chunk_length": 30,
3
+ "feature_extractor_type": "WhisperFeatureExtractor",
4
+ "feature_size": 128,
5
+ "hop_length": 160,
6
+ "n_fft": 400,
7
+ "n_samples": 480000,
8
+ "nb_max_frames": 3000,
9
+ "padding_side": "right",
10
+ "padding_value": 0.0,
11
+ "processor_class": "WhisperProcessor",
12
+ "return_attention_mask": false,
13
+ "sampling_rate": 16000
14
+ }