patrickvonplaten
commited on
Commit
•
28096ad
1
Parent(s):
caf982f
Update README.md
Browse files
README.md
CHANGED
@@ -87,7 +87,7 @@ processor = Wav2Vec2Processor.from_pretrained("othrif/wav2vec2-large-xlsr-arabic
|
|
87 |
model = Wav2Vec2ForCTC.from_pretrained("othrif/wav2vec2-large-xlsr-arabic")
|
88 |
model.to("cuda")
|
89 |
|
90 |
-
chars_to_ignore_regex = '[
|
91 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
92 |
|
93 |
# Preprocessing the datasets.
|
@@ -106,7 +106,7 @@ def evaluate(batch):
|
|
106 |
inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
|
107 |
|
108 |
with torch.no_grad():
|
109 |
-
|
110 |
|
111 |
pred_ids = torch.argmax(logits, dim=-1)
|
112 |
batch["pred_strings"] = processor.batch_decode(pred_ids)
|
87 |
model = Wav2Vec2ForCTC.from_pretrained("othrif/wav2vec2-large-xlsr-arabic")
|
88 |
model.to("cuda")
|
89 |
|
90 |
+
chars_to_ignore_regex = '[\\\\\\\\\\\\\\\\؛\\\\\\\\\\\\\\\\—\\\\\\\\\\\\\\\\_get\\\\\\\\\\\\\\\\«\\\\\\\\\\\\\\\\»\\\\\\\\\\\\\\\\ـ\\\\\\\\\\\\\\\\ـ\\\\\\\\\\\\\\\\,\\\\\\\\\\\\\\\\?\\\\\\\\\\\\\\\\.\\\\\\\\\\\\\\\\!\\\\\\\\\\\\\\\\-\\\\\\\\\\\\\\\\;\\\\\\\\\\\\\\\\:\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\“\\\\\\\\\\\\\\\\%\\\\\\\\\\\\\\\\‘\\\\\\\\\\\\\\\\”\\\\\\\\\\\\\\\\�\\\\\\\\\\\\\\\\#\\\\\\\\\\\\\\\\،\\\\\\\\\\\\\\\\☭,\\\\\\\\\\\\\\\\؟]'
|
91 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
92 |
|
93 |
# Preprocessing the datasets.
|
106 |
inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
|
107 |
|
108 |
with torch.no_grad():
|
109 |
+
logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits
|
110 |
|
111 |
pred_ids = torch.argmax(logits, dim=-1)
|
112 |
batch["pred_strings"] = processor.batch_decode(pred_ids)
|