Downloads · 30 days
9
7% of all-time downloads
suleiman2003/mms-tts-hau-2speaker
mms-tts-hau-2speaker is a text-to-speech model from suleiman2003. Use it when you need text read aloud. The card lists the license as cc-by-nc-4.0.
This model is a structurally converted version of facebook/mms-tts-hau adapted for 2-speaker text-to-speech synthesis.
Downloads · 30 days
9
7% of all-time downloads
All-time downloads
126
Public
Parameters
39.6M
159 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors159 MB · 100%
From the Hugging Face model README
This model is a structurally converted version of facebook/mms-tts-hau adapted for 2-speaker text-to-speech synthesis.
⚠️ IMPORTANT: This model requires fine-tuning before use. Speaker embeddings are randomly initialized.
hau)The VITS architecture consists of:
Text Encoder (Preserved from original)
Posterior Encoder (Reinitialized)
Flow-based Module (Reinitialized)
Decoder/Generator (Reinitialized)
Speaker Embedding Layer (Newly Added)
✓ Preserved:
- Text encoder (language understanding)
- Model tokenizer
- Base architecture
✗ Reinitialized:
- Posterior encoder (speaker characteristics)
- Flow-based transformations
- Decoder/generator
- Duration predictor
+ Added:
- Speaker embedding layer (2x256)
This model will not work without fine-tuning. You need:
Dataset: Multi-speaker Hausa TTS dataset with:
Fine-tuning: Use the finetune-hf-vits repository
# Clone fine-tuning repository
git clone https://github.com/ylacombe/finetune-hf-vits.git
cd finetune-hf-vits
# Install requirements
pip install -r requirements.txt
# Build monotonic alignment search
cd monotonic_align
python setup.py build_ext --inplace
cd ..
# Run fine-tuning (adjust parameters as needed)
accelerate launch run_vits_finetuning.py \
--model_name_or_path "suleiman2003/mms-tts-hau-2speaker" \
--dataset_name "your-dataset" \
--output_dir "./output" \
--num_train_epochs 100 \
--learning_rate 2e-4 \
--warmup_ratio 0.0 \
--per_device_train_batch_size 8 \
--speaker_id_column_name "speaker_id"
from transformers import VitsModel, VitsTokenizer, set_seed
import torch
import scipy
# Load fine-tuned model
model = VitsModel.from_pretrained("suleiman2003/mms-tts-hau-2speaker")
tokenizer = VitsTokenizer.from_pretrained("suleiman2003/mms-tts-hau-2speaker")
# Prepare input
text = "Sannu, yaya kake?" # "Hello, how are you?" in Hausa
inputs = tokenizer(text, return_tensors="pt")
# Generate speech for speaker 0
set_seed(42)
with torch.no_grad():
outputs = model(**inputs, speaker_id=0)
# Save audio
audio = outputs.waveform[0].cpu().numpy()
scipy.io.wavfile.write("output_speaker0.wav", rate=16000, data=audio)
# Generate speech for speaker 1
with torch.no_grad():
outputs = model(**inputs, speaker_id=1)
audio = outputs.waveform[0].cpu().numpy()
scipy.io.wavfile.write("output_speaker1.wav", rate=16000, data=audio)
Your dataset should follow this structure:
# Example dataset format
{
"audio": [<audio_path_1>, <audio_path_2>, ...],
"text": ["Yaya kake?", "Ina kwana?", ...],
"speaker_id": [0, 1, 0, 1, ...] # Speaker labels
}
If you use this model, please cite:
@article{pratap2023mms,
title={Scaling Speech Technology to 1,000+ Languages},
author={Pratap, Vineel and Tjandra, Andros and Shi, Bowen and others},
journal={arXiv preprint arXiv:2305.13516},
year={2023}
}
@inproceedings{kim2021vits,
title={Conditional variational autoencoder with adversarial learning for end-to-end text-to-speech},
author={Kim, Jaehyeon and Kong, Jungil and Son, Juhee},
booktitle={International Conference on Machine Learning},
pages={5530--5540},
year={2021},
organization={PMLR}
}
This model inherits the CC-BY-NC-4.0 license from the base MMS model, restricting commercial use.