TTS_10M / LESSONS_LEARNED_V1.md
ViuAI's picture
Update Murli V1.0 report, HF export script, Gradio UI, and README
4637e15 verified
|
Raw History Blame Contribute Delete
10.4 kB

Murli V1.0 — Final Release Report & Post-Mortem (ViuAI/Murli-V1.0 / ViuAI/TTS_10M)

Release Name: Murli V1.0 (ViuAI/Murli-V1.0) Architecture: 8.17M Trainable Acoustic OT-CFM + 13.53M Vocos 24kHz (21.70M combined) Dataset: ViuAI/ViuAI_Hindi_TTS_50h (24,019 clips / 49.28h syspin_male_01, 22 Parquet shards) Purpose: Complete engineering record of every bug, bottleneck, data limitation, and final QA result from Murli V1.0 — so Murli V2.0 avoids all of these pitfalls from Day 1.


0. Final Murli V1.0 Release Benchmark (500 Total Epochs)

After fixing the dataset Parquet packaging (unlocking all 24,019 clips vs 9,984), applying --dur_weight 1.5 --prior_weight 0.5, adding Anusvara normalization (ईंधन → ईन्धन), min_frames=2, speed=0.92, and zero-phase debuzz_waveform, the 6:30 minute (~950-word) Hindi Story QA Benchmark showed a 3x error reduction:

Metric Initial 300-Ep V1 (download (4).wav) Final Murli V1.0 (500 Ep + Fixes) Target for Murli V2.0
Total Word Errors (~900 words) 31 Errors (~3.6% WER) 9 Minor Errors (`1.0% WER`) < 0.3% WER
Acoustic Noise & Buzz Clean, light metallic buzz Warm, deep, clean (buzz eliminated) Studio expressive
Hard Words Fixed Failed (दौलत, महिलाएं, खिचड़ी, काढ़ा, सहारा, खिलखिलाहट, इकट्ठा, तराशने, ईंधन) All 14+ hard words fixed! 100% consistency
Remaining Known Errors (Logged for V2) — बढ़ई→बड़ी, occasional लकड़ी→कड़ी/लड़ी, occasional राघव→रागो/राव/राग, मीठी हंसी→मीठिंसी, clause-start रखे→खे / अपनी→नी, मेहनत→मेहत, मदद→मद, सम्मान slight slip Fixed via Hindi G2P + Pitch $F_0$
Training Speed (RTX 3090) ~154 clips/s (CPU Mel bottleneck) 250+ clips/s (mel_cache + bucket_batches + numba MAS) Same fast pipeline

1. Dataset & Storage Issues

Issue Observed in V1 Root Cause Mandatory Rule for V2
59% Dataset Silently Missing (9,984 WAVs vs 24,019 rows) Hugging Face limits a single directory to 10,000 files. Uploading loose WAVs into audio/syspin_male_01/ silently truncated the dataset at 9,984 clips (20h instead of 49.28h). Always package datasets as Parquet shards (data/train-*.parquet, ~400MB/shard). Avoid loose .wav folder uploads on HF.
46-Minute Sequential HF Download datasets.load_dataset() on thousands of loose .wav files downloaded sequentially at ~3.5 files/s. Parquet shards + snapshot_download(..., max_workers=16) reduces Vast.ai dataset download to 1–2 minutes.
datasets Streaming Hang (kalita11/Hindi-TTS-corpus) load_dataset(..., streaming=True) stalled/hung while initializing large remote Parquet streams and triggered torchcodec/decoder crashes on skipped speakers. Stream via pyarrow.parquet.ParquetFile.iter_batches + Audio(decode=False), filter speaker_id before decoding audio, and decode bytes directly.
Flat Newsroom Tone & Weak English Loanwords Training data used only syspin_male_01 (read-speech studio corpus, pure Devanagari, zero English words or conversational emotion). Mix syspin_male_01 (clean clarity) + rasa_male_01 (~14.8h expressive storytelling) + Hinglish/English-in-Devanagari samples with speaker/style conditioning.
Audio Format Edge Cases & Manifest Drift Some cached .wav files held FLAC (fLaC) payloads; stereo downmix and column-order assumptions broke manifests. Validate container signatures before decoding and parse manifests strictly by column header name.

2. Tokenizer & Hindi Pronunciation Errors (3.6% WER on 850-Word Story)

From the word-by-word QA audit on download (4).wav (31 errors in ~850 words):

Failure Pattern Real Examples Observed Root Cause in V1 Mandatory Fix for V2
Word-Medial Anusvara (ं) Failure ईंधन → कीनन Raw Devanagari char tokenizer feeds ई + ं + ध + न; ईं is rare so model fails to infer /n/. Full Hindi G2P / Phonemizer resolving ं contextually (ईंधन → /iːndʰən/, कंबल → /kəmbəl/).
Retroflex & Aspirate Loss (ड़, ढ़) बढ़ई → बड़ी, ओढ़ा → ओड़ा, काढ़ा → काड़ा, खिचड़ी → खिचली Raw character encoder under-represents ड़/ढ़ aspiration transitions. Explicit retroflex & aspirated phoneme tokens in G2P + balanced retroflex coverage in training data.
Schwa Over-Deletion & Boundary Merging दवाई → द्वाई, हो सके → होस्के, सा लकड़ी → सालकड़ी Model had to guess Hindi implicit schwa (अ) rules inside a small 4-layer char encoder. Rule-based Hindi G2P schwa retention/deletion before tokenization + explicit word-boundary/pause tokens.
Proper Noun Drift राघव rendered 5 ways (राघव, रागो, रगौ, राभो, रा) Unstable duration + character-level ambiguity on less frequent names. Phoneme-level representation eliminates spelling ambiguity on proper nouns.
Reduplicated Syllable Collapse खटखटाया → खटटाया, खिलखिलाहट → खिखिलाहट Character attention/MAS merges repeated character bigrams when durations shrink. Phoneme tokenization + stronger duration/MAS alignment weights.

