text stringlengths 0 80 |
|---|
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
# Amharic TTS β Python dependencies |
# |
# CPU-only PyTorch install (much smaller download than the CUDA wheel). |
# If you have a GPU and want to use it, remove the --extra-index-url line |
# and change `torch` to `torch torchvision` with your CUDA version. |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
# ββ PyTorch (CPU wheel) βββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
--extra-index-url https://download.pytorch.org/whl/cpu |
torch>=2.1.0 |
# ββ Hugging Face stack ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
transformers>=4.40.0 # VitsModel + VitsTokenizer with uroman support |
huggingface_hub>=0.23.0 # model downloading / caching |
# ββ Romanisation β REQUIRED for MMS-TTS ββββββββββββββββββββββββββββββββββββββ |
# The VitsTokenizer calls uroman to convert Amharic (Ethiopic) β Latin script. |
uroman>=1.3.1 |
# ββ Audio βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
scipy>=1.11.0 # scipy.io.wavfile for writing WAV files |
numpy>=1.24.0 |
# ββ Web UI ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
gradio>=4.28.0 |
# ββ Misc βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
accelerate>=0.27.0 # optional but speeds up model loading |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
ποΈ Amharic Text-to-Speech β facebook/mms-tts-amh
A fully free, offline Amharic TTS app using Meta's MMS model, running locally via Gradio.
No API keys. No internet connection required after the model is downloaded.
π File Structure
amharic_tts/
βββ app.py β main application (single file)
βββ requirements.txt β Python dependencies
βββ README.md β this file
π₯οΈ Local Setup (Step-by-Step)
Prerequisites
- Python 3.9 β 3.12 (3.10 recommended)
- ~2 GB free disk space (model cache + packages)
- No GPU required
Step 1 β Clone / download the files
Place app.py and requirements.txt in a folder, e.g. amharic_tts/.
mkdir amharic_tts && cd amharic_tts
# copy app.py and requirements.txt here
Step 2 β Create a virtual environment
# Create
python -m venv venv
# Activate β macOS / Linux
source venv/bin/activate
# Activate β Windows (PowerShell)
venv\Scripts\Activate.ps1
Step 3 β Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
First install takes 3β8 min because it downloads the CPU PyTorch wheel (~220 MB).
Step 4 β Run the app
python app.py
You should see:
Pre-loading model at startup β¦
β³ Loading facebook/mms-tts-amh β this may take a minute on first run β¦
β
Model ready (sampling_rate=16000 Hz)
Running on local URL: http://0.0.0.0:7860
First run downloads ~330 MB from Hugging Face Hub and caches it in
~/.cache/huggingface/hub/.
Subsequent runs start in seconds.
Open your browser at http://localhost:7860 and start typing!
Troubleshooting
| Symptom | Fix |
|---|---|
ModuleNotFoundError: uroman |
pip install uroman |
No module named 'transformers' |
pip install transformers>=4.40.0 |
| Slow first generation | Normal β model loads on first request if pre-load failed |
| Port 7860 already in use | Change server_port=7861 in app.py |
OMP: Error #15 on macOS |
export KMP_DUPLICATE_LIB_OK=TRUE before running |
π Free Deployment on Hugging Face Spaces
Hugging Face Spaces gives you a completely free public URL with 2 vCPUs and 16 GB RAM β plenty for CPU inference.
Step 1 β Create a Space
- Go to huggingface.co/spaces and sign in.
- Click New Space.
- Set:
- Space name:
amharic-tts(or anything you like) - SDK:
Gradio - Hardware:
CPU Basic(free tier) - Visibility: Public or Private
- Space name:
Step 2 β Upload your files
Upload both files via the web UI "Files" tab, or use the Git CLI:
# Install HF CLI if needed
pip install huggingface_hub
# Login
huggingface-cli login
# Clone your empty space
git clone https://huggingface.co/spaces/YOUR_USERNAME/amharic-tts
cd amharic-tts
# Copy your files in
cp /path/to/app.py .
cp /path/to/requirements.txt .
# Push
git add .
git commit -m "Initial Amharic TTS app"
git push
Step 3 β Wait for the build
Spaces automatically installs requirements.txt and runs app.py.
Watch the Logs tab β build takes 3 min.330 MB) into the Space's cache.
First synthesis downloads the model (
Step 4 β Share!
Your app is now live at:https://huggingface.co/spaces/YOUR_USERNAME/amharic-tts
βοΈ How uroman Works
The MMS-TTS model was trained on romanised (Latin-script) phonetic text, not
raw Ethiopic script. The uroman library converts:
α°αα! β sΓ€lam!
transformers >= 4.36 ships built-in support: the VitsTokenizer detects
that facebook/mms-tts-amh needs uroman and calls it automatically during
tokenizer(text, return_tensors="pt").
If uroman is not installed you'll get an ImportError with a clear message.
π Licence
- Model: CC-BY-NC 4.0 (non-commercial)
- This app code: MIT
- Downloads last month
- 19