TTS_10M / README.md
ViuAI's picture
Update Murli V1.0 report, HF export script, Gradio UI, and README
4637e15 verified
|
Raw History Blame Contribute Delete
5.25 kB
# πŸŽ™οΈ Murli V1.0 β€” 10M Hindi TTS Engine (`ViuAI/Murli-V1.0`)
**Murli V1.0** (`TTS_10M`) combines a RoPE text encoder, a duration predictor with Monotonic Alignment Search (MAS), a conditional flow-matching (OT-CFM) acoustic model, and the separately loaded Vocos 24 kHz vocoder. Trained for 500 total epochs on 49.28h of single-speaker Hindi studio speech (`ViuAI/ViuAI_Hindi_TTS_50h`). The default sampler uses 48 midpoint steps with `cfg_scale=1.5`, `temperature=0.667`, `sway=-1.0`, and zero-phase de-buzzing.
## Default parameter counts
```
Text Encoder (RoPE Transformer): 2,765,312 (~2.77M)
Duration Predictor: 395,009 (~0.40M)
Mel Prior Projection: 25,700 (~0.03M)
OT-CFM Vector Field: 4,984,164 (~4.98M)
--------------------------------------------------
TOTAL ACOUSTIC PARAMETERS: 8,170,185 (~8.17M)
Vocos Neural Vocoder: 13,531,650 (~13.53M)
==================================================
COMPLETE END-TO-END SYSTEM: 21,701,835 (~21.70M)
==================================================
```
---
## πŸ“ Project Structure
```
TTS_10M/
β”œβ”€β”€ config.py # Hyperparameters, audio config & model parameters
β”œβ”€β”€ models/
β”‚ β”œβ”€β”€ convnext.py # ConvNeXt-V2 1D blocks with GRN
β”‚ β”œβ”€β”€ text_encoder.py # Modern Transformer with RoPE embeddings
β”‚ β”œβ”€β”€ duration_predictor.py # Monotonic Alignment Search (MAS) & Duration Net
β”‚ β”œβ”€β”€ flow_matching.py # Optimal Transport CFM ODE Solvers (4-10 steps)
β”‚ β”œβ”€β”€ vocoder.py # Vocos 24kHz neural vocoder wrapper
β”‚ └── tts_engine.py # Full unified 10M TTS Engine
β”œβ”€β”€ data/
β”‚ β”œβ”€β”€ audio_processor.py # 24kHz Mel-Spectrogram extractor & normalizer
β”‚ β”œβ”€β”€ text_cleaner.py # Universal multilingual & Hindi/English tokenizer
β”‚ β”œβ”€β”€ dataset.py # PyTorch Dataset & dynamic batch collator
β”‚ └── hf_dataset_sync.py # 1-Click push dataset to Hugging Face Hub
β”œβ”€β”€ utils/
β”‚ β”œβ”€β”€ audio_sanity.py # Anti-Beep & NaN Quality Guardian
β”‚ └── checkpoint.py # Safetensors save/load & HF Hub integration
β”œβ”€β”€ train.py # Training pipeline with AdamW, AMP, & Anti-Beep guards
β”œβ”€β”€ infer.py # CLI synthesis script (prints latency & RTF metrics)
β”œβ”€β”€ export_hf.py # 1-Click export & push model to Hugging Face Model Hub
β”œβ”€β”€ app.py # Interactive Gradio Web UI / Hugging Face Spaces app
└── requirements.txt # Minimal & modern dependencies
```
---
## πŸš€ Step-by-Step Workflow
### Step 1: Prepare & Push Dataset to Hugging Face
Audio files ko `dataset/wavs/` me rakhein aur transcript file `dataset/metadata.csv` me:
```csv
wavs/audio_001.wav|Namaste, yeh pehla sentence hai.
wavs/audio_002.wav|Aaj mausam bohot accha hai.
```
Apne dataset ko direct Hugging Face Datasets par push karne ke liye:
```bash
python data/hf_dataset_sync.py --data_dir dataset --metadata dataset/metadata.csv --repo_id ViuAI/ViuAI_TTS_Dataset
```
---
### Step 2: Model Training
Aap local metadata se ya direct Hugging Face Dataset se train kar sakte hain:
**Option A: Direct Hugging Face Dataset se train karein:**
```bash
python train.py --hf_dataset ViuAI/ViuAI_TTS_Dataset --language hi --speaker indic_hi_male_1 --epochs 100 --batch_size 16
```
**Option B: Local metadata.csv se train karein:**
```bash
python train.py --metadata dataset/metadata.csv --epochs 100 --batch_size 16 --lr 2e-4
```
* Audio previews run at the evaluation interval and report numerical and spectral checks.
* Har evaluation par available Vocos ke saath sample audio automatic `checkpoints/samples/` folder me generate hogi.
---
Mid-epoch resume uses the weights and their companion trainer state. Keep the same data and batch size. For older weights without a verifiable trainer state, use the weights-only warm start.
```bash
python train.py --metadata dataset/metadata.csv --resume checkpoints/model.safetensors
python train.py --metadata dataset/metadata.csv --init_from checkpoints/model_best.safetensors
```
### Step 3: Fast Inference
Inference chalane ke liye:
```bash
python infer.py --text "Namaste! Yeh hamara 10M modern TTS model bol raha hai." --checkpoint checkpoints/model.safetensors --steps 8
```
Output `output.wav` me 24,000 Hz PCM WAV me save ho jayega.
---
### Step 4: Push Model to Hugging Face Model Hub
Apne trained model weights aur official Model Card ko 1 click me Hugging Face par publish karein:
```bash
python export_hf.py --checkpoint checkpoints/model.safetensors --repo_id ViuAI/TTS-10M-Modern
```
---
### Step 5: Interactive Web UI (Gradio / HF Spaces)
Browser me interactive demo chalane ke liye:
```bash
python app.py
```
The CLI and web app look for trained weights under checkpoints/ or model.safetensors in the current directory. The CLI also accepts an explicit diagnostic mode with --allow-random-weights.
Yeh demo direct **Hugging Face Spaces** par bina kisi code change ke deploy kiya ja sakta hai!