3. Alignment, Duration & Acoustic Architecture Issues

Issue Observed in V1 Technical Cause Fix Applied / Rule for V2
Syllable Dropping & Edge Truncation (लकड़ी → कड़ी, रखे → खे, महिलाएं → मिलाएं, सहारा → सारा, दौलत → दौल, कार्यशाला → कार्यशाल) At 24kHz / 256 hop (~10.67 ms/frame), clamp(min=1) allowed short letters to collapse to 10ms, and Prior Loss ~1.04 caused MAS edge drift. V1 Patch: min_frames=2, edge space tokens, speed=0.92, --dur_weight 1.5 --prior_weight 0.5.
V2 Rule: Stronger prior projection (Conv1D net instead of single nn.Linear) + higher duration loss weight from Epoch 1.
Flat Storytelling Prosody (5.0/10) No explicit Pitch ($F_0$) or Energy predictor; MSE Flow Matching regresses pitch toward the dataset mean. V2 Must-Have: Add explicit F0 Pitch & Energy Predictor conditioned into the CFM decoder.
Light Metallic Vocoder Buzz 8.17M acoustic backbone (256 dim, 8 ConvNeXt blocks) plateaued at CFM Loss ~0.52–0.55, smoothing high frequencies which Vocos rendered as a faint buzz. V1 Patch: Zero-phase 8.5kHz high-freq softening blend (debuzz_waveform).
V2 Rule: Scale acoustic backbone to ~13–14M (320 dim, 10 ConvNeXt-V2 blocks, 6-layer Text Encoder) to push CFM Loss < 0.35.
Previous 100M Model "Robot Beep" Failure Mel scale mismatch (80 Slaney vs 100 HTK), GAN mode collapse, and NaN gradients. Keep V1's Winning Core: OT-CFM (no GAN discriminator in acoustic stage) + exact Vocos 100-bin HTK mel config (clip=1e-7) + clip_grad_norm_(1.0) + AudioSanityGuardian.
MAS Impossible Alignments & AMP Overflow Clips with T_text > T_mel caused MAS zero-frame assignments; FP16 alignment distances risked overflow. Compute MAS scores & prior denominators strictly in FP32 and reject impossible sequences during dataset curation.

4. Training, Checkpointing & Inference Ops Lessons

  1. Cosine LR & Warm-Start Separation:
    • --resume restores decayed LR (1.5e-6) and optimizer momentum; fine-tuning from a converged checkpoint requires --init_from (weights only + fresh optimizer/LR) and proportional warmup for short runs.
    • Always pair model_best.safetensors with its own model_best.trainer.pt via atomic writes so best and latest states never desync.
  2. Inference Sampling Sweet Spot (Empirically Verified):
    • temperature=1.0 caused faint background hiss; temperature=0.72 / cfg=1.2 softened clarity.
    • Winning V1 Settings: num_steps=48, cfg_scale=1.5, temperature=0.667, sway_sampling_coef=-1.0, min_frames=2, speed=0.92.
  3. Long-Form Story Synthesis:
    • Never pass an 850-word story in one forward pass. Split into clauses (<= 12 words at ।, ?, !, ,), add edge space token IDs after cleaning, use a request-local torch.Generator (never mutate global RNG), apply 12ms fades, and insert 150ms / 350ms / 700ms pauses.
  4. Cloud / Environment Pitfalls:
    • Torchaudio 2.11+ torchcodec error: Always write WAVs via scipy.io.wavfile.write (int16 PCM).
    • Vast.ai Jupyter issues: Use {sys.executable} instead of python / pip, avoid %%bash (buffers live logs), never rm -rf the current working directory, and enable --hf_backup_repo so paid GPU progress is never lost if an instance is stopped early.
    • Regression Suite: Maintain tests/test_regressions.py (python -m unittest discover -s tests -v) and run it before every HF push.

5. V2 Architecture Checklist (Before Starting Next Model)

  • Dataset (ViuAI/ViuAI_Hindi_TTS_v2): Parquet-only shards combining syspin_male_01 (49h) + rasa_male_01 (15h expressive) + Hinglish samples.
  • Frontend: Hindi G2P Phonemizer (schwa rules + anusvara resolution + retroflex/aspirates + English fallback).
  • Acoustic Model (~14M): 6-layer RoPE Text Encoder (320 dim) + Conv1D Prior Net + Duration Predictor + Explicit $F_0$ Pitch & Energy Predictors + 10-block ConvNeXt-V2 OT-CFM (320 dim).
  • Target Metrics: WER < 1.0% on the 850-word story benchmark, Dur Loss < 0.08, CFM Loss < 0.35, expressive prosody >= 8.5/10.