Spaces:
Running
Running
Hecheng0625
commited on
Commit
•
bf22427
1
Parent(s):
4949b9c
Update README.md
Browse files
README.md
CHANGED
@@ -1,183 +1,10 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
<br>
|
13 |
-
<div align="center">
|
14 |
-
<img src="./imgs/maskgct/maskgct.png" width="100%">
|
15 |
-
</div>
|
16 |
-
<br>
|
17 |
-
|
18 |
-
## News
|
19 |
-
|
20 |
-
- **2024/10/19**: We release **MaskGCT**, a fully non-autoregressive TTS model that eliminates the need for explicit alignment information between text and speech supervision. MaskGCT is trained on Emilia dataset and achieves SOTA zero-shot TTS perfermance.
|
21 |
-
|
22 |
-
## Quickstart
|
23 |
-
|
24 |
-
**Clone and install**
|
25 |
-
|
26 |
-
```bash
|
27 |
-
git clone https://github.com/open-mmlab/Amphion.git
|
28 |
-
# create env
|
29 |
-
bash ./models/tts/maskgct/env.sh
|
30 |
-
```
|
31 |
-
|
32 |
-
**Model download**
|
33 |
-
|
34 |
-
We provide the following pretrained checkpoints:
|
35 |
-
|
36 |
-
|
37 |
-
| Model Name | Description |
|
38 |
-
|-------------------|-------------|
|
39 |
-
| [Acoustic Codec](https://huggingface.co/amphion/MaskGCT/tree/main/acoustic_codec) | Converting speech to semantic tokens. |
|
40 |
-
| [Semantic Codec](https://huggingface.co/amphion/MaskGCT/tree/main/semantic_codec) | Converting speech to acoustic tokens and reconstructing waveform from acoustic tokens. |
|
41 |
-
| [MaskGCT-T2S](https://huggingface.co/amphion/MaskGCT/tree/main/t2s_model) | Predicting semantic tokens with text and prompt semantic tokens. |
|
42 |
-
| [MaskGCT-S2A](https://huggingface.co/amphion/MaskGCT/tree/main/s2a_model) | Predicts acoustic tokens conditioned on semantic tokens. |
|
43 |
-
|
44 |
-
You can download all pretrained checkpoints from [HuggingFace](https://huggingface.co/amphion/MaskGCT/tree/main) or use huggingface api.
|
45 |
-
|
46 |
-
```python
|
47 |
-
from huggingface_hub import hf_hub_download
|
48 |
-
|
49 |
-
# download semantic codec ckpt
|
50 |
-
semantic_code_ckpt = hf_hub_download("amphion/MaskGCT" filename="semantic_codec/model.safetensors")
|
51 |
-
|
52 |
-
# download acoustic codec ckpt
|
53 |
-
codec_encoder_ckpt = hf_hub_download("amphion/MaskGCT", filename="acoustic_codec/model.safetensors")
|
54 |
-
codec_decoder_ckpt = hf_hub_download("amphion/MaskGCT", filename="acoustic_codec/model_1.safetensors")
|
55 |
-
|
56 |
-
# download t2s model ckpt
|
57 |
-
t2s_model_ckpt = hf_hub_download("amphion/MaskGCT", filename="t2s_model/model.safetensors")
|
58 |
-
|
59 |
-
# download s2a model ckpt
|
60 |
-
s2a_1layer_ckpt = hf_hub_download("amphion/MaskGCT", filename="s2a_model/s2a_model_1layer/model.safetensors")
|
61 |
-
s2a_full_ckpt = hf_hub_download("amphion/MaskGCT", filename="s2a_model/s2a_model_full/model.safetensors")
|
62 |
-
```
|
63 |
-
|
64 |
-
**Basic Usage**
|
65 |
-
|
66 |
-
You can use the following code to generate speech from text and a prompt speech (the code is also provided in [inference.py](./models/tts/maskgct/maskgct_inference.py)).
|
67 |
-
|
68 |
-
```python
|
69 |
-
from models.tts.maskgct.maskgct_utils import *
|
70 |
-
from huggingface_hub import hf_hub_download
|
71 |
-
import safetensors
|
72 |
-
import soundfile as sf
|
73 |
-
|
74 |
-
if __name__ == "__main__":
|
75 |
-
|
76 |
-
# build model
|
77 |
-
device = torch.device("cuda:0")
|
78 |
-
cfg_path = "./models/tts/maskgct/config/maskgct.json"
|
79 |
-
cfg = load_config(cfg_path)
|
80 |
-
# 1. build semantic model (w2v-bert-2.0)
|
81 |
-
semantic_model, semantic_mean, semantic_std = build_semantic_model(device)
|
82 |
-
# 2. build semantic codec
|
83 |
-
semantic_codec = build_semantic_codec(cfg.model.semantic_codec, device)
|
84 |
-
# 3. build acoustic codec
|
85 |
-
codec_encoder, codec_decoder = build_acoustic_codec(cfg.model.acoustic_codec, device)
|
86 |
-
# 4. build t2s model
|
87 |
-
t2s_model = build_t2s_model(cfg.model.t2s_model, device)
|
88 |
-
# 5. build s2a model
|
89 |
-
s2a_model_1layer = build_s2a_model(cfg.model.s2a_model.s2a_1layer, device)
|
90 |
-
s2a_model_full = build_s2a_model(cfg.model.s2a_model.s2a_full, device)
|
91 |
-
|
92 |
-
# download checkpoint
|
93 |
-
...
|
94 |
-
|
95 |
-
# load semantic codec
|
96 |
-
safetensors.torch.load_model(semantic_codec, semantic_code_ckpt)
|
97 |
-
# load acoustic codec
|
98 |
-
safetensors.torch.load_model(codec_encoder, codec_encoder_ckpt)
|
99 |
-
safetensors.torch.load_model(codec_decoder, codec_decoder_ckpt)
|
100 |
-
# load t2s model
|
101 |
-
safetensors.torch.load_model(t2s_model, t2s_model_ckpt)
|
102 |
-
# load s2a model
|
103 |
-
safetensors.torch.load_model(s2a_model_1layer, s2a_1layer_ckpt)
|
104 |
-
safetensors.torch.load_model(s2a_model_full, s2a_full_ckpt)
|
105 |
-
|
106 |
-
# inference
|
107 |
-
prompt_wav_path = "./models/tts/maskgct/wav/prompt.wav"
|
108 |
-
save_path = "[YOUR SAVE PATH]"
|
109 |
-
prompt_text = " We do not break. We never give in. We never back down."
|
110 |
-
target_text = "In this paper, we introduce MaskGCT, a fully non-autoregressive TTS model that eliminates the need for explicit alignment information between text and speech supervision."
|
111 |
-
# Specify the target duration (in seconds). If target_len = None, we use a simple rule to predict the target duration.
|
112 |
-
target_len = 18
|
113 |
-
|
114 |
-
maskgct_inference_pipeline = MaskGCT_Inference_Pipeline(
|
115 |
-
semantic_model,
|
116 |
-
semantic_codec,
|
117 |
-
codec_encoder,
|
118 |
-
codec_decoder,
|
119 |
-
t2s_model,
|
120 |
-
s2a_model_1layer,
|
121 |
-
s2a_model_full,
|
122 |
-
semantic_mean,
|
123 |
-
semantic_std,
|
124 |
-
device,
|
125 |
-
)
|
126 |
-
|
127 |
-
recovered_audio = maskgct_inference_pipeline.maskgct_inference(
|
128 |
-
prompt_wav_path, prompt_text, target_text, "en", "en", target_len=target_len
|
129 |
-
)
|
130 |
-
sf.write(save_path, recovered_audio, 24000)
|
131 |
-
```
|
132 |
-
|
133 |
-
**Jupyter Notebook**
|
134 |
-
|
135 |
-
We also provide a [jupyter notebook](./models/tts/maskgct/maskgct_demo.ipynb) to show more details of MaskGCT inference.
|
136 |
-
|
137 |
-
|
138 |
-
## Evaluation Results of MaskGCT
|
139 |
-
|
140 |
-
| System | SIM-O↑ | WER↓ | FSD↓ | SMOS↑ | CMOS↑ |
|
141 |
-
| :--- | :---: | :---: | :---: | :---: | :---: |
|
142 |
-
| | | **LibriSpeech test-clean** |
|
143 |
-
| Ground Truth | 0.68 | 1.94 | | 4.05±0.12 | 0.00 |
|
144 |
-
| VALL-E | 0.50 | 5.90 | - | 3.47 ±0.26 | -0.52±0.22 |
|
145 |
-
| VoiceBox | 0.64 | 2.03 | 0.762 | 3.80±0.17 | -0.41±0.13 |
|
146 |
-
| NaturalSpeech 3 | 0.67 | 1.94 | 0.786 | 4.26±0.10 | 0.16±0.14 |
|
147 |
-
| VoiceCraft | 0.45 | 4.68 | 0.981 | 3.52±0.21 | -0.33 ±0.16 |
|
148 |
-
| XTTS-v2 | 0.51 | 4.20 | 0.945 | 3.02±0.22 | -0.98 ±0.19 |
|
149 |
-
| MaskGCT | 0.687(0.723) | 2.634(1.976) | 0.886 | 4.27±0.14 | 0.10±0.16 |
|
150 |
-
| MaskGCT(gt length) | 0.697 | 2.012 | 0.746 | 4.33±0.11 | 0.13±0.13 |
|
151 |
-
| | | **SeedTTS test-en** |
|
152 |
-
| Ground Truth | 0.730 | 2.143 | | 3.92±0.15 | 0.00 |
|
153 |
-
| CosyVoice | 0.643 | 4.079 | 0.316 | 3.52±0.17 | -0.41 ±0.18 |
|
154 |
-
| XTTS-v2 | 0.463 | 3.248 | 0.484 | 3.15±0.22 | -0.86±0.19 |
|
155 |
-
| VoiceCraft | 0.470 | 7.556 | 0.226 | 3.18±0.20 | -1.08 ±0.15 |
|
156 |
-
| MaskGCT | 0.717(0.760) | 2.623(1.283) | 0.188 | 4.24 ±0.12 | 0.03 ±0.14 |
|
157 |
-
| MaskGCT(gt length) | 0.728 | 2.466 | 0.159 | 4.13 ±0.17 | 0.12 ±0.15 |
|
158 |
-
| | | **SeedTTS test-zh** |
|
159 |
-
| Ground Truth | 0.750 | 1.254 | | 3.86 ±0.17 | 0.00 |
|
160 |
-
| CosyVoice | 0.750 | 4.089 | 0.276 | 3.54 ±0.12 | -0.45 ±0.15 |
|
161 |
-
| XTTS-v2 | 0.635 | 2.876 | 0.413 | 2.95 ±0.18 | -0.81 ±0.22 |
|
162 |
-
| MaskGCT | 0.774(0.805) | 2.273(0.843) | 0.106 | 4.09 ±0.12 | 0.05 ±0.17 |
|
163 |
-
| MaskGCT(gt length) | 0.777 | 2.183 | 0.101 | 4.11 ±0.12 | 0.08±0.18 |
|
164 |
-
|
165 |
-
## Citations
|
166 |
-
|
167 |
-
If you use MaskGCT in your research, please cite the following paper:
|
168 |
-
|
169 |
-
```bibtex
|
170 |
-
@article{wang2024maskgct,
|
171 |
-
title={MaskGCT: Zero-Shot Text-to-Speech with Masked Generative Codec Transformer},
|
172 |
-
author={Wang, Yuancheng and Zhan, Haoyue and Liu, Liwei and Zeng, Ruihong and Guo, Haotian and Zheng, Jiachen and Zhang, Qiang and Zhang, Shunsi and Wu, Zhizheng},
|
173 |
-
journal={arXiv preprint arXiv:2409.00750},
|
174 |
-
year={2024}
|
175 |
-
}
|
176 |
-
|
177 |
-
@article{zhang2023amphion,
|
178 |
-
title={Amphion: An open-source audio, music and speech generation toolkit},
|
179 |
-
author={Zhang, Xueyao and Xue, Liumeng and Wang, Yuancheng and Gu, Yicheng and Chen, Xi and Fang, Zihao and Chen, Haopeng and Zou, Lexiao and Wang, Chaoren and Han, Jun and others},
|
180 |
-
journal={arXiv preprint arXiv:2312.09911},
|
181 |
-
year={2023}
|
182 |
-
}
|
183 |
-
```
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
title: MaskGCT TTS Demo
|
4 |
+
sdk: gradio
|
5 |
+
emoji: 😻
|
6 |
+
colorFrom: purple
|
7 |
+
colorTo: purple
|
8 |
+
pinned: false
|
9 |
+
short_description: MaskGCT TTS Demo
|
10 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|