Galuh commited on
Commit
5a6222d
1 Parent(s): 9fdc306

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -3
README.md CHANGED
@@ -86,7 +86,7 @@ processor = Wav2Vec2Processor.from_pretrained("Galuh/wav2vec2-large-xlsr-indones
86
  model = Wav2Vec2ForCTC.from_pretrained("Galuh/wav2vec2-large-xlsr-indonesian")
87
  model.to("cuda")
88
 
89
- chars_to_ignore_regex = '[\\\\\\\\,\\\\\\\\?\\\\\\\\.\\\\\\\\!\\\\\\\\-\\\\\\\\;\\\\\\\\:\\\\\\\\"\\\\\\\\“]'
90
 
91
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
92
 
@@ -95,6 +95,7 @@ resampler = torchaudio.transforms.Resample(48_000, 16_000)
95
  def speech_file_to_array_fn(batch):
96
  batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
97
  speech_array, sampling_rate = torchaudio.load(batch["path"])
 
98
  batch["speech"] = resampler(speech_array).squeeze().numpy()
99
  return batch
100
 
@@ -108,7 +109,7 @@ def evaluate(batch):
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)
113
  return batch
114
 
@@ -117,7 +118,7 @@ result = test_dataset.map(evaluate, batched=True, batch_size=8)
117
  print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
118
  ```
119
 
120
- **Test Result**: 21.07 %
121
 
122
  ## Training
123
 
86
  model = Wav2Vec2ForCTC.from_pretrained("Galuh/wav2vec2-large-xlsr-indonesian")
87
  model.to("cuda")
88
 
89
+ chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“\%\‘\'\”\�]'
90
 
91
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
92
 
95
  def speech_file_to_array_fn(batch):
96
  batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
97
  speech_array, sampling_rate = torchaudio.load(batch["path"])
98
+ resampler = torchaudio.transforms.Resample(sampling_rate, 16_000)
99
  batch["speech"] = resampler(speech_array).squeeze().numpy()
100
  return batch
101
 
109
  with torch.no_grad():
110
  logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits
111
 
112
+ pred_ids = torch.argmax(logits, dim=-1)
113
  batch["pred_strings"] = processor.batch_decode(pred_ids)
114
  return batch
115
 
118
  print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
119
  ```
120
 
121
+ **Test Result**: 18.32 %
122
 
123
  ## Training
124