File size: 7,830 Bytes
5e212bc
 
 
852a35b
5e212bc
 
 
 
852a35b
 
 
 
 
f01103e
852a35b
958260d
 
 
 
 
5e212bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958260d
7ee601a
bf96c87
5e212bc
 
bf96c87
f01103e
958260d
bf96c87
958260d
bf96c87
 
 
 
 
 
 
 
 
 
 
 
 
495c7eb
958260d
bf96c87
958260d
 
 
bf96c87
 
 
 
958260d
 
 
 
 
 
 
 
5e212bc
958260d
 
f01103e
958260d
f01103e
 
958260d
5e212bc
958260d
5e212bc
 
 
 
 
bf96c87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958260d
7ee601a
958260d
5e212bc
 
bf96c87
5e212bc
958260d
bf96c87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958260d
 
 
 
bf96c87
 
 
 
958260d
5e212bc
bf96c87
 
 
958260d
 
 
 
 
 
bf96c87
958260d
5e212bc
bf96c87
5e212bc
 
 
 
 
 
 
 
bf96c87
5e212bc
 
 
958260d
bf96c87
958260d
bf96c87
5e212bc
 
 
 
bf96c87
 
 
 
5e212bc
 
bf96c87
 
 
 
 
 
7ee601a
5e212bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852a35b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
---
language:
- ha
license: mit
task_categories:
- text-to-speech
size_categories:
- 1K<n<10K
tags:
- hausa
- tts
- speech
- audio
- multi-speaker
pretty_name: Hausa TTS Dataset
configs:
- config_name: default
  data_files:
  - split: train
    path: data/**
---

# Hausa TTS Dataset (HausaTTSEmbed)

This dataset contains **1,283 Hausa language audio recordings** with transcriptions for Text-to-Speech (TTS) model training.

## Dataset Details

- **Language:** Hausa (ha)
- **Total Samples:** 1,283
- **Speakers:** 3 unique speakers
- **Audio Format:** WAV files
- **Sample Rate:** Original recordings (will be resampled to 24kHz during training)
- **Text Length:** 4-141 characters (average: 24 characters)

## Dataset Structure

Each example contains:

- **audio**: Audio file in WAV format
- **text**: Hausa transcription with proper diacritics (e.g., "Ansamu ɓaraka acikin shirin")
- **speaker_id**: UUID of the speaker (3 unique values)

### Data Fields

```python
{
    'audio': {
        'path': str,      # Path to audio file
        'array': ndarray, # Audio waveform
        'sampling_rate': int
    },
    'text': str,          # Hausa transcription
    'speaker_id': str     # Speaker identifier
}
```

## Usage

### Recommended: Download All Files First

To ensure all audio files are available and avoid rate limits, authenticate first:

```python
from huggingface_hub import snapshot_download, HfApi
from datasets import load_dataset, Audio
import os
import time

# IMPORTANT: Login FIRST and WAIT for confirmation
# Method 1: Using token directly (RECOMMENDED for Colab)
from huggingface_hub import login
HF_TOKEN = "hf_YourTokenHere"  # Get from https://huggingface.co/settings/tokens
login(token=HF_TOKEN)

# Verify login worked
api = HfApi()
user_info = api.whoami(token=HF_TOKEN)
print(f"✓ Logged in as: {user_info['name']}")

# Small delay to ensure auth propagates
time.sleep(2)

# Download entire dataset (parquet + all audio files)
print("\nDownloading dataset (~2GB)...")
local_dir = snapshot_download(
    "Aybee5/HausaTTSEmbed",
    repo_type="dataset",
    local_dir="hausa_tts_data",
    token=HF_TOKEN,  # Pass token explicitly
    max_workers=1,   # Reduce concurrent requests to avoid rate limits
    resume_download=True  # Resume if interrupted
)

# Load from downloaded files
dataset = load_dataset(
    "parquet",
    data_files=f"{local_dir}/data/*.parquet",
    split="train"
)

# Fix audio paths to absolute paths
dataset = dataset.map(lambda x: {"audio": os.path.join(local_dir, x["audio"]), **x})

# Cast to Audio type
dataset = dataset.cast_column("audio", Audio(sampling_rate=22050))

print(f"✓ Loaded {len(dataset)} samples")

# Access sample
sample = dataset[0]
print(f"Text: {sample['text']}")
print(f"Audio shape: {sample['audio']['array'].shape}")
```

**Alternative: Interactive Login (prompts for token)**

```python
from huggingface_hub import login, snapshot_download
import time

# This will prompt you to paste your token
login()
time.sleep(2)  # Wait for auth to propagate

# Then download
local_dir = snapshot_download(
    "Aybee5/HausaTTSEmbed",
    repo_type="dataset",
    local_dir="hausa_tts_data",
    max_workers=1  # Reduce concurrent requests
)
```

### For Unsloth TTS Training (Complete Code)

Use this complete code in your Unsloth/Colab notebook:

```python
from huggingface_hub import snapshot_download, login, HfApi
from datasets import load_dataset, Audio
import os
import time

# ==================== STEP 1: AUTHENTICATE ====================
# Replace with your actual token from https://huggingface.co/settings/tokens
HF_TOKEN = "hf_YourTokenHere"

print("Authenticating with HuggingFace...")
login(token=HF_TOKEN)

# Verify authentication
api = HfApi()
user_info = api.whoami(token=HF_TOKEN)
print(f"✓ Logged in as: {user_info['name']}\n")

# Wait for auth to propagate
time.sleep(2)

# ==================== STEP 2: DOWNLOAD DATASET ====================
print("Downloading Hausa TTS dataset (~2GB)...")
print("Using reduced concurrency to avoid rate limits...\n")

local_dir = snapshot_download(
    "Aybee5/HausaTTSEmbed",
    repo_type="dataset",
    local_dir="/content/hausa_tts",  # Use /content/ for Colab
    token=HF_TOKEN,  # Pass token explicitly
    max_workers=1,   # Single threaded to avoid rate limits
    resume_download=True
)

print(f"✓ Downloaded to: {local_dir}\n")

# ==================== STEP 3: LOAD DATASET ====================
raw_ds = load_dataset(
    "parquet",
    data_files=f"{local_dir}/data/*.parquet",
    split="train"
)

# ==================== STEP 4: FIX AUDIO PATHS ====================
raw_ds = raw_ds.map(lambda x: {"audio": os.path.join(local_dir, x["audio"]), **x})

# ==================== STEP 5: HANDLE SPEAKERS ====================
speaker_key = "source"
if "source" not in raw_ds.column_names and "speaker_id" not in raw_ds.column_names:
    print("Unsloth: No speaker found, adding default source")
    new_column = ["0"] * len(raw_ds)
    raw_ds = raw_ds.add_column("source", new_column)
elif "source" not in raw_ds.column_names and "speaker_id" in raw_ds.column_names:
    speaker_key = "speaker_id"

# ==================== STEP 6: RESAMPLE AUDIO ====================
target_sampling_rate = 24000
raw_ds = raw_ds.cast_column("audio", Audio(sampling_rate=target_sampling_rate))

print(f"✓ Dataset ready: {len(raw_ds)} samples")
print(f"✓ Speaker column: {speaker_key}\n")

# ==================== STEP 7: OPTIONAL SPLIT ====================
split_ds = raw_ds.train_test_split(test_size=0.1, seed=42)
train_ds = split_ds['train']
val_ds = split_ds['test']

print(f"✓ Train: {len(train_ds)} samples")
print(f"✓ Validation: {len(val_ds)} samples")

# Continue with your Unsloth training!
```

**Key Changes to Avoid Rate Limits:**
1. ✅ Pass `token=HF_TOKEN` explicitly to `snapshot_download()`
2. ✅ Set `max_workers=1` to reduce concurrent requests
3. ✅ Add `time.sleep(2)` after login to ensure auth propagates
4. ✅ Verify authentication with `api.whoami()` before downloading
5. ✅ Use `resume_download=True` to handle interruptions

### With Transformers

```python
from transformers import AutoProcessor

processor = AutoProcessor.from_pretrained("your-tts-model")

def preprocess_function(examples):
    audio_arrays = [x["array"] for x in examples["audio"]]
    
    inputs = processor(
        text=examples["text"],
        audio=audio_arrays,
        sampling_rate=24000,
        return_tensors="pt",
        padding=True
    )
    
    return inputs

# Apply preprocessing
processed_ds = dataset.map(
    preprocess_function,
    batched=True,
    remove_columns=dataset.column_names
)
```

## Dataset Statistics

- **Total Samples:** 1,283
- **Unique Speakers:** 3
- **Text Statistics:**
  - Average length: 24.0 characters
  - Min length: 4 characters
  - Max length: 141 characters
  - Language: Hausa with proper Unicode diacritics

## Data Source

This dataset was created using Mimic Studio recordings for Hausa language TTS development.

## Intended Use

This dataset is intended for:
- Training Hausa Text-to-Speech models
- Fine-tuning multilingual TTS models on Hausa
- Research in low-resource language TTS
- Multi-speaker TTS model development

## Limitations

- Limited to 3 speakers (may affect speaker diversity in trained models)
- Relatively small dataset size (1,283 samples)
- Audio quality depends on recording conditions

## Citation

If you use this dataset, please cite:

```bibtex
@dataset{hausa_tts_embed,
  author = {Aybee5},
  title = {Hausa TTS Dataset (HausaTTSEmbed)},
  year = {2025},
  publisher = {Hugging Face},
  url = {https://huggingface.co/datasets/Aybee5/HausaTTSEmbed}
}
```

## License

Please specify your license here.

## Contact

For questions or issues regarding this dataset, please open an issue in the dataset repository.