ceyda commited on
Commit
4d23aff
1 Parent(s): 7f8931b

Update README.md

Browse files

fix chars_to_ignore_regex

Files changed (1) hide show
  1. README.md +2 -3
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
- # chars_to_ignore_regex = '[\\\\,\\\\?\\\\.\\\\!\\\\-\\\\;\\\\:\\\\"\\\\“]'
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
- 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)
 
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)