Update README.md
Browse files
README.md
CHANGED
|
@@ -10,7 +10,7 @@ tags:
|
|
| 10 |
- speech
|
| 11 |
license: apache-2.0
|
| 12 |
model-index:
|
| 13 |
-
- name: Wav2Vec2 Luganda
|
| 14 |
results:
|
| 15 |
- task:
|
| 16 |
name: Speech Recognition
|
|
@@ -54,7 +54,10 @@ resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
|
| 54 |
# Preprocessing the datasets.
|
| 55 |
# We need to read the aduio files as arrays
|
| 56 |
def speech_file_to_array_fn(batch):
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
batch["speech"] = resampler(speech_array).squeeze().numpy()
|
| 59 |
return batch
|
| 60 |
|
|
@@ -98,7 +101,10 @@ resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
|
| 98 |
# We need to read the audio files as arrays
|
| 99 |
def speech_file_to_array_fn(batch):
|
| 100 |
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
| 102 |
batch["speech"] = resampler(speech_array).squeeze().numpy()
|
| 103 |
return batch
|
| 104 |
|
|
|
|
| 10 |
- speech
|
| 11 |
license: apache-2.0
|
| 12 |
model-index:
|
| 13 |
+
- name: Wav2Vec2 Luganda by Indonesian-NLP
|
| 14 |
results:
|
| 15 |
- task:
|
| 16 |
name: Speech Recognition
|
|
|
|
| 54 |
# Preprocessing the datasets.
|
| 55 |
# We need to read the aduio files as arrays
|
| 56 |
def speech_file_to_array_fn(batch):
|
| 57 |
+
if "audio" in batch:
|
| 58 |
+
speech_array = torch.tensor(batch["audio"]["array"])
|
| 59 |
+
else:
|
| 60 |
+
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
| 61 |
batch["speech"] = resampler(speech_array).squeeze().numpy()
|
| 62 |
return batch
|
| 63 |
|
|
|
|
| 101 |
# We need to read the audio files as arrays
|
| 102 |
def speech_file_to_array_fn(batch):
|
| 103 |
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
|
| 104 |
+
if "audio" in batch:
|
| 105 |
+
speech_array = torch.tensor(batch["audio"]["array"])
|
| 106 |
+
else:
|
| 107 |
+
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
| 108 |
batch["speech"] = resampler(speech_array).squeeze().numpy()
|
| 109 |
return batch
|
| 110 |
|