jonatasgrosman
commited on
Commit
•
f1f3121
1
Parent(s):
70a29f6
model improvement
Browse files- README.md +17 -6
- pytorch_model.bin +1 -1
README.md
CHANGED
@@ -4,6 +4,7 @@ datasets:
|
|
4 |
- common_voice
|
5 |
metrics:
|
6 |
- wer
|
|
|
7 |
tags:
|
8 |
- audio
|
9 |
- automatic-speech-recognition
|
@@ -23,7 +24,11 @@ model-index:
|
|
23 |
metrics:
|
24 |
- name: Test WER
|
25 |
type: wer
|
26 |
-
value:
|
|
|
|
|
|
|
|
|
27 |
---
|
28 |
|
29 |
# Wav2Vec2-Large-XLSR-53-portuguese
|
@@ -86,12 +91,13 @@ LANG_ID = "pt"
|
|
86 |
MODEL_ID = "jonatasgrosman/wav2vec2-large-xlsr-53-portuguese"
|
87 |
DEVICE = "cuda"
|
88 |
|
89 |
-
CHARS_TO_IGNORE = [",", "?", ".", "!", "-", ";", ":", '""', "%", "'", '"', "�", "ʿ", "·", "჻", "
|
90 |
"؟", "،", "।", "॥", "«", "»", "„", "“", "”", "「", "」", "‘", "’", "《", "》", "(", ")", "[", "]",
|
91 |
-
"=", "`", "_", "+", "<", ">", "…", "–", "°", "´", "ʾ"]
|
92 |
|
93 |
test_dataset = load_dataset("common_voice", LANG_ID, split="test")
|
94 |
-
wer = load_metric("wer")
|
|
|
95 |
|
96 |
chars_to_ignore_regex = f"[{re.escape(''.join(CHARS_TO_IGNORE))}]"
|
97 |
|
@@ -123,7 +129,12 @@ def evaluate(batch):
|
|
123 |
|
124 |
result = test_dataset.map(evaluate, batched=True, batch_size=32)
|
125 |
|
126 |
-
print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
|
|
|
127 |
```
|
128 |
|
129 |
-
**Test Result**:
|
|
|
|
|
|
|
|
|
|
4 |
- common_voice
|
5 |
metrics:
|
6 |
- wer
|
7 |
+
- cer
|
8 |
tags:
|
9 |
- audio
|
10 |
- automatic-speech-recognition
|
|
|
24 |
metrics:
|
25 |
- name: Test WER
|
26 |
type: wer
|
27 |
+
value: 12.18
|
28 |
+
metrics:
|
29 |
+
- name: Test CER
|
30 |
+
type: cer
|
31 |
+
value: 11.01
|
32 |
---
|
33 |
|
34 |
# Wav2Vec2-Large-XLSR-53-portuguese
|
|
|
91 |
MODEL_ID = "jonatasgrosman/wav2vec2-large-xlsr-53-portuguese"
|
92 |
DEVICE = "cuda"
|
93 |
|
94 |
+
CHARS_TO_IGNORE = [",", "?", "¿", ".", "!", "¡", "-", ";", ":", '""', "%", "'", '"', "�", "ʿ", "·", "჻", "~", "՞",
|
95 |
"؟", "،", "।", "॥", "«", "»", "„", "“", "”", "「", "」", "‘", "’", "《", "》", "(", ")", "[", "]",
|
96 |
+
"=", "`", "_", "+", "<", ">", "…", "–", "°", "´", "ʾ", "‹", "›", "©", "®", "—", "→", "。"]
|
97 |
|
98 |
test_dataset = load_dataset("common_voice", LANG_ID, split="test")
|
99 |
+
wer = load_metric("wer.py") # https://github.com/jonatasgrosman/wav2vec2-sprint/blob/main/wer.py
|
100 |
+
cer = load_metric("cer.py") # https://github.com/jonatasgrosman/wav2vec2-sprint/blob/main/cer.py
|
101 |
|
102 |
chars_to_ignore_regex = f"[{re.escape(''.join(CHARS_TO_IGNORE))}]"
|
103 |
|
|
|
129 |
|
130 |
result = test_dataset.map(evaluate, batched=True, batch_size=32)
|
131 |
|
132 |
+
print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"], chunk_size=8000)))
|
133 |
+
print("CER: {:2f}".format(100 * cer.compute(predictions=result["pred_strings"], references=result["sentence"], chunk_size=8000)))
|
134 |
```
|
135 |
|
136 |
+
**Test Result**:
|
137 |
+
|
138 |
+
WER: 12.18%
|
139 |
+
|
140 |
+
CER: 11.01%
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 1262126551
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8751d9a798871897adeede1d2187f8c4ae79ccb1ea294173471232c5dd9287b0
|
3 |
size 1262126551
|