Gobee commited on
Commit
93616ae
·
1 Parent(s): eb8cb9e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -5
README.md CHANGED
@@ -49,10 +49,11 @@ model = Wav2Vec2ForCTC.from_pretrained("Gobee/Wav2vec2-Large-XLSR-Tamil")
49
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
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
- batch["speech"] = resampler(speech_array).squeeze().numpy()
 
56
  return batch
57
 
58
  test_dataset = test_dataset.map(speech_file_to_array_fn)
@@ -94,8 +95,8 @@ resampler = torchaudio.transforms.Resample(48_000, 16_000)
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
- batch["speech"] = resampler(speech_array).squeeze().numpy()
99
  return batch
100
 
101
  test_dataset = test_dataset.map(speech_file_to_array_fn)
 
49
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
50
 
51
  # Preprocessing the datasets.
52
+ # We need to read the audio files as arrays
53
  def speech_file_to_array_fn(batch):
54
+ speech_array, sampling_rate = librosa.load(batch["path"], sr=16_000)
55
+ batch["speech"] = speech_array
56
+ batch["sentence"] = batch["sentence"].upper()
57
  return batch
58
 
59
  test_dataset = test_dataset.map(speech_file_to_array_fn)
 
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 = librosa.load(batch["path"], sr=16_000)
99
+ batch["speech"] = speech_array
100
  return batch
101
 
102
  test_dataset = test_dataset.map(speech_file_to_array_fn)