Update README.md
Browse filesfix chars_to_ignore_regex
README.md
CHANGED
@@ -86,8 +86,7 @@ processor = Wav2Vec2Processor.from_pretrained("ceyda/wav2vec2-large-xlsr-53-turk
|
|
86 |
model = Wav2Vec2ForCTC.from_pretrained("ceyda/wav2vec2-large-xlsr-53-turkish")
|
87 |
model.to("cuda")
|
88 |
|
89 |
-
|
90 |
-
chars_to_ignore_regex = '[\\\\,\\\\?\\\\.\\\\!\\\\-\\\\;\\\\:\\\\"\\\\“\\\\%\\\\‘\\\\”\\\\�\\\\'\\\\`]'
|
91 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
92 |
|
93 |
# Preprocessing the datasets.
|
@@ -106,7 +105,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)
|
|
|
86 |
model = Wav2Vec2ForCTC.from_pretrained("ceyda/wav2vec2-large-xlsr-53-turkish")
|
87 |
model.to("cuda")
|
88 |
|
89 |
+
chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“\%\‘\”\�\'\`…\]\[\&\’»«]'
|
|
|
90 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
91 |
|
92 |
# Preprocessing the datasets.
|
|
|
105 |
inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
|
106 |
|
107 |
with torch.no_grad():
|
108 |
+
logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits
|
109 |
|
110 |
pred_ids = torch.argmax(logits, dim=-1)
|
111 |
batch["pred_strings"] = processor.batch_decode(pred_ids)
|