Single-speaker professional narration (Egri Csillagok)
Training Parameters
Parameter
Value
Learning Rate
1e-5
Warmup Steps
500
Batch Size
38,400 frames
Precision
Mixed Precision (BF16)
Optimizer
AdamW
EMA
Yes (used for inference)
Quick Start
python
1import torch
2import torchaudio
3import soundfile as sf
4import numpy as np
56# Monkey-patch torchaudio for cross-platform compatibility7_orig_load = torchaudio.load
8def_patched_load(fp,**kw):9 d, sr = sf.read(str(fp), dtype="float32")10if d.ndim ==1: d = d[np.newaxis,:]11else: d = d.T
12return torch.from_numpy(d), sr
13torchaudio.load = _patched_load
1415from f5_tts.api import F5TTS
1617model = F5TTS(18 model="F5TTS_v1_Base",19 ckpt_file="model_last_final.safetensors",20 vocab_file="vocab.txt",21 device="cuda",22 use_ema=True,23)2425wav, sr, _ = model.infer(26 ref_file="your_reference.wav",27 ref_text="A referencia hang pontos atirata.",28 gen_text="Szia, ez egy teszt mondat a magyar szovegfelolvasashoz.",29)3031sf.write("output.wav", wav, sr)
Critical: Reference Text Must Match Audio
The ref_textmust be the exact transcription of ref_audio. Mismatched text causes garbled output. Use Whisper to transcribe:
python
1from faster_whisper import WhisperModel
2whisper = WhisperModel("large-v3-turbo", device="cuda")3segments, _ = whisper.transcribe("your_reference.wav", language="hu")4ref_text =" ".join(s.text.strip()for s in segments)
Benchmark
Measured on NVIDIA RTX 5060 Ti 16GB, PyTorch 2.x, CUDA, FP16:
Metric
Value
Real-Time Factor (RTF)
~0.25 (10s of audio generated in ~2.5s)
Model Load Time
~4.4s (first load, CUDA)
Warmup Inference
~2.5s (first generation)
Steady-State Latency
~250ms per sentence
Peak VRAM Usage
~2.4 GB (Highly optimized for consumer GPUs)
Min VRAM Recommended
4 GB (FP16)
Reference Audio Guidelines
For optimal voice cloning quality:
Use 5-15 seconds of clean speech (no background noise, no reverb, no music)
Provide an exact transcript — this is the single most important quality factor
Mono WAV, any sample rate (automatically resampled to 24kHz)
Longer references (>15s) do NOT improve quality and increase VRAM usage
End the reference audio with a natural sentence ending, not mid-word
Repository Contents
File
Size
Description
model_last_final.safetensors
~640 MB
FP16 EMA model weights
vocab.txt
<1 KB
67-token Hungarian character vocabulary (required for loading)
config.json
<1 KB
Model architecture and training configuration
inference_example.py
~6 KB
Complete inference script with Whisper transcription + artifact trimming
hungarian_preprocessing.py
~3 KB
Text normalizer (numbers, symbols, acronyms to spoken Hungarian)
samples/
—
20 reference + 20 cloned audio pairs for evaluation
Known Issues & Workarounds
Onset Artifact (First-Word Distortion)
The model occasionally produces a brief garbled sound (~200-400ms) at the very beginning of generated audio. This is a known characteristic of the F5-TTS DiT architecture — the hard mel-spectrogram boundary between reference and generated speech does not always align with the acoustic boundary.
Workarounds (in order of effectiveness):
Prefix trick — Prepend a short filler word to gen_text (e.g., "szoval, " + your_text), then trim the first ~400ms from the output
Silence padding — Add 500-700ms of silence to the end of your reference audio before inference
VAD-based trimming — Use Silero VAD to detect actual speech onset and trim everything before it
Regeneration — Different random seeds produce different alignment; retry 2-3 times if needed
The included inference_example.py implements an energy-based adaptive trimmer. Community contributions for better solutions are welcome!
Duration Estimation
Very short texts (<5 characters) may produce stretched or compressed audio. The model estimates duration from the ref_text/gen_text character ratio — extremely short inputs can break this heuristic. Workaround: pad short texts with natural filler.
Roadmap
Improved onset artifact elimination (Silero VAD + soft mel crossfade)
Streaming inference support (sentence-level chunking)
Extended vocabulary with English code-switching support
INT8 quantized variant for lower VRAM (<4GB)
Community & Contributions
The model weights are released under CC-BY-NC-4.0 (following the base F5-TTS license). The inference code, preprocessing scripts, and tooling are open for contributions!
Training high-quality TTS models on H100 GPUs is expensive. If this model is useful to you, consider buying me a coffee — it directly funds compute time for future improvements!