Commit
·
b2d9405
1
Parent(s):
4a36ad9
Update README.md
Browse files
README.md
CHANGED
|
@@ -76,6 +76,8 @@ print(prediction[0])
|
|
| 76 |
```
|
| 77 |
|
| 78 |
## Evaluation
|
|
|
|
|
|
|
| 79 |
pip install datasets
|
| 80 |
pip install transformers
|
| 81 |
import torch
|
|
@@ -103,6 +105,7 @@ def predict(batch):
|
|
| 103 |
return_tensors="pt",
|
| 104 |
padding=True
|
| 105 |
)
|
|
|
|
| 106 |
input_values = features.input_values
|
| 107 |
attention_mask = features.attention_mask
|
| 108 |
|
|
@@ -117,11 +120,9 @@ dataset = dataset.map(speech_file_to_array_fn)
|
|
| 117 |
result = dataset.map(predict, batched=True, batch_size=4)
|
| 118 |
wer = load_metric("wer")
|
| 119 |
cer = load_metric("cer")
|
|
|
|
| 120 |
print("WER: {:.2f}".format(100 * wer.compute(predictions=result["prediction"], references=result["reference"])))
|
| 121 |
print("CER: {:.2f}".format(100 * cer.compute(predictions=result["prediction"], references=result["reference"])))
|
| 122 |
-
For the evaluation use the code below:
|
| 123 |
-
```python
|
| 124 |
-
?
|
| 125 |
```
|
| 126 |
|
| 127 |
*Result (WER)*:
|
|
|
|
| 76 |
```
|
| 77 |
|
| 78 |
## Evaluation
|
| 79 |
+
For the evaluation use the code below:
|
| 80 |
+
```python
|
| 81 |
pip install datasets
|
| 82 |
pip install transformers
|
| 83 |
import torch
|
|
|
|
| 105 |
return_tensors="pt",
|
| 106 |
padding=True
|
| 107 |
)
|
| 108 |
+
|
| 109 |
input_values = features.input_values
|
| 110 |
attention_mask = features.attention_mask
|
| 111 |
|
|
|
|
| 120 |
result = dataset.map(predict, batched=True, batch_size=4)
|
| 121 |
wer = load_metric("wer")
|
| 122 |
cer = load_metric("cer")
|
| 123 |
+
|
| 124 |
print("WER: {:.2f}".format(100 * wer.compute(predictions=result["prediction"], references=result["reference"])))
|
| 125 |
print("CER: {:.2f}".format(100 * cer.compute(predictions=result["prediction"], references=result["reference"])))
|
|
|
|
|
|
|
|
|
|
| 126 |
```
|
| 127 |
|
| 128 |
*Result (WER)*:
|