9r4n4y Alethia commited on
Commit
65462ce
·
0 Parent(s):

Duplicate from meituan-longcat/LongCat-AudioDiT-3.5B

Browse files

Co-authored-by: Alethia <Alethia@users.noreply.huggingface.co>

Files changed (7) hide show
  1. .gitattributes +36 -0
  2. LICENSE +21 -0
  3. LongCat-AudioDiT.svg +11 -0
  4. README.md +186 -0
  5. architecture.png +3 -0
  6. config.json +106 -0
  7. model.safetensors +3 -0
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
+ architecture.png filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Meituan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
LongCat-AudioDiT.svg ADDED
README.md ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - zh
5
+ - en
6
+ ---
7
+ # LongCat-AudioDiT: High-Fidelity Diffusion Text-to-Speech in the Waveform Latent Space
8
+
9
+ <div align="center">
10
+ <img src="./LongCat-AudioDiT.svg" width="45%" alt="LongCat-AudioDiT" />
11
+ </div>
12
+ <hr>
13
+
14
+ <div align="center" style="line-height: 1;">
15
+ <a href="https://github.com/meituan-longcat/LongCat-AudioDiT/blob/main/LongCat-AudioDiT.pdf">
16
+ <img alt="License" src="https://img.shields.io/badge/Paper-LongCatAudioDiT-blue" style="display: inline-block; vertical-align: middle;"/>
17
+ </a>
18
+ <a href="https://github.com/meituan-longcat/LongCat-AudioDiT" target="_blank" style="margin: 2px;">
19
+ <img alt="GitHub" src="https://img.shields.io/badge/GitHub-LongCatAudioDiT-white?logo=github&logoColor=white&color=a4b5d5" style="display: inline-block; vertical-align: middle;"/>
20
+ </a>
21
+ </a>
22
+ <a href="https://aria-k-alethia.github.io/LongCat-AudioDiT-demo" target="_blank" style="margin: 2px;">
23
+ <img alt="Demo" src="https://img.shields.io/badge/Demo-LongCatAudioDiT-white?logo=googleplay&logoColor=white&color=eabcdd" style="display: inline-block; vertical-align: middle;"/>
24
+ </a>
25
+ </div>
26
+ <div align="center" style="line-height: 1;">
27
+ <a href="https://huggingface.co/meituan-longcat/LongCat-AudioDiT-3.5B" target="_blank" style="margin: 2px;">
28
+ <img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-LongCatAudioDiT3.5B-ffc107?color=ffc107&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
29
+ </a>
30
+ <a href="https://huggingface.co/meituan-longcat/LongCat-AudioDiT-1B" target="_blank" style="margin: 2px;">
31
+ <img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-LongCatAudioDiT1B-ffc107?color=ffc107&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
32
+ </a>
33
+ </div>
34
+ <div align="center" style="line-height: 1;">
35
+ <a href="https://github.com/meituan-longcat/LongCat-AudioDiT/blob/main/assets/wechat_official_accounts.png" target="_blank" style="margin: 2px;">
36
+ <img alt="Wechat" src="https://img.shields.io/badge/WeChat-LongCat-brightgreen?logo=wechat&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
37
+ </a>
38
+ <a href="https://x.com/Meituan_LongCat" target="_blank" style="margin: 2px;">
39
+ <img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-LongCat-white?logo=x&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
40
+ </a>
41
+ <a href="https://github.com/meituan-longcat/LongCat-AudioDiT/blob/main/LICENSE" style="margin: 2px;">
42
+ <img alt="License" src="https://img.shields.io/badge/License-MIT-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
43
+ </a>
44
+ </div>
45
+
46
+ ## Introduction
47
+
48
+ LongCat-AudioDiT is a state-of-the-art (SOTA) diffusion-based text-to-speech (TTS) model that directly operates on the waveform latent space.
49
+ > **Abstract**: We present LongCat-TTS, a novel, non-autoregressive diffusion-based text-to-speech (TTS) model that achieves state-of-the-art (SOTA) performance.
50
+ Unlike previous methods that rely on intermediate acoustic representations such as mel-spectrograms, the core innovation of LongCat-TTS lies in operating directly within the waveform latent space. This approach effectively mitigates compounding errors and drastically simplifies the TTS pipeline, requiring only a waveform variational autoencoder (Wav-VAE) and a diffusion backbone.
51
+ Furthermore, we introduce two critical improvements to the inference process: first, we identify and rectify a long-standing training-inference mismatch; second, we replace traditional classifier-free guidance with adaptive projection guidance to elevate generation quality.
52
+ Experimental results demonstrate that, despite the absence of complex multi-stage training pipelines or high-quality human-annotated datasets, LongCat-TTS achieves SOTA zero-shot voice cloning performance on the Seed benchmark while maintaining competitive intelligibility.
53
+ Specifically, our largest variant, LongCat-TTS-3.5B, outperforms the previous SOTA model (Seed-TTS), improving the speaker similarity (SIM) scores from 0.809 to 0.818 on Seed-ZH, and from 0.776 to 0.797 on Seed-Hard.
54
+ Finally, through comprehensive ablation studies and systematic analysis, we validate the effectiveness of our proposed modules.
55
+ Notably, we investigate the interplay between the Wav-VAE and the TTS backbone, revealing the counterintuitive finding that superior reconstruction fidelity in the Wav-VAE does not necessarily lead to better overall TTS performance.
56
+ Code and model weights are released to foster further research within the speech community.
57
+
58
+ <div align="center">
59
+ <img src="./architecture.png" width="75%" alt="LongCat-AudioDiT" />
60
+ </div>
61
+
62
+
63
+ This repository provides the HuggingFace-compatible implementation, including model definition, weight conversion, and inference scripts.
64
+
65
+ ## Experimental Results on Seed Benchmark
66
+ LongCat-AudioDiT obtains state-of-the-art (SOTA) voice cloning performance on the Seed-benchmark, surpassing both close-source and open-source modles.
67
+
68
+ | **Model** | **ZH CER (%)** ↓ | **ZH SIM** ↑ | **EN WER (%)** ↓ | **EN SIM** ↑ | **ZH-Hard CER (%)** ↓ | **ZH-Hard SIM** ↑ |
69
+ |:---|:---:|:---:|:---:|:---:|:---:|:---:|
70
+ | GT | 1.26 | 0.755 | 2.14 | 0.734 | - | - |
71
+ | Seed-DiT | 1.18 | 0.809 | 1.73 | **0.790** | - | - |
72
+ | MaskGCT | 2.27 | 0.774 | 2.62 | 0.714 | 10.27 | 0.748 |
73
+ | E2 TTS | 1.97 | 0.730 | 2.19 | 0.710 | - | - |
74
+ | F5 TTS | 1.56 | 0.741 | 1.83 | 0.647 | 8.67 | 0.713 |
75
+ | F5R-TTS | 1.37 | 0.754 | - | - | 8.79 | 0.718 |
76
+ | ZipVoice | 1.40 | 0.751 | 1.64 | 0.668 | - | - |
77
+ | Seed-ICL | 1.12 | 0.796 | 2.25 | 0.762 | 7.59 | 0.776 |
78
+ | SparkTTS | 1.20 | 0.672 | 1.98 | 0.584 | - | - |
79
+ | FireRedTTS | 1.51 | 0.635 | 3.82 | 0.460 | 17.45 | 0.621 |
80
+ | Qwen2.5-Omni | 1.70 | 0.752 | 2.72 | 0.632 | 7.97 | 0.747 |
81
+ | Qwen2.5-Omni_RL | 1.42 | 0.754 | 2.33 | 0.641 | 6.54 | 0.752 |
82
+ | CosyVoice | 3.63 | 0.723 | 4.29 | 0.609 | 11.75 | 0.709 |
83
+ | CosyVoice2 | 1.45 | 0.748 | 2.57 | 0.652 | 6.83 | 0.724 |
84
+ | FireRedTTS-1S | 1.05 | 0.750 | 2.17 | 0.660 | 7.63 | 0.748 |
85
+ | CosyVoice3-1.5B | 1.12 | 0.781 | 2.21 | 0.720 | *5.83* | 0.758 |
86
+ | IndexTTS2 | 1.03 | 0.765 | 2.23 | 0.706 | 7.12 | 0.755 |
87
+ | DiTAR | 1.02 | 0.753 | 1.69 | 0.735 | - | - |
88
+ | MiniMax-Speech | 0.99 | 0.799 | 1.90 | 0.738 | - | - |
89
+ | VoxCPM | *0.93* | 0.772 | 1.85 | 0.729 | 8.87 | 0.730 |
90
+ | MOSS-TTS | 1.20 | 0.788 | 1.85 | 0.734 | - | - |
91
+ | Qwen3-TTS | 1.22 | 0.770 | **1.23** | 0.717 | 6.76 | 0.748 |
92
+ | CosyVoice3.5 | **0.87** | 0.797 | 1.57 | 0.738 | **5.71** | 0.786 |
93
+ | LongCat-AudioDiT-1B | 1.18 | *0.812* | 1.78 | 0.762 | 6.33 | *0.787* |
94
+ | LongCat-AudioDiT-3.5B | 1.09 | **0.818** | *1.50* | *0.786* | 6.04 | **0.797** |
95
+
96
+ ## Installation
97
+
98
+ ```bash
99
+ pip install -r requirements.txt
100
+ ```
101
+
102
+ ## CLI Inference
103
+
104
+ ```bash
105
+ # TTS
106
+ python inference.py --text "今天晴暖转阴雨,空气质量优至良,空气相对湿度较低。" --output_audio output.wav --model_dir meituan-longcat/LongCat-AudioDiT-1B
107
+
108
+ # Voice cloning
109
+ python inference.py \
110
+ --text "今天晴暖转阴雨,空气质量优至良,空气相对湿度较低。" \
111
+ --prompt_text "小偷却一点也不气馁,继续在抽屉里翻找。" \
112
+ --prompt_audio assets/prompt.wav \
113
+ --output_audio output.wav \
114
+ --model_dir meituan-longcat/LongCat-AudioDiT-1B \
115
+ --guidance_method apg
116
+
117
+ # Batch inference (SeedTTS eval format, one item per line: uid|prompt_text|prompt_wav_path|gen_text)
118
+ python batch_inference.py \
119
+ --lst /path/to/meta.lst \
120
+ --output_dir /path/to/output \
121
+ --model_dir meituan-longcat/LongCat-AudioDiT-1B \
122
+ --guidance_method apg
123
+ ```
124
+
125
+ ## Inference (Python API)
126
+
127
+ ### 1. TTS
128
+ ```python
129
+ import audiodit # auto-registers with transformers
130
+ from audiodit import AudioDiTModel
131
+ from transformers import AutoTokenizer
132
+ import torch, soundfile as sf
133
+
134
+ # Load model
135
+ model = AudioDiTModel.from_pretrained("meituan-longcat/LongCat-AudioDiT-1B").to("cuda")
136
+ model.vae.to_half() # VAE runs in fp16 (matching original)
137
+ model.eval()
138
+
139
+ tokenizer = AutoTokenizer.from_pretrained(model.config.text_encoder_model)
140
+
141
+ # Zero-shot synthesis
142
+ inputs = tokenizer(["今天晴暖转阴雨,空气质量优至良,空气相对湿度较低。"], padding="longest", return_tensors="pt")
143
+ output = model(
144
+ input_ids=inputs.input_ids,
145
+ attention_mask=inputs.attention_mask,
146
+ duration=62, # latent frames
147
+ steps=16,
148
+ cfg_strength=4.0,
149
+ guidance_method="cfg", # or "apg"
150
+ seed=1024,
151
+ )
152
+ sf.write("output.wav", output.waveform.squeeze().cpu().numpy(), 24000)
153
+ ```
154
+
155
+ ### 2. Voice Cloning (with prompt audio)
156
+
157
+ ```python
158
+ import librosa, torch
159
+
160
+ # Load prompt audio
161
+ audio, _ = librosa.load("assets/prompt.wav", sr=24000, mono=True)
162
+ prompt_wav = torch.from_numpy(audio).unsqueeze(0).unsqueeze(0) # (1, 1, T)
163
+
164
+ # Concatenate prompt_text + gen_text for the text encoder
165
+ prompt_text = "小偷却一点也不气馁,继续在抽屉里翻找。"
166
+ gen_text = "今天晴暖转阴雨,空气质量优至良,空气相对湿度较低。"
167
+ inputs = tokenizer([f"{prompt_text} {gen_text}"], padding="longest", return_tensors="pt")
168
+
169
+ output = model(
170
+ input_ids=inputs.input_ids,
171
+ attention_mask=inputs.attention_mask,
172
+ prompt_audio=prompt_wav,
173
+ duration=138, # prompt_frames + gen_frames
174
+ steps=16,
175
+ cfg_strength=4.0,
176
+ guidance_method="apg",
177
+ seed=1024,
178
+ )
179
+ ```
180
+
181
+ ## License Agreement
182
+ This repository, including both the model weights and the source code, is released under the **MIT License**.
183
+
184
+ Any contributions to this repository are licensed under the MIT License, unless otherwise stated. This license does not grant any rights to use Meituan trademarks or patents.
185
+
186
+ For details, see the [LICENSE](./LICENSE) file.
architecture.png ADDED

