patrickvonplaten
commited on
Commit
·
ca734d4
1
Parent(s):
e31c31b
Update README.md
Browse files
README.md
CHANGED
@@ -17,7 +17,7 @@ model-index:
|
|
17 |
dataset:
|
18 |
name: arabicspeech.org MGB-3
|
19 |
type: arabicspeech.org MGB-3
|
20 |
-
args:
|
21 |
metrics:
|
22 |
- name: Test WER
|
23 |
type: wer
|
@@ -40,13 +40,13 @@ resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
|
40 |
# Preprocessing the datasets.
|
41 |
# We need to read the aduio files as arrays
|
42 |
def speech_file_to_array_fn(batch):
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
47 |
inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)
|
48 |
with torch.no_grad():
|
49 |
-
|
50 |
predicted_ids = torch.argmax(logits, dim=-1)
|
51 |
print("Prediction:", processor.batch_decode(predicted_ids))
|
52 |
print("Reference:", test_dataset["sentence"][:2])
|
|
|
17 |
dataset:
|
18 |
name: arabicspeech.org MGB-3
|
19 |
type: arabicspeech.org MGB-3
|
20 |
+
args: ar
|
21 |
metrics:
|
22 |
- name: Test WER
|
23 |
type: wer
|
|
|
40 |
# Preprocessing the datasets.
|
41 |
# We need to read the aduio files as arrays
|
42 |
def speech_file_to_array_fn(batch):
|
43 |
+
\tspeech_array, sampling_rate = torchaudio.load(batch["path"])
|
44 |
+
\tbatch["speech"] = resampler(speech_array).squeeze().numpy()
|
45 |
+
\treturn batch
|
46 |
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
47 |
inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)
|
48 |
with torch.no_grad():
|
49 |
+
\tlogits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
|
50 |
predicted_ids = torch.argmax(logits, dim=-1)
|
51 |
print("Prediction:", processor.batch_decode(predicted_ids))
|
52 |
print("Reference:", test_dataset["sentence"][:2])
|