F5 TTS: フローマッチングによる流暢で忠実な音声
Python3.10+
arXiv2410.06885
プロジェクトデモ
音声例
モデルリソース
コードMIT
F5 TTS:音声合成研究向けにConvNeXt V2を使用する拡散トランスフォーマー。
E2 TTS:F5 TTSのアプローチと並行して検討されたFlat-UNetトランスフォーマー。
Sway Sampling:推論時のフローステップサンプリング戦略。
すべてのコントリビューターに感謝します!
ニュース
- 2025/03/12: F5 TTS v1の新しいベースモデルが、トレーニングと推論のアップデートとともに導入されました。 推論を試す.
- 2024/10/08: F5 TTSとE2 TTSのベースモデルリソースが、研究コミュニティ向けに公開されました。 インストール方法を見る.
インストール
必要に応じて別の環境を作成してください
# Create a conda environment with Python 3.10 or newer conda create -n f5-tts python=3.11 conda activate f5-tts # Install FFmpeg if needed conda install ffmpeg
デバイスに合ったPyTorchをインストール
NVIDIA GPU
# Select a PyTorch build matched to your CUDA version
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128AMD GPU
# Select a PyTorch build matched to your ROCm version
pip install torch torchaudio --index-url https://download.pytorch.org/whl/rocm7.2Intel GPU
# Check the current PyTorch XPU installation guidance
pip install torch torchaudio --index-url https://download.pytorch.org/whl/test/xpuApple Silicon
pip install torch torchaudio
以下から1つを選択できます:
1. pipパッケージとして(推論のみを行う場合)
pip install f5-tts2. ローカルの編集可能な形式で(学習やファインチューニングも行う場合)
git clone https://github.com/SWivid/F5-TTS.git cd F5-TTS # Optional when using BigVGAN as a vocoder: # git submodule update --init --recursive pip install -e .
Dockerも利用可能
# Build from the Dockerfile docker build -t f5tts:v1 . # Run the published container with a GPU docker container run --rm -it --gpus=all -p 7860:7860 ghcr.io/swivid/f5-tts:main # Launch its web interface docker container run --rm -it --gpus=all -p 7860:7860 ghcr.io/swivid/f5-tts:main f5-tts_infer-gradio --host 0.0.0.0
実行環境
このプロジェクトには、TritonとTensorRT-LLMを使用したデプロイ方法も記載されています。
ベンチマーク結果
公開されているベンチマークでは、単一のL20 GPU上で、26組のプロンプト音声と対象テキストを16 NFEでデコードした結果が示されています。
| モデル | 同時実行数 | 平均レイテンシー | RTF | モード |
|---|---|---|---|---|
| F5 TTS Base (Vocos) | 2 | 253 ms | 0.0394 | クライアント・サーバー |
| F5 TTS Base (Vocos) | 1(バッチサイズ) | — | 0.0402 | オフライン TRT-LLM |
| F5 TTS Base (Vocos) | 1(バッチサイズ) | — | 0.1467 | オフライン PyTorch |
ベンチマークの詳細と設定条件については、プロジェクトの実行環境に関するドキュメントをご覧ください。
推論
- モデルの性能を評価する前に、推論に関するガイドをお読みください。
- 特定の問題を解決する際は、プロジェクト内の既存のディスカッションを検索してください。
1. Gradioアプリ
ドキュメント化されている機能:
- チャンク推論による基本的なTTS
- 複数スタイル・複数話者の生成
- Qwen2.5-3B-Instructを使用したボイスチャット
- 追加の言語をサポートするカスタム推論
# Launch the Gradio web interface f5-tts_infer-gradio # Specify a port and host f5-tts_infer-gradio --port 7860 --host 0.0.0.0 # Request a share link f5-tts_infer-gradio --share
NVIDIAデバイス向けDocker Composeファイルの例
services:
f5-tts:
image: ghcr.io/swivid/f5-tts:main
ports:
- "7860:7860"
environment:
GRADIO_SERVER_PORT: 78602. CLI推論
# Run with a reference recording and a new text prompt f5-tts_infer-cli --model F5TTS_v1_Base \ --ref_audio "provide_prompt_wav_path_here.wav" \ --ref_text "The words spoken in the reference audio." \ --gen_text "The words to generate." # Run with the project's default settings f5-tts_infer-cli # Or provide your own TOML settings f5-tts_infer-cli -c custom.toml # A multi-voice example f5-tts_infer-cli -c src/f5_tts/infer/examples/multi/story.toml
トレーニング
1. Hugging Face Accelerateを使用
推奨される実践方法については、プロジェクトのトレーニングおよびファインチューニングのガイダンスを参照してください。
2. Gradioアプリを使用
# Start the finetuning web interface
f5-tts_finetune-gradio設定およびデータセットの手順については、トレーニングガイダンスを確認してください。
評価
開発
Pre-commitでプロジェクトのフォーマッターと品質チェックを実行できます:
pip install pre-commit pre-commit install
変更を提出する前に、ファイル全体に対してチェックを実行してください:
pre-commit run --all-files
一部のモデルコンポーネントでは、テンソル表記のためリンティングが例外扱いされています。
謝辞
- 関連するフローマッチング研究を行ったE2-TTS
- Emilia、WenetSpeech4TTS、LibriTTS、LJSpeechデータセット
- 初期のCFM構造と議論に貢献したLucidrainsおよび共同研究者
- Transformerコードの参考資料を提供したStable Diffusion 3およびHugging Face Diffusers
- ソルバーおよびボコーダーの開発に貢献したTorchdiffeq、Vocos、BigVGAN
- 評価ツールを提供したFunASR、faster-whisper、UniSpeech、SpeechMOS
- 音声編集評価用CTC強制アライナー
- 音声デモを構築したコミュニティメンバー
- MLX実装およびそのメンテナー
- ONNX Runtime実装およびそのメンテナー
- TritonおよびTensorRT-LLM対応への貢献者
引用
この研究とコードベースが役立った場合は、原論文を引用してください:
@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}
}ライセンス
原プロジェクトのコードはMITライセンスで公開されています。事前学習済みモデルには、学習データに関連する個別のCC-BY-NCライセンスが適用されます。ご自身の成果物で使用する前に、原プロジェクトの利用規約をご確認ください。