Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,261 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
**F5-TTS**: Diffusion Transformer with ConvNeXt V2, faster trained and inference.
|
| 13 |
-
|
| 14 |
-
**E2 TTS**: Flat-UNet Transformer, closest reproduction from [paper](https://arxiv.org/abs/2406.18009).
|
| 15 |
-
|
| 16 |
-
**Sway Sampling**: Inference-time flow step sampling strategy, greatly improves performance
|
| 17 |
-
|
| 18 |
-
### Thanks to all the contributors !
|
| 19 |
-
|
| 20 |
-
## News
|
| 21 |
-
- **2025/03/12**: 🔥 F5-TTS v1 base model with better training and inference performance. [Few demo](https://swivid.github.io/F5-TTS_updates).
|
| 22 |
-
- **2024/10/08**: F5-TTS & E2 TTS base models on [🤗 Hugging Face](https://huggingface.co/SWivid/F5-TTS), [🤖 Model Scope](https://www.modelscope.cn/models/SWivid/F5-TTS_Emilia-ZH-EN), [🟣 Wisemodel](https://wisemodel.cn/models/SJTU_X-LANCE/F5-TTS_Emilia-ZH-EN).
|
| 23 |
-
|
| 24 |
-
## Installation
|
| 25 |
-
|
| 26 |
-
### Create a separate environment if needed
|
| 27 |
-
|
| 28 |
-
```bash
|
| 29 |
-
# Create a python 3.10 conda env (you could also use virtualenv)
|
| 30 |
-
conda create -n f5-tts python=3.10
|
| 31 |
-
conda activate f5-tts
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
### Install PyTorch with matched device
|
| 35 |
-
|
| 36 |
-
<details>
|
| 37 |
-
<summary>NVIDIA GPU</summary>
|
| 38 |
-
|
| 39 |
-
> ```bash
|
| 40 |
-
> # Install pytorch with your CUDA version, e.g.
|
| 41 |
-
> pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124
|
| 42 |
-
> ```
|
| 43 |
-
|
| 44 |
-
</details>
|
| 45 |
-
|
| 46 |
-
<details>
|
| 47 |
-
<summary>AMD GPU</summary>
|
| 48 |
-
|
| 49 |
-
> ```bash
|
| 50 |
-
> # Install pytorch with your ROCm version (Linux only), e.g.
|
| 51 |
-
> pip install torch==2.5.1+rocm6.2 torchaudio==2.5.1+rocm6.2 --extra-index-url https://download.pytorch.org/whl/rocm6.2
|
| 52 |
-
> ```
|
| 53 |
-
|
| 54 |
-
</details>
|
| 55 |
-
|
| 56 |
-
<details>
|
| 57 |
-
<summary>Intel GPU</summary>
|
| 58 |
-
|
| 59 |
-
> ```bash
|
| 60 |
-
> # Install pytorch with your XPU version, e.g.
|
| 61 |
-
> # Intel® Deep Learning Essentials or Intel® oneAPI Base Toolkit must be installed
|
| 62 |
-
> pip install torch torchaudio --index-url https://download.pytorch.org/whl/test/xpu
|
| 63 |
-
>
|
| 64 |
-
> # Intel GPU support is also available through IPEX (Intel® Extension for PyTorch)
|
| 65 |
-
> # IPEX does not require the Intel® Deep Learning Essentials or Intel® oneAPI Base Toolkit
|
| 66 |
-
> # See: https://pytorch-extension.intel.com/installation?request=platform
|
| 67 |
-
> ```
|
| 68 |
-
|
| 69 |
-
</details>
|
| 70 |
-
|
| 71 |
-
<details>
|
| 72 |
-
<summary>Apple Silicon</summary>
|
| 73 |
-
|
| 74 |
-
> ```bash
|
| 75 |
-
> # Install the stable pytorch, e.g.
|
| 76 |
-
> pip install torch torchaudio
|
| 77 |
-
> ```
|
| 78 |
-
|
| 79 |
-
</details>
|
| 80 |
-
|
| 81 |
-
### Then you can choose one from below:
|
| 82 |
-
|
| 83 |
-
> ### 1. As a pip package (if just for inference)
|
| 84 |
-
>
|
| 85 |
-
> ```bash
|
| 86 |
-
> pip install f5-tts
|
| 87 |
-
> ```
|
| 88 |
-
>
|
| 89 |
-
> ### 2. Local editable (if also do training, finetuning)
|
| 90 |
-
>
|
| 91 |
-
> ```bash
|
| 92 |
-
> git clone https://github.com/SWivid/F5-TTS.git
|
| 93 |
-
> cd F5-TTS
|
| 94 |
-
> # git submodule update --init --recursive # (optional, if use bigvgan as vocoder)
|
| 95 |
-
> pip install -e .
|
| 96 |
-
> ```
|
| 97 |
-
|
| 98 |
-
### Docker usage also available
|
| 99 |
-
```bash
|
| 100 |
-
# Build from Dockerfile
|
| 101 |
-
docker build -t f5tts:v1 .
|
| 102 |
-
|
| 103 |
-
# Run from GitHub Container Registry
|
| 104 |
-
docker container run --rm -it --gpus=all --mount 'type=volume,source=f5-tts,target=/root/.cache/huggingface/hub/' -p 7860:7860 ghcr.io/swivid/f5-tts:main
|
| 105 |
-
|
| 106 |
-
# Quickstart if you want to just run the web interface (not CLI)
|
| 107 |
-
docker container run --rm -it --gpus=all --mount 'type=volume,source=f5-tts,target=/root/.cache/huggingface/hub/' -p 7860:7860 ghcr.io/swivid/f5-tts:main f5-tts_infer-gradio --host 0.0.0.0
|
| 108 |
-
```
|
| 109 |
-
|
| 110 |
-
### Runtime
|
| 111 |
-
|
| 112 |
-
Deployment solution with Triton and TensorRT-LLM.
|
| 113 |
-
|
| 114 |
-
#### Benchmark Results
|
| 115 |
-
Decoding on a single L20 GPU, using 26 different prompt_audio & target_text pairs, 16 NFE.
|
| 116 |
-
|
| 117 |
-
| Model | Concurrency | Avg Latency | RTF | Mode |
|
| 118 |
-
|---------------------|----------------|-------------|--------|-----------------|
|
| 119 |
-
| F5-TTS Base (Vocos) | 2 | 253 ms | 0.0394 | Client-Server |
|
| 120 |
-
| F5-TTS Base (Vocos) | 1 (Batch_size) | - | 0.0402 | Offline TRT-LLM |
|
| 121 |
-
| F5-TTS Base (Vocos) | 1 (Batch_size) | - | 0.1467 | Offline Pytorch |
|
| 122 |
-
|
| 123 |
-
See [detailed instructions](src/f5_tts/runtime/triton_trtllm/README.md) for more information.
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
## Inference
|
| 127 |
-
|
| 128 |
-
- In order to achieve desired performance, take a moment to read [detailed guidance](src/f5_tts/infer).
|
| 129 |
-
- By properly searching the keywords of problem encountered, [issues](https://github.com/SWivid/F5-TTS/issues?q=is%3Aissue) are very helpful.
|
| 130 |
-
|
| 131 |
-
### 1. Gradio App
|
| 132 |
-
|
| 133 |
-
Currently supported features:
|
| 134 |
-
|
| 135 |
-
- Basic TTS with Chunk Inference
|
| 136 |
-
- Multi-Style / Multi-Speaker Generation
|
| 137 |
-
- Voice Chat powered by Qwen2.5-3B-Instruct
|
| 138 |
-
- [Custom inference with more language support](src/f5_tts/infer/SHARED.md)
|
| 139 |
-
|
| 140 |
-
```bash
|
| 141 |
-
# Launch a Gradio app (web interface)
|
| 142 |
-
f5-tts_infer-gradio
|
| 143 |
-
|
| 144 |
-
# Specify the port/host
|
| 145 |
-
f5-tts_infer-gradio --port 7860 --host 0.0.0.0
|
| 146 |
-
|
| 147 |
-
# Launch a share link
|
| 148 |
-
f5-tts_infer-gradio --share
|
| 149 |
-
```
|
| 150 |
-
|
| 151 |
-
<details>
|
| 152 |
-
<summary>NVIDIA device docker compose file example</summary>
|
| 153 |
-
|
| 154 |
-
```yaml
|
| 155 |
-
services:
|
| 156 |
-
f5-tts:
|
| 157 |
-
image: ghcr.io/swivid/f5-tts:main
|
| 158 |
-
ports:
|
| 159 |
-
- "7860:7860"
|
| 160 |
-
environment:
|
| 161 |
-
GRADIO_SERVER_PORT: 7860
|
| 162 |
-
entrypoint: ["f5-tts_infer-gradio", "--port", "7860", "--host", "0.0.0.0"]
|
| 163 |
-
deploy:
|
| 164 |
-
resources:
|
| 165 |
-
reservations:
|
| 166 |
-
devices:
|
| 167 |
-
- driver: nvidia
|
| 168 |
-
count: 1
|
| 169 |
-
capabilities: [gpu]
|
| 170 |
-
|
| 171 |
-
volumes:
|
| 172 |
-
f5-tts:
|
| 173 |
-
driver: local
|
| 174 |
-
```
|
| 175 |
-
|
| 176 |
-
</details>
|
| 177 |
-
|
| 178 |
-
### 2. CLI Inference
|
| 179 |
-
|
| 180 |
-
```bash
|
| 181 |
-
# Run with flags
|
| 182 |
-
# Leave --ref_text "" will have ASR model transcribe (extra GPU memory usage)
|
| 183 |
-
f5-tts_infer-cli --model F5TTS_v1_Base \
|
| 184 |
-
--ref_audio "provide_prompt_wav_path_here.wav" \
|
| 185 |
-
--ref_text "The content, subtitle or transcription of reference audio." \
|
| 186 |
-
--gen_text "Some text you want TTS model generate for you."
|
| 187 |
-
|
| 188 |
-
# Run with default setting. src/f5_tts/infer/examples/basic/basic.toml
|
| 189 |
-
f5-tts_infer-cli
|
| 190 |
-
# Or with your own .toml file
|
| 191 |
-
f5-tts_infer-cli -c custom.toml
|
| 192 |
-
|
| 193 |
-
# Multi voice. See src/f5_tts/infer/README.md
|
| 194 |
-
f5-tts_infer-cli -c src/f5_tts/infer/examples/multi/story.toml
|
| 195 |
-
```
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
## Training
|
| 199 |
-
|
| 200 |
-
### 1. With Hugging Face Accelerate
|
| 201 |
-
|
| 202 |
-
Refer to [training & finetuning guidance](src/f5_tts/train) for best practice.
|
| 203 |
-
|
| 204 |
-
### 2. With Gradio App
|
| 205 |
-
|
| 206 |
-
```bash
|
| 207 |
-
# Quick start with Gradio web interface
|
| 208 |
-
f5-tts_finetune-gradio
|
| 209 |
-
```
|
| 210 |
-
|
| 211 |
-
Read [training & finetuning guidance](src/f5_tts/train) for more instructions.
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
## [Evaluation](src/f5_tts/eval)
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
## Development
|
| 218 |
-
|
| 219 |
-
Use pre-commit to ensure code quality (will run linters and formatters automatically):
|
| 220 |
-
|
| 221 |
-
```bash
|
| 222 |
-
pip install pre-commit
|
| 223 |
-
pre-commit install
|
| 224 |
-
```
|
| 225 |
-
|
| 226 |
-
When making a pull request, before each commit, run:
|
| 227 |
-
|
| 228 |
-
```bash
|
| 229 |
-
pre-commit run --all-files
|
| 230 |
-
```
|
| 231 |
-
|
| 232 |
-
Note: Some model components have linting exceptions for E722 to accommodate tensor notation.
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
## Acknowledgements
|
| 236 |
-
|
| 237 |
-
- [E2-TTS](https://arxiv.org/abs/2406.18009) brilliant work, simple and effective
|
| 238 |
-
- [Emilia](https://arxiv.org/abs/2407.05361), [WenetSpeech4TTS](https://arxiv.org/abs/2406.05763), [LibriTTS](https://arxiv.org/abs/1904.02882), [LJSpeech](https://keithito.com/LJ-Speech-Dataset/) valuable datasets
|
| 239 |
-
- [lucidrains](https://github.com/lucidrains) initial CFM structure with also [bfs18](https://github.com/bfs18) for discussion
|
| 240 |
-
- [SD3](https://arxiv.org/abs/2403.03206) & [Hugging Face diffusers](https://github.com/huggingface/diffusers) DiT and MMDiT code structure
|
| 241 |
-
- [torchdiffeq](https://github.com/rtqichen/torchdiffeq) as ODE solver, [Vocos](https://huggingface.co/charactr/vocos-mel-24khz) and [BigVGAN](https://github.com/NVIDIA/BigVGAN) as vocoder
|
| 242 |
-
- [FunASR](https://github.com/modelscope/FunASR), [faster-whisper](https://github.com/SYSTRAN/faster-whisper), [UniSpeech](https://github.com/microsoft/UniSpeech), [SpeechMOS](https://github.com/tarepan/SpeechMOS) for evaluation tools
|
| 243 |
-
- [ctc-forced-aligner](https://github.com/MahmoudAshraf97/ctc-forced-aligner) for speech edit test
|
| 244 |
-
- [mrfakename](https://x.com/realmrfakename) huggingface space demo ~
|
| 245 |
-
- [f5-tts-mlx](https://github.com/lucasnewman/f5-tts-mlx/tree/main) Implementation with MLX framework by [Lucas Newman](https://github.com/lucasnewman)
|
| 246 |
-
- [F5-TTS-ONNX](https://github.com/DakeQQ/F5-TTS-ONNX) ONNX Runtime version by [DakeQQ](https://github.com/DakeQQ)
|
| 247 |
-
- [Yuekai Zhang](https://github.com/yuekaizhang) Triton and TensorRT-LLM support ~
|
| 248 |
-
|
| 249 |
-
## Citation
|
| 250 |
-
If our work and codebase is useful for you, please cite as:
|
| 251 |
-
```
|
| 252 |
-
@article{chen-etal-2024-f5tts,
|
| 253 |
-
title={F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching},
|
| 254 |
-
author={Yushen Chen and Zhikang Niu and Ziyang Ma and Keqi Deng and Chunhui Wang and Jian Zhao and Kai Yu and Xie Chen},
|
| 255 |
-
journal={arXiv preprint arXiv:2410.06885},
|
| 256 |
-
year={2024},
|
| 257 |
-
}
|
| 258 |
-
```
|
| 259 |
-
## License
|
| 260 |
-
|
| 261 |
-
Our code is released under MIT License. The pre-trained models are licensed under the CC-BY-NC license due to the training data Emilia, which is an in-the-wild dataset. Sorry for any inconvenience this may cause.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: F5-TTS Fine-tuned Demo
|
| 3 |
+
emoji: 🎙️
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "4.29.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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