mrfakename commited on
Commit
46a543a
1 Parent(s): 2dc4d0b

Sync from GitHub repo

Browse files

This Space is synced from the GitHub repo: https://github.com/SWivid/F5-TTS. Please submit contributions to the Space there

Files changed (1) hide show
  1. README.md +13 -196
README.md CHANGED
@@ -1,196 +1,13 @@
1
- # F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching
2
-
3
- [![python](https://img.shields.io/badge/Python-3.10-brightgreen)](https://github.com/SWivid/F5-TTS)
4
- [![arXiv](https://img.shields.io/badge/arXiv-2410.06885-b31b1b.svg?logo=arXiv)](https://arxiv.org/abs/2410.06885)
5
- [![demo](https://img.shields.io/badge/GitHub-Demo%20page-blue.svg)](https://swivid.github.io/F5-TTS/)
6
- [![space](https://img.shields.io/badge/🤗-Space%20demo-yellow)](https://huggingface.co/spaces/mrfakename/E2-F5-TTS)
7
-
8
- **F5-TTS**: Diffusion Transformer with ConvNeXt V2, faster trained and inference.
9
-
10
- **E2 TTS**: Flat-UNet Transformer, closest reproduction.
11
-
12
- **Sway Sampling**: Inference-time flow step sampling strategy, greatly improves performance
13
-
14
- ## Installation
15
-
16
- Clone the repository:
17
-
18
- ```bash
19
- git clone https://github.com/SWivid/F5-TTS.git
20
- cd F5-TTS
21
- ```
22
-
23
- Install torch with your CUDA version, e.g. :
24
-
25
- ```bash
26
- pip install torch==2.3.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
27
- pip install torchaudio==2.3.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
28
- ```
29
-
30
- Install other packages:
31
-
32
- ```bash
33
- pip install -r requirements.txt
34
- ```
35
-
36
- ## Prepare Dataset
37
-
38
- Example data processing scripts for Emilia and Wenetspeech4TTS, and you may tailor your own one along with a Dataset class in `model/dataset.py`.
39
-
40
- ```bash
41
- # prepare custom dataset up to your need
42
- # download corresponding dataset first, and fill in the path in scripts
43
-
44
- # Prepare the Emilia dataset
45
- python scripts/prepare_emilia.py
46
-
47
- # Prepare the Wenetspeech4TTS dataset
48
- python scripts/prepare_wenetspeech4tts.py
49
- ```
50
-
51
- ## Training
52
-
53
- Once your datasets are prepared, you can start the training process.
54
-
55
- ```bash
56
- # setup accelerate config, e.g. use multi-gpu ddp, fp16
57
- # will be to: ~/.cache/huggingface/accelerate/default_config.yaml
58
- accelerate config
59
- accelerate launch train.py
60
- ```
61
- An initial guidance on Finetuning [#57](https://github.com/SWivid/F5-TTS/discussions/57).
62
-
63
- ## Inference
64
-
65
- To run inference with pretrained models, download the checkpoints from [🤗 Hugging Face](https://huggingface.co/SWivid/F5-TTS), or automatically downloaded with `inference-cli` and `gradio_app`.
66
-
67
- Currently support 30s for a single generation, which is the **TOTAL** length of prompt audio and the generated. Batch inference with chunks is supported by `inference-cli` and `gradio_app`.
68
- - To avoid possible inference failures, make sure you have seen through the following instructions.
69
- - A longer prompt audio allows shorter generated output. The part longer than 30s cannot be generated properly. Consider using a prompt audio <15s.
70
- - Uppercased letters will be uttered letter by letter, so use lowercased letters for normal words.
71
- - Add some spaces (blank: " ") or punctuations (e.g. "," ".") to explicitly introduce some pauses. If first few words skipped in code-switched generation (cuz different speed with different languages), this might help.
72
-
73
- ### CLI Inference
74
-
75
- Either you can specify everything in `inference-cli.toml` or override with flags. Leave `--ref_text ""` will have ASR model transcribe the reference audio automatically (use extra GPU memory). If encounter network error, consider use local ckpt, just set `ckpt_path` in `inference-cli.py`
76
-
77
- ```bash
78
- python inference-cli.py \
79
- --model "F5-TTS" \
80
- --ref_audio "tests/ref_audio/test_en_1_ref_short.wav" \
81
- --ref_text "Some call me nature, others call me mother nature." \
82
- --gen_text "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences."
83
-
84
- python inference-cli.py \
85
- --model "E2-TTS" \
86
- --ref_audio "tests/ref_audio/test_zh_1_ref_short.wav" \
87
- --ref_text "对,这就是我,万人敬仰的太乙真人。" \
88
- --gen_text "突然,身边一阵笑声。我看着他们,意气风发地挺直了胸膛,甩了甩那稍显肉感的双臂,轻笑道,我身上的肉,是为了掩饰我爆棚的魅力,否则,岂不吓坏了你们呢?"
89
- ```
90
-
91
- ### Gradio App
92
- Currently supported features:
93
- - Chunk inference
94
- - Podcast Generation
95
- - Multiple Speech-Type Generation
96
-
97
- You can launch a Gradio app (web interface) to launch a GUI for inference (will load ckpt from Huggingface, you may set `ckpt_path` to local file in `gradio_app.py`). Currently load ASR model, F5-TTS and E2 TTS all in once, thus use more GPU memory than `inference-cli`.
98
-
99
- ```bash
100
- python gradio_app.py
101
- ```
102
-
103
- You can specify the port/host:
104
-
105
- ```bash
106
- python gradio_app.py --port 7860 --host 0.0.0.0
107
- ```
108
-
109
- Or launch a share link:
110
-
111
- ```bash
112
- python gradio_app.py --share
113
- ```
114
-
115
- ### Speech Editing
116
-
117
- To test speech editing capabilities, use the following command.
118
-
119
- ```bash
120
- python speech_edit.py
121
- ```
122
-
123
- ## Evaluation
124
-
125
- ### Prepare Test Datasets
126
-
127
- 1. Seed-TTS test set: Download from [seed-tts-eval](https://github.com/BytedanceSpeech/seed-tts-eval).
128
- 2. LibriSpeech test-clean: Download from [OpenSLR](http://www.openslr.org/12/).
129
- 3. Unzip the downloaded datasets and place them in the data/ directory.
130
- 4. Update the path for the test-clean data in `scripts/eval_infer_batch.py`
131
- 5. Our filtered LibriSpeech-PC 4-10s subset is already under data/ in this repo
132
-
133
- ### Batch Inference for Test Set
134
-
135
- To run batch inference for evaluations, execute the following commands:
136
-
137
- ```bash
138
- # batch inference for evaluations
139
- accelerate config # if not set before
140
- bash scripts/eval_infer_batch.sh
141
- ```
142
-
143
- ### Download Evaluation Model Checkpoints
144
-
145
- 1. Chinese ASR Model: [Paraformer-zh](https://huggingface.co/funasr/paraformer-zh)
146
- 2. English ASR Model: [Faster-Whisper](https://huggingface.co/Systran/faster-whisper-large-v3)
147
- 3. WavLM Model: Download from [Google Drive](https://drive.google.com/file/d/1-aE1NfzpRCLxA4GUxX9ITI3F9LlbtEGP/view).
148
-
149
- ### Objective Evaluation
150
-
151
- **Some Notes**
152
-
153
- For faster-whisper with CUDA 11:
154
-
155
- ```bash
156
- pip install --force-reinstall ctranslate2==3.24.0
157
- ```
158
-
159
- (Recommended) To avoid possible ASR failures, such as abnormal repetitions in output:
160
-
161
- ```bash
162
- pip install faster-whisper==0.10.1
163
- ```
164
-
165
- Update the path with your batch-inferenced results, and carry out WER / SIM evaluations:
166
- ```bash
167
- # Evaluation for Seed-TTS test set
168
- python scripts/eval_seedtts_testset.py
169
-
170
- # Evaluation for LibriSpeech-PC test-clean (cross-sentence)
171
- python scripts/eval_librispeech_test_clean.py
172
- ```
173
-
174
- ## Acknowledgements
175
-
176
- - [E2-TTS](https://arxiv.org/abs/2406.18009) brilliant work, simple and effective
177
- - [Emilia](https://arxiv.org/abs/2407.05361), [WenetSpeech4TTS](https://arxiv.org/abs/2406.05763) valuable datasets
178
- - [lucidrains](https://github.com/lucidrains) initial CFM structure with also [bfs18](https://github.com/bfs18) for discussion
179
- - [SD3](https://arxiv.org/abs/2403.03206) & [Hugging Face diffusers](https://github.com/huggingface/diffusers) DiT and MMDiT code structure
180
- - [torchdiffeq](https://github.com/rtqichen/torchdiffeq) as ODE solver, [Vocos](https://huggingface.co/charactr/vocos-mel-24khz) as vocoder
181
- - [mrfakename](https://x.com/realmrfakename) huggingface space demo ~
182
- - [FunASR](https://github.com/modelscope/FunASR), [faster-whisper](https://github.com/SYSTRAN/faster-whisper), [UniSpeech](https://github.com/microsoft/UniSpeech) for evaluation tools
183
- - [ctc-forced-aligner](https://github.com/MahmoudAshraf97/ctc-forced-aligner) for speech edit test
184
-
185
- ## Citation
186
- ```
187
- @article{chen-etal-2024-f5tts,
188
- title={F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching},
189
- author={Yushen Chen and Zhikang Niu and Ziyang Ma and Keqi Deng and Chunhui Wang and Jian Zhao and Kai Yu and Xie Chen},
190
- journal={arXiv preprint arXiv:2410.06885},
191
- year={2024},
192
- }
193
- ```
194
- ## License
195
-
196
- Our code is released under MIT License.
 
1
+ ---
2
+ title: F5-TTS
3
+ emoji: 🗣️
4
+ colorFrom: green
5
+ colorTo: green
6
+ sdk: gradio
7
+ app_file: app.py
8
+ pinned: true
9
+ short_description: 'F5-TTS & E2-TTS: Zero-Shot Voice Cloning (Unofficial Demo)'
10
+ sdk_version: 5.1.0
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference