F5-TTS

SWividMIT活跃维护

基于流匹配的语音合成模型官方实现,只需一段参考音频就能克隆音色并生成流畅自然的语音,适合做零样本 TTS 和语音克隆。

Official code for "F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching"

1.1.22发布于 2026-07-23 09:20 UTC15,551star +20 / 7 天2,271fork同步于 2026-11-10 11:26 UTC

怎么上手

由 README 提炼,执行前请确认
conda create -n f5-tts python=3.11 && conda activate f5-tts
pip install f5-tts
f5-tts_infer-gradio
硬件要求按 README 说明

README 未给出显存数值。NVIDIA、AMD(仅 Linux,ROCm)、Intel GPU 与 Apple Silicon 均有对应 PyTorch 安装方式;CLI 中 ref_text 留空会调用 ASR 转写,额外占用 GPU 显存。

支持 Apple Silicon需要 CUDA支持 ROCm / AMD有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于流匹配的开源 TTS 项目,支持零样本克隆音色、多说话人合成与微调训练

基于流匹配的语音合成模型官方实现,只需一段参考音频就能克隆音色并生成流畅自然的语音,适合做零样本 TTS 和语音克隆。

核心能力

  • 用 Diffusion Transformer 加 ConvNeXt V2 做流匹配语音合成
  • 提供 Sway Sampling 推理采样策略提升生成质量
  • 支持参考音频零样本克隆音色与多说话人、多风格生成
  • 内置 Gradio 网页界面与 CLI 两种推理入口
  • 支持用 Hugging Face Accelerate 或 Gradio 做微调训练

容易踩的坑

