ayameRushia commited on
Commit
076c8eb
1 Parent(s): eba1b85

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -2
README.md CHANGED
@@ -64,15 +64,17 @@ wer = load_metric("wer")
64
  processor = Wav2Vec2Processor.from_pretrained("ayameRushia/wav2vec2-large-xlsr-indonesia-demo")
65
  model = Wav2Vec2ForCTC.from_pretrained("ayameRushia/wav2vec2-large-xlsr-indonesia-demo")
66
  model.to("cuda")
67
- chars_to_ignore_regex = '[\\,\\?\\.\\!\\-\\;\\:\\"\\“]'
68
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
69
  # Preprocessing the datasets.
70
  # We need to read the aduio files as arrays
71
  def speech_file_to_array_fn(batch):
72
  batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
73
  speech_array, sampling_rate = torchaudio.load(batch["path"])
 
74
  batch["speech"] = resampler(speech_array).squeeze().numpy()
75
  return batch
 
76
  test_dataset = test_dataset.map(speech_file_to_array_fn)
77
  # Preprocessing the datasets.
78
  # We need to read the aduio files as arrays
@@ -87,6 +89,6 @@ result = test_dataset.map(evaluate, batched=True, batch_size=8)
87
  print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
88
  ```
89
  **Test Result**:
90
- WER = 22.43 %
91
  ## Training
92
  Training using common voice dataset
 
64
  processor = Wav2Vec2Processor.from_pretrained("ayameRushia/wav2vec2-large-xlsr-indonesia-demo")
65
  model = Wav2Vec2ForCTC.from_pretrained("ayameRushia/wav2vec2-large-xlsr-indonesia-demo")
66
  model.to("cuda")
67
+ chars_to_ignore_regex = '[\\\\,\\\\?\\\\.\\\\!\\\\-\\\\;\\\\:\\\\"\\\\“]'
68
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
69
  # Preprocessing the datasets.
70
  # We need to read the aduio files as arrays
71
  def speech_file_to_array_fn(batch):
72
  batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
73
  speech_array, sampling_rate = torchaudio.load(batch["path"])
74
+ resampler = torchaudio.transforms.Resample(sampling_rate, 16_000)
75
  batch["speech"] = resampler(speech_array).squeeze().numpy()
76
  return batch
77
+
78
  test_dataset = test_dataset.map(speech_file_to_array_fn)
79
  # Preprocessing the datasets.
80
  # We need to read the aduio files as arrays
 
89
  print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
90
  ```
91
  **Test Result**:
92
+ WER = 19.830319 %
93
  ## Training
94
  Training using common voice dataset