gorkemgoknar commited on
Commit
cc4e759
1 Parent(s): 854cbad

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -5
README.md CHANGED
@@ -43,13 +43,13 @@ resampler = torchaudio.transforms.Resample(48_000, 16_000)
43
  # Preprocessing the datasets.
44
  # We need to read the aduio files as arrays
45
  def speech_file_to_array_fn(batch):
46
- \tspeech_array, sampling_rate = torchaudio.load(batch["path"])
47
- \tbatch["speech"] = resampler(speech_array).squeeze().numpy()
48
- \treturn batch
49
  test_dataset = test_dataset.map(speech_file_to_array_fn)
50
  inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)
51
  with torch.no_grad():
52
- \tlogits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
53
  predicted_ids = torch.argmax(logits, dim=-1)
54
  print("Prediction:", processor.batch_decode(predicted_ids))
55
  print("Reference:", test_dataset["sentence"][:2])
@@ -69,7 +69,7 @@ model = Wav2Vec2ForCTC.from_pretrained("ozcangundes/wav2vec2-large-xlsr-53-turki
69
  model.to("cuda")
70
 
71
  #Note: Not ignoring "'" on this one
72
- chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“\%\‘\”\�]'
73
 
74
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
75
  # Preprocessing the datasets.
 
43
  # Preprocessing the datasets.
44
  # We need to read the aduio files as arrays
45
  def speech_file_to_array_fn(batch):
46
+ speech_array, sampling_rate = torchaudio.load(batch["path"])
47
+ batch["speech"] = resampler(speech_array).squeeze().numpy()
48
+ return batch
49
  test_dataset = test_dataset.map(speech_file_to_array_fn)
50
  inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)
51
  with torch.no_grad():
52
+ logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
53
  predicted_ids = torch.argmax(logits, dim=-1)
54
  print("Prediction:", processor.batch_decode(predicted_ids))
55
  print("Reference:", test_dataset["sentence"][:2])
 
69
  model.to("cuda")
70
 
71
  #Note: Not ignoring "'" on this one
72
+ chars_to_ignore_regex = '[\\,\\?\\.\\!\\-\\;\\:\\"\\“\\%\\‘\\”\\�]'
73
 
74
  resampler = torchaudio.transforms.Resample(48_000, 16_000)
75
  # Preprocessing the datasets.