humair025 commited on
Commit
8c73df3
Β·
verified Β·
1 Parent(s): 338c896

Upload Urdu fine-tuning config with hf_pipeline block

Browse files
Files changed (1) hide show
  1. configs/config_urdu_ft.yml +197 -0
configs/config_urdu_ft.yml ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===========================================================================
2
+ # kikiri-tts β€” Urdu Fine-Tuning Config (Kokoro-82M via patched StyleTTS2)
3
+ # ===========================================================================
4
+ #
5
+ # This config adapts configs/config_german_ft.yml for Urdu fine-tuning on
6
+ # the humair025/koku dataset, AND wires in the FlowTTS-style HF pipeline
7
+ # (kikiri_pipeline package) via the top-level hf_pipeline block.
8
+ #
9
+ # Top-level keys (batch_size, epochs_1st, save_freq, pretrained_model, etc.)
10
+ # are read by StyleTTS2/train_first.py + train_second.py β€” they MUST be at
11
+ # the top level (not nested under 'training:'). See docs/TRAINING_GUIDE.md
12
+ # for why this matters.
13
+ # ===========================================================================
14
+
15
+ # ── Top-level training params (read by StyleTTS2) ──────────────────────────
16
+ batch_size: 8
17
+ epochs_1st: 10 # Stage 1 epochs (acoustic reconstruction)
18
+ epochs_2nd: 10 # Stage 2 epochs (prosody + adversarial)
19
+ save_freq: 1 # save every N epochs
20
+ pretrained_model: "../training/kokoro_base.pth"
21
+ first_stage_path: "first_stage.pth"
22
+ load_only_params: true
23
+ second_stage_load_pretrained: false # false = load from first_stage.pth (recommended)
24
+
25
+ # ── Logging ────────────────────────────────────────────────────────────────
26
+ log_dir: "logs/kokoro-urdu"
27
+
28
+ # ── Data ───────────────────────────────────────────────────────────────────
29
+ # These paths are relative to StyleTTS2/ (the cwd when running train_first.py)
30
+ data_params:
31
+ train_data: "../training/train_list.txt"
32
+ val_data: "../training/val_list.txt"
33
+ root_path: "../training/audio" # parent dir of the WAVs
34
+ OOD_data: "../training/OOD_texts.txt"
35
+ min_length: 5 # min phoneme string length (chars)
36
+ num_workers: 8
37
+
38
+ # ── Preprocessing (Kokoro/StyleTTS2 fixed β€” do NOT change) ─────────────────
39
+ preprocess_params:
40
+ sr: 24000 # Kokoro = 24 kHz mono
41
+ spect_params:
42
+ n_fft: 2048
43
+ win_length: 1200
44
+ hop_length: 300
45
+ n_mels: 80
46
+ fmin: 0
47
+ fmax: 8000
48
+
49
+ # ── Model architecture (must match Kokoro-82M exactly) ─────────────────────
50
+ model_params:
51
+ dim_in: 64
52
+ n_token: 178 # Kokoro vocab size (IPA + punct)
53
+ hidden_dim: 512
54
+ style_dim: 128 # voicepack = 2 * style_dim
55
+ max_dur: 50
56
+ multispeaker: false # Urdu single-speaker fine-tune
57
+ n_mels: 80
58
+ dropout: 0.2
59
+ n_layer: 3
60
+ text_encoder_kernel_size: 5
61
+
62
+ decoder:
63
+ type: istftnet # Kokoro uses ISTFTNet, NOT hifigan
64
+ upsample_rates: [10, 6]
65
+ upsample_kernel_sizes: [20, 12]
66
+ upsample_initial_channel: 512
67
+ resblock_kernel_sizes: [3, 7, 11]
68
+ resblock_dilation_sizes: [[1, 3, 5], [1, 3, 5], [1, 3, 5]]
69
+ gen_istft_n_fft: 20
70
+ gen_istft_hop_size: 5
71
+
72
+ diffusion: # kept for compat β€” disabled via diff_epoch=999
73
+ embedding_mask_proba: 0.1
74
+ transformer:
75
+ num_layers: 3
76
+ num_heads: 8
77
+ head_features: 64
78
+ multiplier: 2
79
+ dist:
80
+ sigma_data: 0.2
81
+ estimate_sigma_data: true
82
+ mean: -3.0
83
+ std: 1.0
84
+
85
+ plbert:
86
+ hidden_size: 768
87
+ num_attention_heads: 12
88
+ intermediate_size: 2048
89
+ max_position_embeddings: 512
90
+ num_hidden_layers: 12
91
+ dropout: 0.1
92
+
93
+ slm:
94
+ model: "microsoft/wavlm-base-plus"
95
+ sr: 16000 # WavLM operates at 16 kHz
96
+ hidden: 768
97
+ nlayers: 13
98
+ initial_channel: 64
99
+
100
+ # ── Loss weights ───────────────────────────────────────────────────────────
101
+ loss_params:
102
+ lambda_gen: 1.0
103
+ lambda_mel: 5.0
104
+ lambda_dur: 1.0
105
+ lambda_ce: 20.0
106
+ lambda_F0: 1.0
107
+ lambda_norm: 1.0
108
+ lambda_s2s: 1.0
109
+ lambda_mono: 1.0
110
+ lambda_slm: 1.0 # SLM adversarial (Stage 2)
111
+ lambda_diff: 0.0 # no diffusion
112
+ lambda_sty: 0.0
113
+ TMA_epoch: 0 # start alignment from epoch 0
114
+ diff_epoch: 999 # disable diffusion
115
+ joint_epoch: 3 # start GAN + SLM at epoch 3
116
+
117
+ # ── Optimizer ──────────────────────────────────────────────────────────────
118
+ optimizer_params:
119
+ lr: 0.0001
120
+ bert_lr: 0.00001 # lower LR for PLBERT
121
+ ft_lr: 0.0001
122
+
123
+ # ── Utility models (StyleTTS2 expects these in Utils/) ──────────────────────
124
+ F0_path: "Utils/JDC/bst.t7"
125
+ ASR_config: "Utils/ASR/config.yml"
126
+ ASR_path: "Utils/ASR/epoch_00080.pth"
127
+ PLBERT_dir: "Utils/PLBERT/"
128
+
129
+ slmadv_params:
130
+ min_len: 100
131
+ max_len: 500
132
+ batch_percentage: 0.5
133
+ iter: 10
134
+ thresh: 5
135
+ scale: 0.01
136
+ sig: 1.5
137
+
138
+
139
+ # ===========================================================================
140
+ # FlowTTS-style HF pipeline block (read by kikiri_pipeline package)
141
+ # ===========================================================================
142
+ # This is the new section that integrates the FlowTTS pipeline:
143
+ # - HF dataset loading (humair025/koku) with audio decode + 24 kHz resample
144
+ # - urdu_g2p + KokoroTokenizer.encode for phoneme -> token ID
145
+ # - HF Hub push of checkpoints + losses + TensorBoard logs
146
+ # - Resume from local path / HF Hub / 'auto'
147
+ #
148
+ # All keys here are OPTIONAL β€” the kikiri_pipeline package provides strong
149
+ # defaults. Override any of them via CLI flags:
150
+ # --hf_repo humair025/kikiri-urdu-v1
151
+ # --upload_every 500
152
+ # --hf_dry_run
153
+ # ===========================================================================
154
+ hf_pipeline:
155
+ # ---- Dataset ----
156
+ dataset_id: "humair025/koku"
157
+ dataset_split: "train"
158
+ dataset_audio_col: "audio" # HF datasets Audio feature column
159
+ dataset_text_col: "text" # raw transcript column
160
+ dataset_phonemes_col: "phonemes" # PRE-COMPUTED IPA column (already in dataset)
161
+ dataset_voice_col: "voice" # speaker label column
162
+ sample_rate: 24000 # resample target (Kokoro = 24 kHz)
163
+ streaming: true # set false only if you have >10 GB free disk
164
+ val_ratio: 0.05 # 5% validation split
165
+ random_seed: 42
166
+ min_phoneme_len: 5 # filter phoneme strings < 5 chars
167
+ max_phoneme_len: 510 # PLBERT max_position_embeddings - 2
168
+
169
+ # ---- Audio preprocessing ----
170
+ n_fft: 2048
171
+ hop_length: 300
172
+ win_length: 1200
173
+ n_mels: 80
174
+ f_min: 0.0
175
+ f_max: 8000.0
176
+ precompute_mels: true
177
+ precompute_f0: true
178
+
179
+ # ---- HF Hub push ----
180
+ hf_repo: "humair025/kikiri-urdu-v1" # set to null to disable uploads
181
+ hf_token_env: "HF_TOKEN" # env var to read token from
182
+ upload_every: 1 # push ckpt every N epochs (we save per-epoch)
183
+ keep_last_n_local: 2 # prune older local ckpts (hub copies kept)
184
+ upload_tensorboard: true # also push TB logs on a separate cadence
185
+ tb_log_upload_freq: 200 # push TB logs every N steps
186
+ losses_upload_freq: 50 # push losses.json every N steps
187
+ hf_dry_run: false # true = save locally but don't upload
188
+ ckpt_subdir: "checkpoints" # path inside HF repo for .pth files
189
+
190
+ # ---- Resume ----
191
+ resume: null # local path / HF path / 'auto'
192
+
193
+ # ---- Loss log ----
194
+ losses_filename: "losses.json"
195
+
196
+ # ---- Stage tagging (set per-script: stage1 in train_first, stage2 in train_second) ----
197
+ stage_tag: "stage1"