Instructions to use TheBOrganization/Arabic_TTS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- VibeVoice
How to use TheBOrganization/Arabic_TTS with VibeVoice:
import torch, soundfile as sf, librosa, numpy as np from vibevoice.processor.vibevoice_processor import VibeVoiceProcessor from vibevoice.modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference # Load voice sample (should be 24kHz mono) voice, sr = sf.read("path/to/voice_sample.wav") if voice.ndim > 1: voice = voice.mean(axis=1) if sr != 24000: voice = librosa.resample(voice, sr, 24000) processor = VibeVoiceProcessor.from_pretrained("TheBOrganization/Arabic_TTS") model = VibeVoiceForConditionalGenerationInference.from_pretrained( "TheBOrganization/Arabic_TTS", torch_dtype=torch.bfloat16 ).to("cuda").eval() model.set_ddpm_inference_steps(5) inputs = processor(text=["Speaker 0: Hello!\nSpeaker 1: Hi there!"], voice_samples=[[voice]], return_tensors="pt") audio = model.generate(**inputs, cfg_scale=1.3, tokenizer=processor.tokenizer).speech_outputs[0] sf.write("output.wav", audio.cpu().numpy().squeeze(), 24000) - Notebooks
- Google Colab
- Kaggle
๐๏ธ Arabic_TTS by theBOrganization
High-Fidelity, Zero-Shot Arabic Text-to-Speech
Bringing natural, expressive, and culturally accurate Arabic speech to life.
๐ Overview
Arabic_TTS is a state-of-the-art Text-to-Speech model specifically optimized for the Arabic language. Built on the powerful VibeVoice architecture, this model goes beyond standard TTS by offering zero-shot voice cloning.
Simply provide a short reference audio clip, and the model will synthesize your input text in Arabic while perfectly capturing the timbre, tone, and unique characteristics of the reference speaker.
โจ Key Features
- ๐ฃ๏ธ Native Arabic Fluency: Handles complex Arabic morphology, diacritics (Tashkeel) with high fidelity.
- ๐ญ Zero-Shot Voice Cloning: Clone any voice from a single reference audio sample without fine-tuning.
- ๐๏ธ Controllable Generation: Built-in Classifier-Free Guidance (CFG) and temperature sampling for expressive and diverse outputs.
- โก Optimized Inference: Supports CUDA (bfloat16), Apple Silicon MPS (float32), and CPU for maximum efficiency.
๐ง Audio Samples
Listen to the quality of the model below. We compare the original reference voice against the synthetic generated output.
| ๐ค Original Reference Voice | ๐ค Synthetic Generated Voice |
|---|---|
๐ ๏ธ Usage & Inference
Prerequisites
Ensure you have PyTorch installed. You will also need the vibevoice library.
pip install torch torchaudio
# Install vibevoice (adjust based on your specific package distribution)
pip install vibevoice
Inference Code
Below is the complete script to load the model, process the text and reference audio, and generate high-quality 24kHz speech.
import os
import torch
import torchaudio as ta
from vibevoice.processor.vibevoice_processor import VibeVoiceProcessor
from vibevoice.modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference
# --- Configuration ---
model_path = "theBOrganization/Arabic_TTS"
text = "SPEAKER 1: ู
ุฑุญุจุงุ ูุฐุง ู
ุซุงู ุนูู ุชูููุฏ ุงูุตูุช ุจุงููุบุฉ ุงูุนุฑุจูุฉ ุจุงุณุชุฎุฏุงู
ูู
ูุฐุฌ ุฌุฏูุฏ."
output_path = "output.wav"
# Device selection with fallback
device = "cuda" if torch.cuda.is_available() else ("mps" if torch.backends.mps.is_available() else "cpu")
print(f"๐ Loading model on {device}...")
# Load Processor
processor = VibeVoiceProcessor.from_pretrained(model_path)
# Set dtype and attention implementation based on device
if device == "mps":
dtype = torch.float32
elif device == "cuda":
dtype = torch.bfloat16
else:
dtype = torch.float32 # Note: float32 is recommended for CPU stability
attn_impl = "sdpa"
# Load Model
model = VibeVoiceForConditionalGenerationInference.from_pretrained(
model_path,
torch_dtype=dtype,
attn_implementation=attn_impl,
device_map=device if device != "mps" else None,
)
if device == "mps":
model.to("mps")
model.eval()
model.set_ddpm_inference_steps(10) # 10 steps for DDPM inference
# --- Prepare Inputs ---
reference_voice = "prompt.wav" # Replace with your reference audio path
print(f"๐๏ธ Using reference voice: {reference_voice}")
inputs = processor(
text=[text],
voice_samples=[[reference_voice]], # Batch of one speaker list
return_tensors="pt",
padding=True,
)
# Move tensors to the correct device
inputs = {
k: v.to(device) if torch.is_tensor(v) else v
for k, v in inputs.items()
}
# --- Generate Audio ---
print("๐ง Generating audio...")
with torch.no_grad():
outputs = model.generate(
**inputs,
cfg_scale=1.3,
tokenizer=processor.tokenizer,
generation_config={
'do_sample': True,
'temperature': 0.5
},
)
# --- Save Output ---
audio = outputs.speech_outputs[0].cpu().float() # shape: [1, T] or [T]
if audio.ndim == 1:
audio = audio.unsqueeze(0).float()
sample_rate = 24000
ta.save(output_path, audio, sample_rate)
print(f"โ
Successfully saved audio to {output_path}")
๐ Input Formatting
The model expects text to be prefixed with a speaker identifier.
- Format:
SPEAKER X: <Your Arabic Text Here> - Example:
SPEAKER 1: ุฃููุงู ูุณููุงู ุจูู ูู ู ููุนูุง.
โ๏ธ Model Details
| Feature | Specification |
|---|---|
| Architecture | VibeVoice (Diffusion / Flow-Matching based) |
| Sampling Rate | 24,000 Hz |
| Inference Steps | 10 (DDPM) |
| Supported Languages | Arabic (Modern Standard) |
โ ๏ธ Limitations & Ethical Considerations
While Arabic_TTS produces highly realistic speech, users must adhere to responsible AI practices:
- Consent: Do not use the zero-shot voice cloning feature to clone voices without the explicit consent of the speaker.
- Misinformation: Do not use this model to generate deceptive audio (deepfakes) for malicious purposes, fraud, or political manipulation.
- Dialects: While the model excels at Modern Standard Arabic (MSA), extreme regional dialects or heavy code-switching (mixing Arabic and English in the same sentence) may result in slight pronunciation artifacts.
Developed with โค๏ธ by [theBOrganization]
For inquiries, collaborations, or bug reports, please open an issue on the repository or contact us directly.
- Downloads last month
- 12