jimregan commited on
Commit
1e90d22
1 Parent(s): b68ae7b
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -40,7 +40,7 @@ processor = Wav2Vec2Processor.from_pretrained("jimregan/wav2vec2-large-xlsr-iris
40
  model = Wav2Vec2ForCTC.from_pretrained("jimregan/wav2vec2-large-xlsr-irish-basic")
41
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
42
  # Preprocessing the datasets.
43
- # We need to read the aduio files as arrays
44
  def speech_file_to_array_fn(batch):
45
  speech_array, sampling_rate = torchaudio.load(batch["path"])
46
  batch["speech"] = resampler(speech_array).squeeze().numpy()
@@ -90,15 +90,15 @@ def remove_special_characters(batch):
90
  return batch
91
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
92
  # Preprocessing the datasets.
93
- # We need to read the aduio files as arrays
94
  def speech_file_to_array_fn(batch):
95
- batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
96
  speech_array, sampling_rate = torchaudio.load(batch["path"])
97
  batch["speech"] = resampler(speech_array).squeeze().numpy()
98
  return batch
99
  test_dataset = test_dataset.map(speech_file_to_array_fn)
100
  # Preprocessing the datasets.
101
- # We need to read the aduio files as arrays
102
  def evaluate(batch):
103
  inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
104
  with torch.no_grad():
40
  model = Wav2Vec2ForCTC.from_pretrained("jimregan/wav2vec2-large-xlsr-irish-basic")
41
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
42
  # Preprocessing the datasets.
43
+ # We need to read the audio files as arrays
44
  def speech_file_to_array_fn(batch):
45
  speech_array, sampling_rate = torchaudio.load(batch["path"])
46
  batch["speech"] = resampler(speech_array).squeeze().numpy()
90
  return batch
91
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
92
  # Preprocessing the datasets.
93
+ # We need to read the audio files as arrays
94
  def speech_file_to_array_fn(batch):
95
+ batch["sentence"] = remove_special_characters(batch)
96
  speech_array, sampling_rate = torchaudio.load(batch["path"])
97
  batch["speech"] = resampler(speech_array).squeeze().numpy()
98
  return batch
99
  test_dataset = test_dataset.map(speech_file_to_array_fn)
100
  # Preprocessing the datasets.
101
+ # We need to read the audio files as arrays
102
  def evaluate(batch):
103
  inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
104
  with torch.no_grad():