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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Meta Speech Recognition Slavic Languages Dataset (Common Voice)
|
| 2 |
+
|
| 3 |
+
This dataset contains metadata for Slavic language speech recognition samples from Common Voice.
|
| 4 |
+
|
| 5 |
+
## Dataset Sources and Credits
|
| 6 |
+
|
| 7 |
+
This dataset contains samples from Mozilla Common Voice:
|
| 8 |
+
- Source: https://commonvoice.mozilla.org/en/datasets
|
| 9 |
+
- License: CC0-1.0
|
| 10 |
+
- Citation: Please acknowledge Mozilla Common Voice if you use this data
|
| 11 |
+
|
| 12 |
+
## Languages Included
|
| 13 |
+
|
| 14 |
+
The dataset includes the following Slavic languages:
|
| 15 |
+
- Belarusian (be)
|
| 16 |
+
- Bulgarian (bg)
|
| 17 |
+
- Czech (cs)
|
| 18 |
+
- Georgian (ka)
|
| 19 |
+
- Macedonian (mk)
|
| 20 |
+
- Polish (pl)
|
| 21 |
+
- Russian (ru)
|
| 22 |
+
- Slovak (sk)
|
| 23 |
+
- Slovenian (sl)
|
| 24 |
+
- Serbian (sr)
|
| 25 |
+
- Ukrainian (uk)
|
| 26 |
+
|
| 27 |
+
## Dataset Statistics
|
| 28 |
+
|
| 29 |
+
### Splits and Sample Counts
|
| 30 |
+
- **train**: 1562732 samples
|
| 31 |
+
- **valid**: 86814 samples
|
| 32 |
+
- **test**: 86827 samples
|
| 33 |
+
|
| 34 |
+
## Example Samples
|
| 35 |
+
### train
|
| 36 |
+
```json
|
| 37 |
+
{
|
| 38 |
+
"audio_filepath": "/cv/cv-corpus-15.0-2023-09-08/be/clips/common_voice_be_35310612.mp3",
|
| 39 |
+
"text": "Аднак электарат вырашыў інакш. AGE_18_30 GER_MALE EMOTION_NEUTRAL INTENT_INFORM",
|
| 40 |
+
"duration": 5.22
|
| 41 |
+
}
|
| 42 |
+
```
|
| 43 |
+
```json
|
| 44 |
+
{
|
| 45 |
+
"audio_filepath": "/cv/cv-corpus-15.0-2023-09-08/be/clips/common_voice_be_32521083.mp3",
|
| 46 |
+
"text": "Але гэта не адзіны паток. AGE_18_30 GER_FEMALE EMOTION_NEUTRAL INTENT_INFORM",
|
| 47 |
+
"duration": 2.74
|
| 48 |
+
}
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
### valid
|
| 52 |
+
```json
|
| 53 |
+
{
|
| 54 |
+
"audio_filepath": "/cv/cv-corpus-15.0-2023-09-08/be/clips/common_voice_be_29218733.mp3",
|
| 55 |
+
"text": "Вы ж зразумейце наколькі гэта складана. AGE_18_30 GER_MALE EMOTION_NEUTRAL INTENT_INFORM",
|
| 56 |
+
"duration": 4.32
|
| 57 |
+
}
|
| 58 |
+
```
|
| 59 |
+
```json
|
| 60 |
+
{
|
| 61 |
+
"audio_filepath": "/cv/cv-corpus-15.0-2023-09-08/be/clips/common_voice_be_29003430.mp3",
|
| 62 |
+
"text": "Адмовіцца ад яго немагчыма. AGE_18_30 GER_MALE EMOTION_NEUTRAL INTENT_ASSERT",
|
| 63 |
+
"duration": 3.42
|
| 64 |
+
}
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### test
|
| 68 |
+
```json
|
| 69 |
+
{
|
| 70 |
+
"audio_filepath": "/cv/cv-corpus-15.0-2023-09-08/be/clips/common_voice_be_29742537.mp3",
|
| 71 |
+
"text": "Гарэла святло ў хатах. AGE_18_30 GER_FEMALE EMOTION_FEAR INTENT_INFORM",
|
| 72 |
+
"duration": 2.45
|
| 73 |
+
}
|
| 74 |
+
```
|
| 75 |
+
```json
|
| 76 |
+
{
|
| 77 |
+
"audio_filepath": "/cv/cv-corpus-15.0-2023-09-08/be/clips/common_voice_be_28447241.mp3",
|
| 78 |
+
"text": "А новых грошай узяць няма адкуль. AGE_18_30 GER_MALE EMOTION_NEUTRAL INTENT_INFORM",
|
| 79 |
+
"duration": 3.31
|
| 80 |
+
}
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
## Downloading Audio Files
|
| 85 |
+
|
| 86 |
+
To use this dataset, you need to download the Common Voice dataset for each language. The audio files are not included in this repository.
|
| 87 |
+
|
| 88 |
+
### Download Instructions
|
| 89 |
+
|
| 90 |
+
1. Download Common Voice dataset version 15.0 (2023-09-08) for each language:
|
| 91 |
+
```bash
|
| 92 |
+
# For each language (replace {lang} with language code: be, bg, cs, ka, mk, pl, ru, sk, sl, sr, uk)
|
| 93 |
+
wget https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-15.0-2023-09-08/{lang}.tar.gz
|
| 94 |
+
|
| 95 |
+
# Extract the files
|
| 96 |
+
tar -xzf {lang}.tar.gz
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
2. Place the extracted files in the following structure:
|
| 100 |
+
```
|
| 101 |
+
/cv/cv-corpus-15.0-2023-09-08/
|
| 102 |
+
├── be/
|
| 103 |
+
├── bg/
|
| 104 |
+
├── cs/
|
| 105 |
+
├── ka/
|
| 106 |
+
├── mk/
|
| 107 |
+
├── pl/
|
| 108 |
+
├── ru/
|
| 109 |
+
├── sk/
|
| 110 |
+
├── sl/
|
| 111 |
+
├── sr/
|
| 112 |
+
└── uk/
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
## Training NeMo Conformer ASR for Slavic Languages
|
| 116 |
+
|
| 117 |
+
### 1. Pull and Run NeMo Docker
|
| 118 |
+
```bash
|
| 119 |
+
# Pull the NeMo Docker image
|
| 120 |
+
docker pull nvcr.io/nvidia/nemo:24.05
|
| 121 |
+
|
| 122 |
+
# Run the container with GPU support
|
| 123 |
+
docker run --gpus all -it --rm \
|
| 124 |
+
-v /external1:/external1 \
|
| 125 |
+
-v /external2:/external2 \
|
| 126 |
+
-v /external3:/external3 \
|
| 127 |
+
-v /cv:/cv \
|
| 128 |
+
--shm-size=8g \
|
| 129 |
+
-p 8888:8888 -p 6006:6006 \
|
| 130 |
+
--ulimit memlock=-1 \
|
| 131 |
+
--ulimit stack=67108864 \
|
| 132 |
+
nvcr.io/nvidia/nemo:24.05
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
### 2. Create Training Script
|
| 136 |
+
Create a script `train_nemo_asr_slavic.py`:
|
| 137 |
+
```python
|
| 138 |
+
from nemo.collections.asr.models import EncDecCTCModel
|
| 139 |
+
from nemo.collections.asr.data.audio_to_text import TarredAudioToTextDataset
|
| 140 |
+
import pytorch_lightning as pl
|
| 141 |
+
from omegaconf import OmegaConf
|
| 142 |
+
import os
|
| 143 |
+
|
| 144 |
+
# Load the dataset from Hugging Face
|
| 145 |
+
from datasets import load_dataset
|
| 146 |
+
dataset = load_dataset("WhissleAI/Meta_STT_SLAVIC_CommonVoice")
|
| 147 |
+
|
| 148 |
+
# Create config
|
| 149 |
+
config = OmegaConf.create({
|
| 150 |
+
'model': {
|
| 151 |
+
'name': 'EncDecCTCModel',
|
| 152 |
+
'train_ds': {
|
| 153 |
+
'manifest_filepath': None, # Will be set dynamically
|
| 154 |
+
'batch_size': 32,
|
| 155 |
+
'shuffle': True,
|
| 156 |
+
'num_workers': 4,
|
| 157 |
+
'pin_memory': True,
|
| 158 |
+
'use_start_end_token': False,
|
| 159 |
+
},
|
| 160 |
+
'validation_ds': {
|
| 161 |
+
'manifest_filepath': None, # Will be set dynamically
|
| 162 |
+
'batch_size': 32,
|
| 163 |
+
'shuffle': False,
|
| 164 |
+
'num_workers': 4,
|
| 165 |
+
'pin_memory': True,
|
| 166 |
+
'use_start_end_token': False,
|
| 167 |
+
},
|
| 168 |
+
'optim': {
|
| 169 |
+
'name': 'adamw',
|
| 170 |
+
'lr': 0.001,
|
| 171 |
+
'weight_decay': 0.01,
|
| 172 |
+
},
|
| 173 |
+
'trainer': {
|
| 174 |
+
'devices': 1,
|
| 175 |
+
'accelerator': 'gpu',
|
| 176 |
+
'max_epochs': 100,
|
| 177 |
+
'precision': 16,
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
})
|
| 181 |
+
|
| 182 |
+
# Initialize model
|
| 183 |
+
model = EncDecCTCModel(cfg=config.model)
|
| 184 |
+
|
| 185 |
+
# Create trainer
|
| 186 |
+
trainer = pl.Trainer(**config.model.trainer)
|
| 187 |
+
|
| 188 |
+
# Train
|
| 189 |
+
trainer.fit(model)
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
### 3. Create Config File
|
| 193 |
+
Create a config file `config_slavic.yaml`:
|
| 194 |
+
```yaml
|
| 195 |
+
model:
|
| 196 |
+
name: "EncDecCTCModel"
|
| 197 |
+
train_ds:
|
| 198 |
+
manifest_filepath: "train.json"
|
| 199 |
+
batch_size: 32
|
| 200 |
+
shuffle: true
|
| 201 |
+
num_workers: 4
|
| 202 |
+
pin_memory: true
|
| 203 |
+
use_start_end_token: false
|
| 204 |
+
|
| 205 |
+
validation_ds:
|
| 206 |
+
manifest_filepath: "valid.json"
|
| 207 |
+
batch_size: 32
|
| 208 |
+
shuffle: false
|
| 209 |
+
num_workers: 4
|
| 210 |
+
pin_memory: true
|
| 211 |
+
use_start_end_token: false
|
| 212 |
+
|
| 213 |
+
optim:
|
| 214 |
+
name: adamw
|
| 215 |
+
lr: 0.001
|
| 216 |
+
weight_decay: 0.01
|
| 217 |
+
|
| 218 |
+
trainer:
|
| 219 |
+
devices: 1
|
| 220 |
+
accelerator: "gpu"
|
| 221 |
+
max_epochs: 100
|
| 222 |
+
precision: 16
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
### 4. Start Training
|
| 226 |
+
```bash
|
| 227 |
+
# Inside the NeMo container
|
| 228 |
+
python -m torch.distributed.launch --nproc_per_node=1 \
|
| 229 |
+
train_nemo_asr_slavic.py \
|
| 230 |
+
--config-path=. \
|
| 231 |
+
--config-name=config_slavic.yaml
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
## Usage Notes
|
| 235 |
+
|
| 236 |
+
1. The dataset includes only metadata. Audio files must be downloaded separately from Common Voice.
|
| 237 |
+
2. Audio files should be placed in the `/cv/cv-corpus-15.0-2023-09-08/{lang}/` directory structure.
|
| 238 |
+
3. For optimal performance:
|
| 239 |
+
- Use a GPU with at least 16GB VRAM
|
| 240 |
+
- Adjust batch size based on your GPU memory
|
| 241 |
+
- Consider gradient accumulation for larger effective batch sizes
|
| 242 |
+
- Monitor training with TensorBoard (accessible via port 6006)
|
| 243 |
+
|
| 244 |
+
## Common Issues and Solutions
|
| 245 |
+
|
| 246 |
+
1. **Memory Issues**:
|
| 247 |
+
- Reduce batch size if you encounter OOM errors
|
| 248 |
+
- Use gradient accumulation for larger effective batch sizes
|
| 249 |
+
- Enable mixed precision training (fp16)
|
| 250 |
+
|
| 251 |
+
2. **Training Speed**:
|
| 252 |
+
- Increase num_workers based on your CPU cores
|
| 253 |
+
- Use pin_memory=True for faster data transfer to GPU
|
| 254 |
+
- Consider using tarred datasets for faster I/O
|
| 255 |
+
|
| 256 |
+
3. **Model Performance**:
|
| 257 |
+
- Adjust learning rate based on your batch size
|
| 258 |
+
- Use learning rate warmup for better convergence
|
| 259 |
+
- Consider using a pretrained model as initialization
|