# =========================================================================== # kikiri-tts — Urdu Fine-Tuning Config (Kokoro-82M via patched StyleTTS2) # =========================================================================== # # This config adapts configs/config_german_ft.yml for Urdu fine-tuning on # the humair025/koku dataset, AND wires in the FlowTTS-style HF pipeline # (kikiri_pipeline package) via the top-level hf_pipeline block. # # Top-level keys (batch_size, epochs_1st, save_freq, pretrained_model, etc.) # are read by StyleTTS2/train_first.py + train_second.py — they MUST be at # the top level (not nested under 'training:'). See docs/TRAINING_GUIDE.md # for why this matters. # =========================================================================== # ── Top-level training params (read by StyleTTS2) ────────────────────────── batch_size: 8 epochs_1st: 10 # Stage 1 epochs (acoustic reconstruction) epochs_2nd: 10 # Stage 2 epochs (prosody + adversarial) save_freq: 1 # save every N epochs pretrained_model: "../training/kokoro_base.pth" first_stage_path: "first_stage.pth" load_only_params: true second_stage_load_pretrained: false # false = load from first_stage.pth (recommended) # ── Logging ──────────────────────────────────────────────────────────────── log_dir: "logs/kokoro-urdu" # ── Data ─────────────────────────────────────────────────────────────────── # These paths are relative to StyleTTS2/ (the cwd when running train_first.py) data_params: train_data: "../training/train_list.txt" val_data: "../training/val_list.txt" root_path: "../training/audio" # parent dir of the WAVs OOD_data: "../training/OOD_texts.txt" min_length: 5 # min phoneme string length (chars) num_workers: 8 # ── Preprocessing (Kokoro/StyleTTS2 fixed — do NOT change) ───────────────── preprocess_params: sr: 24000 # Kokoro = 24 kHz mono spect_params: n_fft: 2048 win_length: 1200 hop_length: 300 n_mels: 80 fmin: 0 fmax: 8000 # ── Model architecture (must match Kokoro-82M exactly) ───────────────────── model_params: dim_in: 64 n_token: 178 # Kokoro vocab size (IPA + punct) hidden_dim: 512 style_dim: 128 # voicepack = 2 * style_dim max_dur: 50 multispeaker: false # Urdu single-speaker fine-tune n_mels: 80 dropout: 0.2 n_layer: 3 text_encoder_kernel_size: 5 decoder: type: istftnet # Kokoro uses ISTFTNet, NOT hifigan upsample_rates: [10, 6] upsample_kernel_sizes: [20, 12] upsample_initial_channel: 512 resblock_kernel_sizes: [3, 7, 11] resblock_dilation_sizes: [[1, 3, 5], [1, 3, 5], [1, 3, 5]] gen_istft_n_fft: 20 gen_istft_hop_size: 5 diffusion: # kept for compat — disabled via diff_epoch=999 embedding_mask_proba: 0.1 transformer: num_layers: 3 num_heads: 8 head_features: 64 multiplier: 2 dist: sigma_data: 0.2 estimate_sigma_data: true mean: -3.0 std: 1.0 plbert: hidden_size: 768 num_attention_heads: 12 intermediate_size: 2048 max_position_embeddings: 512 num_hidden_layers: 12 dropout: 0.1 slm: model: "microsoft/wavlm-base-plus" sr: 16000 # WavLM operates at 16 kHz hidden: 768 nlayers: 13 initial_channel: 64 # ── Loss weights ─────────────────────────────────────────────────────────── loss_params: lambda_gen: 1.0 lambda_mel: 5.0 lambda_dur: 1.0 lambda_ce: 20.0 lambda_F0: 1.0 lambda_norm: 1.0 lambda_s2s: 1.0 lambda_mono: 1.0 lambda_slm: 1.0 # SLM adversarial (Stage 2) lambda_diff: 0.0 # no diffusion lambda_sty: 0.0 TMA_epoch: 0 # start alignment from epoch 0 diff_epoch: 999 # disable diffusion joint_epoch: 3 # start GAN + SLM at epoch 3 # ── Optimizer ────────────────────────────────────────────────────────────── optimizer_params: lr: 0.0001 bert_lr: 0.00001 # lower LR for PLBERT ft_lr: 0.0001 # ── Utility models (StyleTTS2 expects these in Utils/) ────────────────────── F0_path: "Utils/JDC/bst.t7" ASR_config: "Utils/ASR/config.yml" ASR_path: "Utils/ASR/epoch_00080.pth" PLBERT_dir: "Utils/PLBERT/" slmadv_params: min_len: 100 max_len: 500 batch_percentage: 0.5 iter: 10 thresh: 5 scale: 0.01 sig: 1.5 # =========================================================================== # FlowTTS-style HF pipeline block (read by kikiri_pipeline package) # =========================================================================== # This is the new section that integrates the FlowTTS pipeline: # - HF dataset loading (humair025/koku) with audio decode + 24 kHz resample # - urdu_g2p + KokoroTokenizer.encode for phoneme -> token ID # - HF Hub push of checkpoints + losses + TensorBoard logs # - Resume from local path / HF Hub / 'auto' # # All keys here are OPTIONAL — the kikiri_pipeline package provides strong # defaults. Override any of them via CLI flags: # --hf_repo humair025/kikiri-urdu-v1 # --upload_every 500 # --hf_dry_run # =========================================================================== hf_pipeline: # ---- Dataset ---- dataset_id: "humair025/koku" dataset_split: "train" dataset_audio_col: "audio" # HF datasets Audio feature column dataset_text_col: "text" # raw transcript column dataset_phonemes_col: "phonemes" # PRE-COMPUTED IPA column (already in dataset) dataset_voice_col: "voice" # speaker label column sample_rate: 24000 # resample target (Kokoro = 24 kHz) streaming: true # set false only if you have >10 GB free disk val_ratio: 0.05 # 5% validation split random_seed: 42 min_phoneme_len: 5 # filter phoneme strings < 5 chars max_phoneme_len: 510 # PLBERT max_position_embeddings - 2 # ---- Audio preprocessing ---- n_fft: 2048 hop_length: 300 win_length: 1200 n_mels: 80 f_min: 0.0 f_max: 8000.0 precompute_mels: true precompute_f0: true # ---- HF Hub push ---- hf_repo: "humair025/kikiri-urdu-v1" # set to null to disable uploads hf_token_env: "HF_TOKEN" # env var to read token from upload_every: 1 # push ckpt every N epochs (we save per-epoch) keep_last_n_local: 2 # prune older local ckpts (hub copies kept) upload_tensorboard: true # also push TB logs on a separate cadence tb_log_upload_freq: 200 # push TB logs every N steps losses_upload_freq: 50 # push losses.json every N steps hf_dry_run: false # true = save locally but don't upload ckpt_subdir: "checkpoints" # path inside HF repo for .pth files # ---- Resume ---- resume: null # local path / HF path / 'auto' # ---- Loss log ---- losses_filename: "losses.json" # ---- Stage tagging (set per-script: stage1 in train_first, stage2 in train_second) ---- stage_tag: "stage1"