File size: 4,679 Bytes
4689281 a1cd84e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # Murli V2.0 — 78.8M Bilingual (Hindi + English) Zero-Shot DiT TTS
Separate V2 workspace built from the ground up with **2026 TTS architecture** (zero V1 legacy ConvNeXt/char-tokenizer bottlenecks).
## Architecture Summary (`78.80M` Trainable Acoustic + `13.53M` Vocoder = `92.33M` Total)
- **Bilingual Text & IPA Frontend (`data/text_cleaner.py`)**: Unified Hindi + English + Hinglish G2P translating Devanagari (`schwa` deletion, contextual Anusvara assimilation, `ड़/ढ़` retroflex flaps) and English (`g2p_en` + deterministic fallback) into one shared IPA vocabulary (`vocab_size=256`).
- **Text Encoder (`models/text_encoder.py`, `12.50M`)**: 2 local ConvNeXt-V2 blocks + 6-layer RoPE SwiGLU Transformer (`dim=384, heads=6`).
- **Zero-Shot Style Perceiver (`models/style_encoder.py`, `11.12M`)**: 4-layer Perceiver Resampler extracting `16` latent timbre/style tokens + global speaker embedding from any 3–10s Hindi or English reference audio.
- **Prosody & Alignment (`models/prosody_predictor.py`, `7.93M`)**: Strictly FP32 Monotonic Alignment Search (MAS) + style-conditioned Duration, Log-$F_0$ Pitch, and Energy Predictors.
- **OT-CFM Diffusion Transformer (`models/dit_cfm.py`, `47.25M`)**: 8-layer `AdaLN-Zero` DiT (`dim=512, heads=8`) with RoPE Self-Attention, Perceiver Style Cross-Attention, SwiGLU MLP, Sway Sampling (`-1.0`), Midpoint ODE solver, and CFG (`1.8`).
- **Audio & 24kHz Vocoder (`data/audio_processor.py`, `models/vocoder.py`)**: 100-bin HTK Mel + torch autocorrelation $F_0$ + RMS energy, paired with Vocos 24kHz (and optional BigVGAN-v2 24kHz 100-band).
## Collect paired speech for scratch training
Install the project requirements and run the collector on an internet-enabled Kaggle session with a Hugging Face token that can write to your dataset. Supply the token through the Kaggle secret or environment variable named `HF_TOKEN`. Gated upstream sources also require access on that account.
```bash
python -m pip install -r requirements.txt
python kaggle_data_collector.py --hindi_hours 400 --english_hours 650
```
The default destination is `ViuAI/Murli_TTS_Dataset`. For a small independent pilot, use a separate destination and targets such as `--target_repo YOUR_ACCOUNT/murli-pilot --hindi_hours 0.05 --english_hours 0.05`. Existing saved hours count toward each language goal. The final whole clip may exceed a goal by up to 15 seconds. `--only` selects one named subset within the remaining language budget. The optional `--migrate_50h` copies V1 into its separate folder.
The collector prioritizes the configured studio and restored sources, then fills the remaining budget from Hindi IndicVoices and English MLS. It checks script, duration, signal levels and clipping. For restored Hindi it requires SNR of at least 20 dB and, when supplied, a character error rate no higher than 10%. Source-specific overlap checks are heuristic. Inspect representative real clips and compare the spoken words with the transcripts before a full training run.
Each shard contains 24 kHz mono PCM16 WAV, text, language, speaker ID, source, gender and duration. The 350 MiB setting measures buffered WAV payload. At the full 1,050-hour goal, uncompressed PCM alone is about 181 GB. Each commit saves audio, duplicate indexes, and counters together. Restart the same command after a connection or commit error. Legacy shards are indexed once without deleting existing data. Pre-existing duplicates still count toward physical saved hours. The summary lists committed hours, clips, reasons for rejection and shortfalls. An unavailable source or unmet goal produces a nonzero exit status.
## Use the collected data
```bash
python train.py --hf_dataset ViuAI/Murli_TTS_Dataset --partition train
```
The training loader downloads matching shards to local disk and indexes metadata in RAM. It reads audio on demand. The optional train partition reserves roughly 5% of known speaker **IDs** using a deterministic hash. Use `MurliV2Dataset(..., partition="validation")` for those held-out IDs. The fraction of audio hours can differ, particularly in small pilots. Unknown IDs stay in train, and aliases for the same person across publishers can still exist. The default `all` partition preserves access to all rows. The trainer evaluates EMA weights each epoch when the selected data contains held-out speakers. With the all partition, it uses a seeded utterance-level validation split. The --resume switch restores the optimizer and batch position from trainer_state.pt. Legacy checkpoints without a batch cursor resume at the next epoch. Cached features from the earlier frame alignment are recomputed.
|