anuragshas
commited on
Commit
Β·
d77045a
1
Parent(s):
128e98a
Update README.md
Browse files
README.md
CHANGED
@@ -66,14 +66,14 @@ wer = load_metric("wer")
|
|
66 |
processor = Wav2Vec2Processor.from_pretrained("anuragshas/wav2vec2-large-xlsr-53-rm-vallader")
|
67 |
model = Wav2Vec2ForCTC.from_pretrained("anuragshas/wav2vec2-large-xlsr-53-rm-vallader")
|
68 |
model.to("cuda")
|
69 |
-
chars_to_ignore_regex = '[
|
70 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
71 |
# Preprocessing the datasets.
|
72 |
# We need to read the aduio files as arrays
|
73 |
def speech_file_to_array_fn(batch):
|
74 |
batch["sentence"] = re.sub('β ',' ',batch["sentence"])
|
75 |
batch["sentence"] = re.sub(' β',' ',batch["sentence"])
|
76 |
-
batch["sentence"] = re.sub('β|β','
|
77 |
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
|
78 |
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
79 |
batch["speech"] = resampler(speech_array).squeeze().numpy()
|
|
|
66 |
processor = Wav2Vec2Processor.from_pretrained("anuragshas/wav2vec2-large-xlsr-53-rm-vallader")
|
67 |
model = Wav2Vec2ForCTC.from_pretrained("anuragshas/wav2vec2-large-xlsr-53-rm-vallader")
|
68 |
model.to("cuda")
|
69 |
+
chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\β\%\β\β\β\β¦\Β«\Β»]'
|
70 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
71 |
# Preprocessing the datasets.
|
72 |
# We need to read the aduio files as arrays
|
73 |
def speech_file_to_array_fn(batch):
|
74 |
batch["sentence"] = re.sub('β ',' ',batch["sentence"])
|
75 |
batch["sentence"] = re.sub(' β',' ',batch["sentence"])
|
76 |
+
batch["sentence"] = re.sub('β|β','\'',batch["sentence"])
|
77 |
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
|
78 |
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
79 |
batch["speech"] = resampler(speech_array).squeeze().numpy()
|