Downloads · 30 days
0
animesh2005/Bharat-Vidya
Bharat-Vidya is a machine learning model from animesh2005. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
End-to-end Text-to-Speech system with voice cloning for English and Gujarati using StyleTTS2 architecture.
Downloads · 30 days
0
Access
Public
Updated Dec 3, 2025
Repo size
132 KB
Likes
0
Public
Click a slice to open those files.
.py137 KB · 37%
From the Hugging Face model README
End-to-end Text-to-Speech system with voice cloning for English and Gujarati using StyleTTS2 architecture.
Components:
# Clone repository
git clone https://github.com/yourusername/styletts2-bilingual.git
cd styletts2-bilingual/styletts2_tts
# Install dependencies
pip install -r requirements.txt
# Install package
pip install -e .
Download the pretrained HiFi-GAN V1 model:
# Option 1: From official repository
wget https://github.com/jik876/hifi-gan/releases/...
# Option 2: From Google Drive
# Download from: https://drive.google.com/uc?id=1-eEYTB5Av9jNql0WGBlRoi-WH2J7bp5Y
# Place in: pretrained/hifigan/
SYSPIN Dataset (IISc SPICOR):
Dataset Structure:
data/
├── english/
│ ├── wav/ # 25,158 WAV files (44.1kHz)
│ └── IISc_SPICORProject_English_Male_Spk001_HC_Transcripts.json
└── gujarati/
├── wav/ # 7,834 WAV files (44.1kHz)
└── IISc_SPICORProject_Gujarati_Male_Spk001_HC_Transcripts.json
# English
python src/preprocessing/prepare_data.py \
--config configs/english_config.yaml
# Gujarati
python src/preprocessing/prepare_data.py \
--config configs/gujarati_config.yaml
What this does:
# English
python src/training/train.py \
--config configs/english_config.yaml
# Gujarati
python src/training/train.py \
--config configs/gujarati_config.yaml
Training Time:
Monitoring:
tensorboard --logdir logs/
Standalone Script:
python inference/synthesize.py \
--text "Hello world" \
--ref_audio reference.wav \
--output output.wav \
--config configs/english_config.yaml \
--checkpoint checkpoints/english/best.pt
API Server:
# Start server
python api_server.py
# Test API
curl -X GET "http://localhost:7860/Get_Inference" \
-F "text=Hello world" \
-F "lang=english" \
-F "[email protected]" \
-o output.wav
GET /Get_InferenceGenerate speech from text with voice cloning.
Parameters:
text (str): Text to synthesizelang (str): Language (english or gujarati)speaker_wav (file): Reference audio for voice cloningReturns: Audio file (WAV format)
Example:
import requests
with open('reference.wav', 'rb') as f:
response = requests.get(
'http://localhost:7860/Get_Inference',
params={'text': 'Hello world', 'lang': 'english'},
files={'speaker_wav': f}
)
with open('output.wav', 'wb') as f:
f.write(response.content)
GET /healthHealth check endpoint.
Returns:
{
"status": "healthy",
"models_loaded": 2,
"languages": ["english", "gujarati"],
"device": "cuda"
}
Key Settings (configs/english_config.yaml):
# Audio
audio:
sample_rate: 22050
n_mels: 80
# Model
model:
text_encoder:
vocab_size: 100
hidden_dim: 256
num_layers: 6
diffusion:
diffusion_steps: 1000
inference_steps: 50
noise_schedule: cosine
# Training
training:
batch_size: 16
learning_rate: 0.0001
max_steps: 500000
mixed_precision: true
styletts2_tts/
├── configs/
│ ├── english_config.yaml
│ └── gujarati_config.yaml
├── src/
│ ├── models/ # Model architecture
│ ├── preprocessing/ # Data processing
│ ├── training/ # Training loop
│ └── utils/ # Utilities
├── data/ # Dataset (not included)
├── checkpoints/ # Model checkpoints
├── pretrained/ # Pretrained vocoder
├── logs/ # TensorBoard logs
├── api_server.py # FastAPI server
├── requirements.txt
└── README.md
| Decision | Choice | Rationale |
|---|---|---|
| Sample Rate | 22.05kHz | Standard for TTS, exact 2x downsampling from 44.1kHz |
| Text Normalization | Full | Lowercase, expand abbreviations, clean punctuation |
| Phonemization | espeak-ng (EN), char-level (GU) | espeak for English, character fallback for Gujarati |
| Gujarati Numbers | Verbal only | Matches spoken audio ({એકસો} from {100}{એકસો}) |
| Domain Embeddings | Enabled | Creates pseudo-speakers, helps with single-speaker limitation |
# Windows
Download from: https://github.com/espeak-ng/espeak-ng/releases
# Linux
sudo apt-get install espeak-ng
# macOS
brew install espeak-ng
batch_size in configmixed_precision: truehidden_dimDownload HiFi-GAN and place in pretrained/hifigan/:
pretrained/hifigan/
├── generator_v1 # PyTorch checkpoint
└── config.json # Vocoder config
@misc{styletts2-bilingual,
title={StyleTTS2 Bilingual TTS with Voice Cloning},
author={SYSPIN TTS Competition},
year={2025},
howpublished={\url{https://github.com/yourusername/styletts2-bilingual}}
}
MIT License
Status: ✅ Ready for preprocessing and training!
For questions or issues, please open a GitHub issue.