mrm8488 commited on
Commit
5785c19
1 Parent(s): 9e239e1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -5
README.md CHANGED
@@ -84,16 +84,16 @@ processor = Wav2Vec2Processor.from_pretrained("mrm8488/wav2vec2-large-xlsr-53-eu
84
  model = Wav2Vec2ForCTC.from_pretrained("mrm8488/wav2vec2-large-xlsr-53-euskera")
85
  model.to("cuda")
86
 
87
- chars_to_ignore_regex = '[\\\\\\\\\\\\\\\\,\\\\\\\\\\\\\\\\?\\\\\\\\\\\\\\\\.\\\\\\\\\\\\\\\\!\\\\\\\\\\\\\\\\-\\\\\\\\\\\\\\\\;\\\\\\\\\\\\\\\\:\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\“]'
88
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
89
 
90
  # Preprocessing the datasets.
91
  # We need to read the aduio files as arrays
92
  def speech_file_to_array_fn(batch):
93
- \\\\\\\\tbatch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
94
- \\\\\\\\tspeech_array, sampling_rate = torchaudio.load(batch["path"])
95
- \\\\\\\\tbatch["speech"] = resampler(speech_array).squeeze().numpy()
96
- \\\\\\\\treturn batch
97
 
98
  test_dataset = test_dataset.map(speech_file_to_array_fn)
99
 
84
  model = Wav2Vec2ForCTC.from_pretrained("mrm8488/wav2vec2-large-xlsr-53-euskera")
85
  model.to("cuda")
86
 
87
+ chars_to_ignore_regex = '[\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\,\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\.\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\!\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\-\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\“]'
88
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
89
 
90
  # Preprocessing the datasets.
91
  # We need to read the aduio files as arrays
92
  def speech_file_to_array_fn(batch):
93
+ batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
94
+ speech_array, sampling_rate = torchaudio.load(batch["path"])
95
+ batch["speech"] = resampler(speech_array).squeeze().numpy()
96
+ return batch
97
 
98
  test_dataset = test_dataset.map(speech_file_to_array_fn)
99