cahya commited on
Commit
256701e
1 Parent(s): 837012a

updated the readme with corret resampler und new wer

Browse files
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -23,7 +23,7 @@ model-index:
23
  metrics:
24
  - name: Test WER
25
  type: wer
26
- value: 22.26
27
  ---
28
 
29
  # Wav2Vec2-Large-XLSR-Indonesian
@@ -47,12 +47,12 @@ test_dataset = load_dataset("common_voice", "id", split="test[:2%]")
47
  processor = Wav2Vec2Processor.from_pretrained("cahya/wav2vec2-large-xlsr-indonesian")
48
  model = Wav2Vec2ForCTC.from_pretrained("cahya/wav2vec2-large-xlsr-indonesian")
49
 
50
- resampler = torchaudio.transforms.Resample(48_000, 16_000)
51
 
52
  # Preprocessing the datasets.
53
  # We need to read the aduio files as arrays
54
  def speech_file_to_array_fn(batch):
55
  speech_array, sampling_rate = torchaudio.load(batch["path"])
 
56
  batch["speech"] = resampler(speech_array).squeeze().numpy()
57
  return batch
58
 
@@ -89,13 +89,13 @@ model.to("cuda")
89
 
90
  chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“\%\‘\'\”\�]'
91
 
92
- resampler = torchaudio.transforms.Resample(48_000, 16_000)
93
 
94
  # Preprocessing the datasets.
95
  # We need to read the aduio files as arrays
96
  def speech_file_to_array_fn(batch):
97
  batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
98
  speech_array, sampling_rate = torchaudio.load(batch["path"])
 
99
  batch["speech"] = resampler(speech_array).squeeze().numpy()
100
  return batch
101
 
@@ -118,7 +118,7 @@ result = test_dataset.map(evaluate, batched=True, batch_size=8)
118
  print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
119
  ```
120
 
121
- **Test Result**: 22.26 %
122
 
123
  ## Training
124
 
 
23
  metrics:
24
  - name: Test WER
25
  type: wer
26
+ value: 19.37
27
  ---
28
 
29
  # Wav2Vec2-Large-XLSR-Indonesian
 
47
  processor = Wav2Vec2Processor.from_pretrained("cahya/wav2vec2-large-xlsr-indonesian")
48
  model = Wav2Vec2ForCTC.from_pretrained("cahya/wav2vec2-large-xlsr-indonesian")
49
 
 
50
 
51
  # Preprocessing the datasets.
52
  # We need to read the aduio files as arrays
53
  def speech_file_to_array_fn(batch):
54
  speech_array, sampling_rate = torchaudio.load(batch["path"])
55
+ resampler = torchaudio.transforms.Resample(sampling_rate, 16_000)
56
  batch["speech"] = resampler(speech_array).squeeze().numpy()
57
  return batch
58
 
 
89
 
90
  chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“\%\‘\'\”\�]'
91
 
 
92
 
93
  # Preprocessing the datasets.
94
  # We need to read the aduio files as arrays
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
 
 
118
  print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
119
  ```
120
 
121
+ **Test Result**: 19.37 %
122
 
123
  ## Training
124