F5-TTS Setup Guide: Install, Voice Cloning, CLI & API (2026)
Want to go deeper than this article?
Free account unlocks the first chapter of all 25 courses — RAG, agents, MCP, voice AI, MLOps, real GitHub repos.
Voice working locally? Build the whole pipeline. Whisper, TTS, and voice cloning wired into real projects — hands-on courses. First chapter free, no card.
F5-TTS is an open-source text-to-speech and zero-shot voice-cloning model from the SWivid team: MIT-licensed code, CC-BY-NC (non-commercial) pretrained weights, installed with pip install f5-tts after you install PyTorch for your GPU. The current default checkpoint is F5TTS_v1_Base (released March 12, 2025 per the README), a 1.35 GB safetensors file that downloads from Hugging Face on first run. Every command on this page was checked against the SWivid/F5-TTS README and the inference docs on September 22, 2026 (latest release 1.1.22, July 23, 2026).
What you need to run F5-TTS
| Requirement | What the project documents |
|---|---|
| Python | 3.10 or newer (README: "python_version>=3.10"; the example env uses 3.11) |
| PyTorch | Installed separately, matched to your device (see the exact commands below) |
| NVIDIA GPU | Any CUDA card; README example pins torch==2.8.0+cu128 (or 2.4.0+cu124 for older stacks) |
| AMD GPU | Linux only, ROCm build of PyTorch; RDNA 3.5 / RDNA 4 cards (Radeon 8050S/8060S, RX 9060/9070) need ROCm 7.x — ROCm 6.x gives HIP error: invalid device function |
| Intel GPU | XPU build of PyTorch (needs Intel oneAPI Base Toolkit or Deep Learning Essentials) or IPEX |
| Apple Silicon | Stock pip install torch torchaudio; the API auto-selects mps when CUDA and XPU are absent |
| CPU only | Works — the API falls back to cpu — but the README publishes no CPU speed figures |
| FFmpeg | Required (conda install ffmpeg or your package manager) |
| Disk | ~1.35 GB for F5TTS_v1_Base, plus the Vocos vocoder, cached under ~/.cache/huggingface/hub |
| VRAM | The project publishes no minimum. Two documented memory notes: leaving --ref_text empty loads an ASR model ("extra GPU memory usage"), and generation is capped at 30 seconds of audio per pass, so long texts are chunked automatically |
The last row matters: the README and the inference docs do not state a VRAM figure, so any "needs X GB" number you see elsewhere is somebody's measurement, not the project's. The weights are 1.35 GB; budget for that plus the vocoder, activations and, if you skip the transcript, the ASR model.
Reading articles is good. Building is better.
Free account = the first chapter of all 25 courses, with a per-chapter AI tutor. No card.
Table of Contents
- What F5-TTS Is
- Installation (verified commands)
- Your First Voice Clone (CLI)
- Reference Audio Rules From the Docs
- CLI Options That Matter
- Python API
- Gradio Web UI
- Docker
- Other Languages: Community Checkpoints
- ComfyUI Node
- Fine-Tuning
- F5-TTS vs XTTS v2, Chatterbox, Kokoro and Others
- Licence and Ethics
- Troubleshooting
- FAQ
What F5-TTS Is
F5-TTS ("A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching", arXiv 2410.06885, October 2024) is a non-autoregressive TTS model. The README describes the pieces:
- F5-TTS — a Diffusion Transformer with ConvNeXt V2 text conditioning, "faster trained and inference"
- E2 TTS — a Flat-UNet Transformer, the repo's reproduction of Microsoft's E2 TTS paper, shipped as the
E2TTS_Basecheckpoint - Sway Sampling — an inference-time flow-step sampling strategy the authors say "greatly improves performance"
- Vocoder — mel-spectrograms are turned into audio by Vocos (default) or BigVGAN; F5-TTS is not vocoder-free
Three checkpoints live in the official Hugging Face repos: F5TTS_v1_Base (current default, 1.348 GB), F5TTS_Base (the original, 1.349 GB, the only one that supports the BigVGAN vocoder) and E2TTS_Base (in the separate SWivid/E2-TTS repo). All were trained on the Emilia dataset in Chinese and English, which is why the weights are CC-BY-NC: the README says the models are "licensed under the CC-BY-NC license due to the training data Emilia, which is an in-the-wild dataset". The code itself is MIT.
Installation (verified commands)
The README's install is three steps: an environment, PyTorch for your device, then the package. These are the README's own commands.
1. Environment
# 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
2. PyTorch matched to your GPU
# NVIDIA GPU — 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
# (older stacks: pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124)
# AMD GPU — Linux only, install pytorch with your ROCm version, 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
# older RDNA1/2/3 cards 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
# Intel GPU — needs Intel Deep Learning Essentials or oneAPI Base Toolkit
pip install torch torchaudio --index-url https://download.pytorch.org/whl/test/xpu
# Apple Silicon — the stable pytorch
pip install torch torchaudio
The README's AMD note is worth repeating verbatim in spirit: RDNA 3.5 and RDNA 4 GPUs (Radeon 8050S/8060S, RX 9060/9070 series) are not in ROCm 6.x, and using ROCm 6.x on them "causes HIP error: invalid device function" (tracked in issue #1236). Use the ROCm 7.2 build for those cards. For the broader picture of running voice models on Radeon, see our voice AI VRAM requirements by GPU.
3. F5-TTS itself
# As a pip package (if just for inference)
pip install f5-tts
# Or local editable (if also doing 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 .
Check it worked with f5-tts_infer-cli --help. The console commands installed are f5-tts_infer-cli, f5-tts_infer-gradio and f5-tts_finetune-gradio.
Run this on your own machine and stop paying every month
Pay once and keep it. No renewal, no per-token bill, and nothing you feed it ever leaves your hardware.
Your First Voice Clone (CLI)
The README's own inference example, with F5TTS_v1_Base as the model:
# 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."
What the flags mean (from infer_cli.py):
--ref_audio(-r) — the reference clip whose voice you want--ref_text(-s) — its transcript. Pass""to let the bundled ASR model transcribe it, at the cost of extra GPU memory--gen_text(-t) — the new text to speak--output_dir(-o) and--output_file(-w) — where the WAV goes; the default istests/infer_cli_<timestamp>.wav
You can also run f5-tts_infer-cli with no flags to use the bundled basic.toml example, or f5-tts_infer-cli -c custom.toml with your own config.
Reference Audio Rules From the Docs
The inference README lists concrete rules that decide clone quality. In its words, or close to them:
- Keep the reference under 12 seconds and "leave proper silence space (e.g. 1s) at the end" — otherwise there is a risk of truncating mid-word. Long reference audio is automatically clipped to ~12 s.
- 30 seconds per generation is the current limit for a single pass, counting both prompt and output; the CLI and Gradio app chunk longer text automatically.
- Uppercase letters are read letter by letter ("best with form like K.F.C."); use lowercase for ordinary words.
- Add spaces or punctuation to force pauses. If an English sentence-ending punctuation mark is not followed by a space, it is not treated as a chunk boundary.
- Numbers are read in English unless you pre-convert them to Chinese characters.
Beyond those, the usual recording advice applies: one speaker, no music or echo, a level that is neither clipped nor faint. The same rules are the difference between a convincing clone and a flat one in every engine we cover in local AI voice cloning.
CLI Options That Matter
Every flag below exists in infer_cli.py; defaults come from the model config and the bundled basic.toml.
# Batch from a text file (ignores --gen_text)
f5-tts_infer-cli --model F5TTS_v1_Base --ref_audio ref.wav --ref_text "..." \
--gen_file lines.txt --output_dir outputs/ --output_file book.wav
# Quality / speed knobs
f5-tts_infer-cli ... --nfe_step 32 # denoising steps (API default 32)
f5-tts_infer-cli ... --cfg_strength 2 # classifier-free guidance (API default 2)
f5-tts_infer-cli ... --speed 1.0 # playback speed of the generated audio
f5-tts_infer-cli ... --cross_fade_duration 0.15 # seconds of cross-fade between chunks (API default 0.15)
f5-tts_infer-cli ... --remove_silence # strip long silences from the output
f5-tts_infer-cli ... --save_chunk # also save each chunk
# Vocoder: BigVGAN is only supported with F5TTS_Base
f5-tts_infer-cli --model F5TTS_Base --vocoder_name bigvgan --load_vocoder_from_local
# Custom checkpoint (local path, or hf:// which the CLI resolves for you)
f5-tts_infer-cli --ckpt_file ckpts/F5TTS_v1_Base/model_1250000.safetensors
Multi-voice generation uses a .toml file with named [voices.<name>] sections and [name] markers in the text; the repo ships a worked example at src/f5_tts/infer/examples/multi/story.toml.
Python API
This is the class as it exists in src/f5_tts/api.py today. Note the argument is ref_file, not ref_audio, and infer() returns the waveform, sample rate and spectrogram:
from f5_tts.api import F5TTS
f5tts = F5TTS(model="F5TTS_v1_Base") # also: ckpt_file="", vocab_file="", device=None (auto: cuda > xpu > mps > cpu)
wav, sr, spec = f5tts.infer(
ref_file="reference.wav",
ref_text="Transcript of the reference clip.",
gen_text="New text to generate in that voice.",
nfe_step=32, # denoising steps
cfg_strength=2, # classifier-free guidance
speed=1.0,
cross_fade_duration=0.15,
remove_silence=False,
file_wave="output.wav", # optional: write the WAV for you
seed=None, # None picks a random seed; f5tts.seed holds the one used
)
There is no streaming generator on this class. If you want progressive playback, split the text into sentences yourself, call infer() per sentence and play each result as it returns — which is what the CLI's chunking does internally.
Gradio Web UI
# 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
The README lists what the app supports: basic TTS with chunk inference, multi-style / multi-speaker generation, a voice chat mode powered by Qwen2.5-3B-Instruct, and custom inference with the community language checkpoints. Models load from Hugging Face on first use; the ASR model is only loaded if you leave the transcript empty, and the LLM only if you open voice chat.
Docker
The README publishes an image on GitHub Container Registry, tagged main:
# 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
The named volume keeps the downloaded checkpoints between runs. A docker-compose example for NVIDIA is in the README, and if --gpus=all fails, our Docker GPU not detected page covers the container-toolkit fix.
Other Languages: Community Checkpoints
The official checkpoints are Chinese and English only. Other languages come from community fine-tunes listed in the repo's SHARED.md. As of this check it lists Arabic (SILMA AI, Apache-2.0), Finnish, French, German, Hindi (SPRINGLab, CC-BY-4.0), Italian, Japanese, Latvian (CC0), Russian and Spanish (CC0); most of the rest carry the same CC-BY-NC as the base model. There is no model named F5TTS_v1_japanese — each card gives a Hugging Face checkpoint, a vocab file and the architecture config, and you load them with the generic flags. For example, the Japanese card (Jmica) points at:
# From SHARED.md — Japanese, F5-TTS Base architecture
# Model: hf://Jmica/F5TTS/JA_21999120/model_21999120.pt
# Vocab: hf://Jmica/F5TTS/JA_21999120/vocab_japanese.txt
f5-tts_infer-cli --model F5TTS_Base \
--ckpt_file hf://Jmica/F5TTS/JA_21999120/model_21999120.pt \
--vocab_file ./vocab_japanese.txt \
--ref_audio japanese_speaker.wav --ref_text "..." --gen_text "..."
Pick --model to match the architecture on the card (the Base-config community models use F5TTS_Base), and download the vocab file locally first. Cross-lingual cloning — an English reference speaking Japanese — is not something the docs promise; use a same-language reference when you can.
ComfyUI Node
The maintained node pack is niknah/ComfyUI-F5-TTS (MIT, still receiving commits as of August 2026). Install it through ComfyUI Manager or clone it into custom_nodes/; it wraps the same checkpoints, so the reference-audio rules above still apply. If the node fails to load after install, the usual causes are covered in ComfyUI import failed.
For an OpenAI-compatible /v1/audio/speech endpoint in front of a local model, the pattern in our local TTS API server guide applies equally well to the F5-TTS Python API above.
Fine-Tuning
The repo ships a Gradio fine-tuning app and Accelerate-based training scripts:
# Quick start with Gradio web interface
f5-tts_finetune-gradio
Detailed guidance lives in src/f5_tts/train in the repo. The README gives no wall-clock estimates, and neither do we; if a community checkpoint for your language already exists in SHARED.md, it is almost always the shorter path.
F5-TTS vs XTTS v2, Chatterbox, Kokoro and Others
Licence is the column that decides most real projects, so it is the one we verified for each project:
| Model | Voice cloning | Weights licence (verified) | Read next |
|---|---|---|---|
| F5-TTS | Zero-shot from a short reference | CC-BY-NC-4.0 (non-commercial); code MIT | This page |
| XTTS v2 (Coqui) | Zero-shot, 17 languages | Coqui Public Model License (non-commercial); code MPL-2.0 | XTTS v2 / Coqui TTS |
| Chatterbox (Resemble AI) | Zero-shot | MIT | Chatterbox setup guide |
| Kokoro-82M | No (preset voices) | Apache-2.0 | Kokoro local setup |
| OpenVoice (MyShell) | Tone-colour cloning | MIT (repo) | OpenVoice v2 guide |
| Spark-TTS | Zero-shot | Code Apache-2.0; Spark-TTS-0.5B weights CC-BY-NC-SA-4.0 | — |
If you need to ship a product, Chatterbox and Kokoro are the two on this list whose weights allow it. If you are cloning for personal or research use and want the widest language coverage, XTTS v2 still has 17 languages built in. The full field, ranked, is in our best local TTS models roundup, and the emotion-first option is covered in the Orpheus TTS setup guide.
Licence and Ethics
Licence, precisely: the F5-TTS code is MIT. The pretrained checkpoints (F5TTS_v1_Base, F5TTS_Base, E2TTS_Base) are CC-BY-NC-4.0 — the Hugging Face model card carries license: cc-by-nc-4.0 and the README explains it is "due to the training data Emilia". CC-BY-NC does not permit commercial use, and the project does not advertise a paid commercial licence; if you need one, the route is training your own weights on data you are allowed to use commercially, or picking an MIT/Apache model from the table above.
Voice cloning is dual-use. Practices that hold regardless of licence:
- Consent — only clone voices with explicit permission
- Disclosure — label synthetic audio where listeners could reasonably be misled
- Logging — keep an audit trail of who generated what
- Refusals — block cloning of public figures and of living people who have not consented
- Local law — synthetic-media rules differ by jurisdiction; check yours before deploying
Troubleshooting
| Symptom | Cause (from the docs / issues) | Fix |
|---|---|---|
HIP error: invalid device function on Radeon 8050S/8060S or RX 9060/9070 | ROCm 6.x PyTorch on RDNA 3.5 / RDNA 4 | Install the rocm7.2 PyTorch build (README, issue #1236) |
| Word cut off at the start of the output | Reference clip has no trailing silence, or is over ~12 s and was clipped | Trim to under 12 s and leave ~1 s of silence at the end |
| Acronyms read letter by letter, or names spelled out | Uppercase letters are uttered letter by letter | Write ordinary words in lowercase; keep "K.F.C." style only for acronyms |
| Long text stops early | 30 s cap per generation | Use the CLI / Gradio app, which chunk automatically, or split the text yourself |
| Higher GPU memory than expected | --ref_text "" loads the ASR model | Provide the transcript |
--vocoder_name bigvgan errors | BigVGAN is only supported with F5TTS_Base | Use --model F5TTS_Base, or stay on Vocos with F5TTS_v1_Base |
| Wrong pronunciation in another language | Base weights are Chinese + English | Load a SHARED.md community checkpoint for the language |
FAQ
Is F5-TTS free for commercial use? The code is MIT, but the pretrained weights are CC-BY-NC-4.0, so no — not with the official checkpoints. Chatterbox (MIT) and Kokoro (Apache-2.0) are the commercial-safe alternatives in the comparison table.
Which model name should I use? F5TTS_v1_Base is the default in both the CLI and the Python API. F5TTS_Base is the older checkpoint and the only one that works with the BigVGAN vocoder; E2TTS_Base is the E2 TTS reproduction.
How long should the reference audio be? Under 12 seconds with about a second of silence at the end, per the inference README. Longer clips are clipped to ~12 s automatically.
Does it run on a Mac? Yes: install the stable torch torchaudio, and the API selects mps automatically. The README does not publish Apple speed figures.
Does it stream? Not from the Python API; the CLI and Gradio app chunk long text and generate chunk by chunk, which you can replicate in your own code.
Where does it download the model? From SWivid/F5-TTS on Hugging Face into ~/.cache/huggingface/hub on first run; the Docker command mounts a volume there so you only download once.
Sources (all fetched September 22, 2026): SWivid/F5-TTS README | Inference README | SHARED.md community checkpoints | api.py | Hugging Face SWivid/F5-TTS | F5-TTS paper | ComfyUI-F5-TTS
Related guides:
Voice working locally? Build the whole pipeline.
Whisper, TTS, and voice cloning wired into real projects — hands-on courses. First chapter free, no card.
Replace the speech-AI subscription
Local Speech Studio covers TTS, voice cloning and transcription end to end — including which licences actually let you sell what you make.
Liked this? 25 full AI courses are waiting.
From fundamentals to RAG, agents, MCP servers, voice AI, and production deployment with real GitHub repos. First chapter free, every course.
Build Real AI on Your Machine
RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.
Want the structured version?
Hands-on courses on local AI, from $8.99 a month. The first chapter of each is free.
Keep going
- PILLARmodels/coqui-tts
- audio.cpp: Local TTS and Speech-to-Text, No Python
- Best Local Speech-to-Text Models: 4 Tested on One File
- Best Local TTS Models 2026: 8 Open-Source Voices Tested
- Best Local TTS on Windows: No Python, No WSL
- Best Local TTS Without a GPU: Real-Time on CPU
- Build a $10K/Month AI Podcast: Whisper + Bark + Coqui TTS
- Build a Local Voice Assistant: Whisper + Ollama + Piper
- Chatterbox TTS Setup: Free ElevenLabs Killer (MIT, 2026)
- Coqui TTS Python Guide: pip install + XTTS API Examples
Comments (0)
No comments yet. Be the first to share your thoughts!