需先自行安装 FFmpeg(如 conda install ffmpeg),否则音频处理会失败。PyTorch 需按设备匹配 CUDA/ROCm/XPU 版本单独安装,不能直接装默认版。AMD 的 RDNA 3.5/4 显卡必须用 ROCm 7.x,用 6.x 会报 HIP error: invalid device function。预训练模型权重需从 Hugging Face 或 ModelScope 下载,且模型为 CC-BY-NC 非商用许可。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本1.1.22
  1. 1.1.22最新正式版2026-07-23 · 2026-07-23 09:20 UTC

    What's Changed

    New Contributors

    Full Changelog: https://github.com/SWivid/F5-TTS/compare/1.1.21...1.1.22

  2. 1.1.212026-07-05 · 2026-07-05 11:04 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/SWivid/F5-TTS/compare/1.1.20...1.1.21

  3. 1.1.202026-04-20 · 2026-04-20 07:31 UTC
    查看更新说明

    What's Changed

    • fix: refactor cache handling in DiT, MMDiT, and UNetT classes (lazyinit to avoid EMA deepcopy failure while training)
    • fix: cap Gradio version to <6.11 to prevent UI freeze by @will422-l in https://github.com/SWivid/F5-TTS/pull/1290

    New Contributors

    Full Changelog: https://github.com/SWivid/F5-TTS/compare/1.1.19...1.1.20

  4. 1.1.192026-04-16 · 2026-04-16 02:59 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/SWivid/F5-TTS/compare/1.1.18...1.1.19

  5. 1.1.182026-03-24 · 2026-03-24 12:22 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/SWivid/F5-TTS/compare/1.1.17...1.1.18

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching

    python arXiv demo hfspace msspace lab lab lab

    F5-TTS: Diffusion Transformer with ConvNeXt V2, faster trained and inference.

    E2 TTS: Flat-UNet Transformer, closest reproduction from paper.

    Sway Sampling: Inference-time flow step sampling strategy, greatly improves performance

    Thanks to all the contributors !

    News

    Installation

    Create a separate environment if needed

    # Create a conda env with python_version>=3.10  (you could also use virtualenv)
    conda create -n f5-tts python=3.11
    conda activate f5-tts
    
    # Install FFmpeg if you haven't yet
    conda install ffmpeg
    

    Install PyTorch with matched device

    # Install pytorch with your CUDA version, e.g.
    pip install torch==2.8.0+cu128 torchaudio==2.8.0+cu128 --extra-index-url https://download.pytorch.org/whl/cu128
    
    # And also possible previous versions, e.g.
    pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124
    # etc.
    
    # Install pytorch with your ROCm version (Linux only), e.g.
    pip install torch==2.9.1+rocm7.2 torchaudio==2.9.1+rocm7.2 --extra-index-url https://download.pytorch.org/whl/rocm7.2
    
    # For older GPUs (RDNA1/2/3 only):
    # pip install torch==2.5.1+rocm6.2 torchaudio==2.5.1+rocm6.2 --extra-index-url https://download.pytorch.org/whl/rocm6.2
    

    Note: RDNA 3.5 and RDNA 4 GPUs (Radeon 8050S/8060S, RX 9060/9070 series) require ROCm 7.x — these architectures (gfx1151/gfx1201) are not included in ROCm 6.x (6.2 compatibility matrix vs 7.2 compatibility matrix). Using ROCm 6.x on these GPUs causes HIP error: invalid device function (#1236).

    # Install pytorch with your XPU version, e.g.
    # Intel® Deep Learning Essentials or Intel® oneAPI Base Toolkit must be installed
    pip install torch torchaudio --index-url https://download.pytorch.org/whl/test/xpu
    
    # Intel GPU support is also available through IPEX (Intel® Extension for PyTorch)
    # IPEX does not require the Intel® Deep Learning Essentials or Intel® oneAPI Base Toolkit
    # See: https://pytorch-extension.intel.com/installation?request=platform
    
    # Install the stable pytorch, e.g.
    pip install torch torchaudio
    

    Then you can choose one from below:

    1. As a pip package (if just for inference)

    pip install f5-tts
    

    2. Local editable (if also do training, finetuning)

    git clone https://github.com/SWivid/F5-TTS.git
    cd F5-TTS
    # git submodule update --init --recursive  # (optional, if use bigvgan as vocoder)
    pip install -e .
    

    Docker usage also available

    # Build from Dockerfile
    docker build -t f5tts:v1 .
    
    # Run from GitHub Container Registry
    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
    
    # Quickstart if you want to just run the web interface (not CLI)
    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
    

    Runtime

    Deployment solution with Triton and TensorRT-LLM.

    Benchmark Results

    Decoding on a single L20 GPU, using 26 different prompt_audio & target_text pairs, 16 NFE.

    ModelConcurrencyAvg LatencyRTFMode
    F5-TTS Base (Vocos)2253 ms0.0394Client-Server
    F5-TTS Base (Vocos)1 (Batch_size)-0.0402Offline TRT-LLM
    F5-TTS Base (Vocos)1 (Batch_size)-0.1467Offline Pytorch

    See detailed instructions for more information.

    Inference

    • In order to achieve desired performance, take a moment to read detailed guidance.
    • By properly searching the keywords of problem encountered, issues are very helpful.

    1. Gradio App

    Currently supported features:

    # Launch a Gradio app (web interface)
    f5-tts_infer-gradio
    
    # Specify the port/host
    f5-tts_infer-gradio --port 7860 --host 0.0.0.0
    
    # Launch a share link
    f5-tts_infer-gradio --share
    
    services:
      f5-tts:
        image: ghcr.io/swivid/f5-tts:main
        ports:
          - "7860:7860"
        environment:
          GRADIO_SERVER_PORT: 7860
        entrypoint: ["f5-tts_infer-gradio", "--port", "7860", "--host", "0.0.0.0"]
        deploy:
          resources:
            reservations:
              devices:
                - driver: nvidia
                  count: 1
                  capabilities: [gpu]
    
    volumes:
      f5-tts:
        driver: local
    

    2. CLI Inference

    # Run with flags
    # Leave --ref_text "" will have ASR model transcribe (extra GPU memory usage)
    f5-tts_infer-cli --model F5TTS_v1_Base \
    --ref_audio "provide_prompt_wav_path_here.wav" \
    --ref_text "The content, subtitle or transcription of reference audio." \
    --gen_text "Some text you want TTS model generate for you."
    
    # Run with default setting. src/f5_tts/infer/examples/basic/basic.toml
    f5-tts_infer-cli
    # Or with your own .toml file
    f5-tts_infer-cli -c custom.toml
    
    # Multi voice. See src/f5_tts/infer/README.md
    f5-tts_infer-cli -c src/f5_tts/infer/examples/multi/story.toml
    

    Training

    1. With Hugging Face Accelerate

    Refer to training & finetuning guidance for best practice.

    2. With Gradio App

    # Quick start with Gradio web interface
    f5-tts_finetune-gradio
    

    Read training & finetuning guidance for more instructions.

    Evaluation

    Development

    Use pre-commit to ensure code quality (will run linters and formatters automatically):

    pip install pre-commit
    pre-commit install
    

    When making a pull request, before each commit, run:

    pre-commit run --all-files
    

    Note: Some model components have linting exceptions for E722 to accommodate tensor notation.

    Acknowledgements

    Citation

    If our work and codebase is useful for you, please cite as:

    @article{chen-etal-2024-f5tts,
          title={F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching}, 
          author={Yushen Chen and Zhikang Niu and Ziyang Ma and Keqi Deng and Chunhui Wang and Jian Zhao and Kai Yu and Xie Chen},
          journal={arXiv preprint arXiv:2410.06885},
          year={2024},
    }
    

    License

    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.