Add model README
Browse files
README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Moroccan Darija Text-to-Speech Model
|
| 2 |
+
|
| 3 |
+
This model is a fine-tuned version of SpeechT5 for Moroccan Darija Text-to-Speech synthesis.
|
| 4 |
+
|
| 5 |
+
## Model Details
|
| 6 |
+
|
| 7 |
+
- **Base Model**: Microsoft SpeechT5
|
| 8 |
+
- **Fine-tuned on**: DODa audio dataset
|
| 9 |
+
- **Languages**: Moroccan Darija (Latin script)
|
| 10 |
+
- **Features**: Multiple voice support (male/female)
|
| 11 |
+
- **Release Date**: April 2025
|
| 12 |
+
|
| 13 |
+
## Usage
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
|
| 17 |
+
import torch
|
| 18 |
+
import soundfile as sf
|
| 19 |
+
|
| 20 |
+
# Load models
|
| 21 |
+
processor = SpeechT5Processor.from_pretrained("HAMMALE/speecht5-darija")
|
| 22 |
+
model = SpeechT5ForTextToSpeech.from_pretrained("HAMMALE/speecht5-darija")
|
| 23 |
+
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
|
| 24 |
+
|
| 25 |
+
# Load speaker embedding (replace with your own speaker embedding)
|
| 26 |
+
speaker_embedding = torch.randn(1, 512) # Example embedding
|
| 27 |
+
|
| 28 |
+
# Process text
|
| 29 |
+
text = "Salam, kifach nta lyoum?"
|
| 30 |
+
inputs = processor(text=text, return_tensors="pt")
|
| 31 |
+
|
| 32 |
+
# Generate speech
|
| 33 |
+
speech = model.generate_speech(inputs["input_ids"], speaker_embedding, vocoder=vocoder)
|
| 34 |
+
|
| 35 |
+
# Save audio file
|
| 36 |
+
sf.write("output.wav", speech.numpy(), 16000)
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Demo
|
| 40 |
+
|
| 41 |
+
A live demo is available at [Hugging Face Spaces](https://huggingface.co/spaces/HAMMALE/darija-tts-demo)
|
| 42 |
+
|
| 43 |
+
## License
|
| 44 |
+
|
| 45 |
+
This model is available under the MIT License.
|
| 46 |
+
|
| 47 |
+
## Acknowledgments
|
| 48 |
+
|
| 49 |
+
- The [DODa audio dataset](https://huggingface.co/datasets/atlasia/DODa-audio-dataset) creators
|
| 50 |
+
- Microsoft Research for the SpeechT5 model architecture
|