Download code/docs/FINE_TUNING.md from oProfM/LuaNovaV1: direct link, hf CLI and curl.
- Browser
- Download file 5.42 kB
-
https://huggingface.co/oProfM/LuaNovaV1/resolve/main/code/docs/FINE_TUNING.md
- Command line
-
hf download hf://oProfM/LuaNovaV1/code/docs/FINE_TUNING.md
-
curl -L -o FINE_TUNING.md https://huggingface.co/oProfM/LuaNovaV1/resolve/main/code/docs/FINE_TUNING.md
Fine-Tuning Guide (New PT-BR Speaker or Domain)
Because Lua Nova V1 predicts spectrograms in BigVGAN's universal 24 kHz 100-band Slaney log-mel space, adapting to a new Brazilian Portuguese speaker or speaking style is fast and does not require training a vocoder from scratch.
Requirements
- GPU: NVIDIA GPU with
6–8 GBVRAM (CFMtraining uses< 3.5 GB; optionalOption Bvocoder adaptation onBigVGAN-baseuses~6.8 GB). - Audio Data:
- Minimum:
30–60 minutesof clean24 kHzmono speech (single speaker, quiet studio or denoised). - Recommended:
2–4 hoursfor maximum voice likeness and prosody stability.
- Minimum:
- Estimated Time (RTX 4070 class GPU):
- Data preparation + CTC alignment:
~3–6 minfor 1h of audio - Acoustic CFM adaptation (
10k–15ksteps):~15–22 min - (Optional) Gentle BigVGAN-base Option B polish (
1k–2ksteps):~8–15 min
- Data preparation + CTC alignment:
1. Prepare Your Dataset Manifest
Create two manifests (train.jsonl and validation.jsonl) with no overlapping text or IDs between splits. Paths in audio are resolved relative to the JSONL file:
{"id": "utt_0001", "text": "Olá, esta é uma frase de teste em português.", "voice_id": "F1", "audio": "wavs/utt_0001.wav"}
Resample all WAVs explicitly to 24,000 Hz mono PCM beforehand (
ffmpeg -i in.wav -ar 24000 -ac 1 out.wav). Keep peak amplitude $\le 1.0$.
Speaker ID tip: For single-speaker fine-tuning starting from our pretrained checkpoint, keeping
"voice_id": "F1"reuses existing speaker embeddings directly without resizing model parameters.
2. Extract Acoustic Features & Forced Alignments
# Step A: Acoustic feature extraction (wave, 80-mel, F0 pitch via Parselmouth, RMS energy)
uv run lua-nova-prepare --inputs data/raw/train.jsonl --split train --output data/features
uv run lua-nova-prepare --inputs data/raw/validation.jsonl --split validation --output data/features
# Step B: Forced alignment via pretrained wav2vec2 CTC espeak recognizer
uv run lua-nova-annotate \
--features data/features \
--output data/annotations \
--dataset-revision my-voice-v1 \
--device cuda \
--refine 2 --stage refined-2
Both steps are resumable via
--resume. Alignments check phoneme rate, vowel voicing, and silence pauses automatically, writing rejected outliers torejected.jsonl.
3. Fine-Tune LuaNovaCFM v5 on Your Voice
Start directly from the pretrained cfm_v5_soup50.pt checkpoint downloaded from Hugging Face:
uv run lua-nova-train-cfm \
--train data/annotations/train.jsonl \
--validation data/annotations/validation.jsonl \
--init-cfm checkpoints/cfm_v5_soup50.pt \
--no-freeze-frontend \
--output runs/my_voice_cfm \
--steps 12000 \
--lr 1.5e-4 --min-lr 1e-5 --warmup 300 \
--save-every 3000 --val-every 500 \
--device cuda
- Use
--no-freeze-frontendwhen adapting timbre plus speaking cadence/pitch range to a brand-new speaker. - Use
--freeze-frontendif your voice has very few minutes (< 45 min) or matches existing speaking cadence closely and only needs acoustic timbre tuning.
(Optional) If your voice expresses notably different intonation patterns (questions, pauses, stress shifts), run a short ProsodyFlow stage first before lua-nova-train-cfm:
uv run lua-nova-train-prosody \
--train data/annotations/train.jsonl \
--validation data/annotations/validation.jsonl \
--init-cfm checkpoints/cfm_v5_soup50.pt \
--output runs/my_voice_prosody \
--steps 4000 --eval-every 1000 --save-every 2000 --device cuda
4. (Optional) Option A + Option B Final Polish
Once runs/my_voice_cfm/inference_v5_ema.pt converges, you can optionally remove subtle acoustic-vocoder mismatch:
- Option A (E2E through frozen BigVGAN + frozen NVIDIA MIT discriminators):
uv run lua-nova-train-e2e \
--train data/annotations/train.jsonl \
--validation data/annotations/validation.jsonl \
--init-v5 runs/my_voice_cfm/inference_v5_ema.pt \
--output runs/my_voice_optA \
--steps 1500 --save-steps 1000 1500 --device cuda
And create a 50/50 weight soup in Python:
from lua_nova_v1.utils import soup_checkpoints
soup_checkpoints(
"runs/my_voice_cfm/inference_v5_ema.pt",
"runs/my_voice_optA/inference_v5_e2e_step-001500.pt",
"runs/my_voice_optA/inference_v5_soup50.pt",
alpha=0.5,
)
- Option B (Gentle
BigVGAN-baseFT with NVIDIA 5M-step pretrained discriminators):
uv run lua-nova-train-vocoder \
--train data/annotations/train.jsonl \
--validation data/annotations/validation.jsonl \
--cfm-ckpt runs/my_voice_optA/inference_v5_soup50.pt \
--model-id nvidia/bigvgan_base_24khz_100band \
--pretrained-disc --disc-warmup 0 \
--output runs/my_voice_vocoder_optB \
--steps 2000 --save-steps 1000 1500 2000 \
--batch-size 6 --grad-accum 2 --lr-g 1e-5 --lr-d 1e-5 --device cuda
5. Run Inference on Your New Voice
uv run lua-nova-speak \
--text "Minha nova voz em português está pronta para falar!" \
--out test_voice.wav \
--cfm runs/my_voice_optA/inference_v5_soup50.pt \
--vocoder runs/my_voice_vocoder_optB/bigvgan_ft_step-002000.pt \
--device cpu