Git LFS Details

  • SHA256: dbcc8448913dd5b7e634bb7405fd4321ce720463d275c900007378a7a18bf608
  • Pointer size: 131 Bytes
  • Size of remote file: 318 kB
config.json ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dit_adaln_type": "global",
3
+ "dit_adaln_use_text_cond": true,
4
+ "dit_bias": true,
5
+ "dit_cross_attn": true,
6
+ "dit_cross_attn_norm": false,
7
+ "dit_depth": 32,
8
+ "dit_dim": 2560,
9
+ "dit_dropout": 0.0,
10
+ "dit_eps": 1e-06,
11
+ "dit_ff_mult": 3.6,
12
+ "dit_heads": 32,
13
+ "dit_long_skip": true,
14
+ "dit_qk_norm": true,
15
+ "dit_text_conv": true,
16
+ "dit_text_dim": 768,
17
+ "dit_use_latent_condition": true,
18
+ "latent_dim": 64,
19
+ "latent_hop": 2048,
20
+ "max_wav_duration": 60,
21
+ "model_type": "audiodit",
22
+ "repa_dit_layer": 8,
23
+ "sampling_rate": 24000,
24
+ "sigma": 0.0,
25
+ "text_add_embed": true,
26
+ "text_encoder_config": {
27
+ "_name_or_path": "ArthurZ/umt5-base",
28
+ "architectures": [
29
+ "UMT5ForConditionalGeneration"
30
+ ],
31
+ "chunk_size_feed_forward": 0,
32
+ "classifier_dropout": 0.0,
33
+ "d_ff": 2048,
34
+ "d_kv": 64,
35
+ "d_model": 768,
36
+ "decoder_start_token_id": 0,
37
+ "dense_act_fn": "gelu_new",
38
+ "dropout_rate": 0.1,
39
+ "dtype": "float32",
40
+ "eos_token_id": 1,
41
+ "feed_forward_proj": "gated-gelu",
42
+ "id2label": {
43
+ "0": "LABEL_0",
44
+ "1": "LABEL_1"
45
+ },
46
+ "initializer_factor": 1.0,
47
+ "is_decoder": false,
48
+ "is_encoder_decoder": true,
49
+ "is_gated_act": true,
50
+ "label2id": {
51
+ "LABEL_0": 0,
52
+ "LABEL_1": 1
53
+ },
54
+ "layer_norm_epsilon": 1e-06,
55
+ "model_type": "umt5",
56
+ "num_decoder_layers": 12,
57
+ "num_heads": 12,
58
+ "num_layers": 12,
59
+ "output_attentions": false,
60
+ "output_hidden_states": false,
61
+ "output_past": true,
62
+ "pad_token_id": 0,
63
+ "problem_type": null,
64
+ "relative_attention_max_distance": 128,
65
+ "relative_attention_num_buckets": 32,
66
+ "return_dict": true,
67
+ "scalable_attention": true,
68
+ "tie_word_embeddings": true,
69
+ "tokenizer_class": "T5Tokenizer",
70
+ "use_cache": true,
71
+ "vocab_size": 256384
72
+ },
73
+ "text_encoder_model": "google/umt5-base",
74
+ "text_norm_feat": true,
75
+ "transformers_version": "5.3.0",
76
+ "vae_config": {
77
+ "c_mults": [
78
+ 1,
79
+ 2,
80
+ 4,
81
+ 8,
82
+ 16
83
+ ],
84
+ "channels": 128,
85
+ "downsample_shortcut": "averaging",
86
+ "downsampling_ratio": 2048,
87
+ "encoder_latent_dim": 128,
88
+ "final_tanh": false,
89
+ "in_channels": 1,
90
+ "in_shortcut": "duplicating",
91
+ "latent_dim": 64,
92
+ "model_type": "audiodit_vae",
93
+ "out_shortcut": "averaging",
94
+ "sample_rate": 24000,
95
+ "scale": 0.71,
96
+ "strides": [
97
+ 2,
98
+ 4,
99
+ 4,
100
+ 8,
101
+ 8
102
+ ],
103
+ "upsample_shortcut": "duplicating",
104
+ "use_snake": true
105
+ }
106
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:708cdbf0bdf71cd485bf10c70a6043b22729730ef55a6b4bc2de2ce552e52fd8
3
+ size 15336102508