theborg321 commited on
Commit
34f1ed6
ยท
verified ยท
1 Parent(s): 9791029

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +205 -1
README.md CHANGED
@@ -1,3 +1,207 @@
 
1
  ---
2
- license: mit
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
  ---
3
+ language:
4
+ - ar
5
+ tags:
6
+ - text-to-speech
7
+ - tts
8
+ - arabic
9
+ - voice-cloning
10
+ - zero-shot
11
+ - audio
12
+ - vibevoice
13
+ license: apache-2.0
14
+ pipeline_tag: text-to-speech
15
  ---
16
+
17
+ # ๐ŸŽ™๏ธ Arabic_TTS by theBOrganization
18
+
19
+ <div align="center">
20
+ <h3>High-Fidelity, Zero-Shot Arabic Text-to-Speech</h3>
21
+ <p>Bringing natural, expressive, and culturally accurate Arabic speech to life.</p>
22
+ </div>
23
+
24
+ <br>
25
+
26
+
27
+ <td align="center">
28
+ <audio controls>
29
+ <source src="https://huggingface.co/theBOrganization/Arabic_TTS/resolve/main/audio/samp_3.wav" type="audio/wav">
30
+ Your browser does not support the audio element.
31
+ </audio>
32
+ </td>
33
+
34
+ ## ๐ŸŒŸ Overview
35
+
36
+ **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**.
37
+
38
+ 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.
39
+
40
+ ### โœจ Key Features
41
+ * ๐Ÿ—ฃ๏ธ **Native Arabic Fluency:** Handles complex Arabic morphology, diacritics (Tashkeel) with high fidelity.
42
+ * ๐ŸŽญ **Zero-Shot Voice Cloning:** Clone any voice from a single reference audio sample without fine-tuning.
43
+ * ๐ŸŽ›๏ธ **Controllable Generation:** Built-in Classifier-Free Guidance (CFG) and temperature sampling for expressive and diverse outputs.
44
+ * โšก **Optimized Inference:** Supports CUDA (bfloat16), Apple Silicon MPS (float32), and CPU for maximum efficiency.
45
+
46
+ ---
47
+
48
+ ## ๐ŸŽง Audio Samples
49
+
50
+ Listen to the quality of the model below. We compare the original reference voice against the synthetic generated output.
51
+
52
+ <table>
53
+ <thead>
54
+ <tr>
55
+ <th align="center">๐ŸŽค Original Reference Voice</th>
56
+ <th align="center">๐Ÿค– Synthetic Generated Voice</th>
57
+ </tr>
58
+ </thead>
59
+ <tbody>
60
+ <tr>
61
+ <td align="center">
62
+ <audio controls>
63
+ <source src="https://huggingface.co/theBOrganization/Arabic_TTS/resolve/main/audio/samp_2.ogg" type="audio/wav">
64
+ Your browser does not support the audio element.
65
+ </audio>
66
+ </td>
67
+ <td align="center">
68
+ <audio controls>
69
+ <source src="https://huggingface.co/theBOrganization/Arabic_TTS/resolve/main/audio/samp_1.ogg" type="audio/wav">
70
+ Your browser does not support the audio element.
71
+ </audio>
72
+ </td>
73
+ </tr>
74
+ </tbody>
75
+ </table>
76
+
77
+ ---
78
+
79
+ ## ๐Ÿ› ๏ธ Usage & Inference
80
+
81
+ ### Prerequisites
82
+
83
+ Ensure you have PyTorch installed. You will also need the `vibevoice` library.
84
+
85
+ ```bash
86
+ pip install torch torchaudio
87
+ # Install vibevoice (adjust based on your specific package distribution)
88
+ pip install vibevoice
89
+ ```
90
+
91
+ ### Inference Code
92
+
93
+ Below is the complete script to load the model, process the text and reference audio, and generate high-quality 24kHz speech.
94
+
95
+ ```python
96
+ import os
97
+ import torch
98
+ import torchaudio as ta
99
+ from vibevoice.processor.vibevoice_processor import VibeVoiceProcessor
100
+ from vibevoice.modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference
101
+
102
+ # --- Configuration ---
103
+ model_path = "theBOrganization/Arabic_TTS"
104
+ text = "SPEAKER 1: ู…ุฑุญุจุงุŒ ู‡ุฐุง ู…ุซุงู„ ุนู„ู‰ ุชูˆู„ูŠุฏ ุงู„ุตูˆุช ุจุงู„ู„ุบุฉ ุงู„ุนุฑุจูŠุฉ ุจุงุณุชุฎุฏุงู… ู†ู…ูˆุฐุฌ ุฌุฏูŠุฏ."
105
+ output_path = "output.wav"
106
+
107
+ # Device selection with fallback
108
+ device = "cuda" if torch.cuda.is_available() else ("mps" if torch.backends.mps.is_available() else "cpu")
109
+ print(f"๐Ÿš€ Loading model on {device}...")
110
+
111
+ # Load Processor
112
+ processor = VibeVoiceProcessor.from_pretrained(model_path)
113
+
114
+ # Set dtype and attention implementation based on device
115
+ if device == "mps":
116
+ dtype = torch.float32
117
+ elif device == "cuda":
118
+ dtype = torch.bfloat16
119
+ else:
120
+ dtype = torch.float32 # Note: float32 is recommended for CPU stability
121
+
122
+ attn_impl = "sdpa"
123
+
124
+ # Load Model
125
+ model = VibeVoiceForConditionalGenerationInference.from_pretrained(
126
+ model_path,
127
+ torch_dtype=dtype,
128
+ attn_implementation=attn_impl,
129
+ device_map=device if device != "mps" else None,
130
+ )
131
+
132
+ if device == "mps":
133
+ model.to("mps")
134
+
135
+ model.eval()
136
+ model.set_ddpm_inference_steps(10) # 10 steps for DDPM inference
137
+
138
+ # --- Prepare Inputs ---
139
+ reference_voice = "prompt.wav" # Replace with your reference audio path
140
+ print(f"๐ŸŽ™๏ธ Using reference voice: {reference_voice}")
141
+
142
+ inputs = processor(
143
+ text=[text],
144
+ voice_samples=[[reference_voice]], # Batch of one speaker list
145
+ return_tensors="pt",
146
+ padding=True,
147
+ )
148
+
149
+ # Move tensors to the correct device
150
+ inputs = {
151
+ k: v.to(device) if torch.is_tensor(v) else v
152
+ for k, v in inputs.items()
153
+ }
154
+
155
+ # --- Generate Audio ---
156
+ print("๐ŸŽง Generating audio...")
157
+ with torch.no_grad():
158
+ outputs = model.generate(
159
+ **inputs,
160
+ cfg_scale=1.3,
161
+ tokenizer=processor.tokenizer,
162
+ generation_config={
163
+ 'do_sample': True,
164
+ 'temperature': 0.5
165
+ },
166
+ )
167
+
168
+ # --- Save Output ---
169
+ audio = outputs.speech_outputs[0].cpu().float() # shape: [1, T] or [T]
170
+ if audio.ndim == 1:
171
+ audio = audio.unsqueeze(0).float()
172
+
173
+ sample_rate = 24000
174
+ ta.save(output_path, audio, sample_rate)
175
+ print(f"โœ… Successfully saved audio to {output_path}")
176
+ ```
177
+
178
+ ### ๐Ÿ“ Input Formatting
179
+ The model expects text to be prefixed with a speaker identifier.
180
+ * **Format:** `SPEAKER X: <Your Arabic Text Here>`
181
+ * **Example:** `SPEAKER 1: ุฃู‡ู„ุงู‹ ูˆุณู‡ู„ุงู‹ ุจูƒู… ููŠ ู…ูˆู‚ุนู†ุง.`
182
+
183
+ ---
184
+
185
+ ## โš™๏ธ Model Details
186
+
187
+ | Feature | Specification |
188
+ | :--- | :--- |
189
+ | **Architecture** | VibeVoice (Diffusion / Flow-Matching based) |
190
+ | **Sampling Rate** | 24,000 Hz |
191
+ | **Inference Steps** | 10 (DDPM) |
192
+ | **Supported Languages** | Arabic (Modern Standard) |
193
+
194
+ ---
195
+
196
+ ## โš ๏ธ Limitations & Ethical Considerations
197
+
198
+ While **Arabic_TTS** produces highly realistic speech, users must adhere to responsible AI practices:
199
+ 1. **Consent:** Do not use the zero-shot voice cloning feature to clone voices without the explicit consent of the speaker.
200
+ 2. **Misinformation:** Do not use this model to generate deceptive audio (deepfakes) for malicious purposes, fraud, or political manipulation.
201
+ 3. **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.
202
+
203
+ ---
204
+
205
+
206
+ **Developed with โค๏ธ by [theBOrganization]**
207
+ For inquiries, collaborations, or bug reports, please open an issue on the repository or contact us directly.