model upd
Browse files- README.md +9 -5
- pytorch_model.bin +1 -1
README.md
CHANGED
@@ -45,14 +45,13 @@ test_dataset = load_dataset("common_voice", "uk", split="test[:2%]")
|
|
45 |
|
46 |
processor = Wav2Vec2Processor.from_pretrained("arampacha/wav2vec2-large-xlsr-ukrainian")
|
47 |
model = Wav2Vec2ForCTC.from_pretrained("arampacha/wav2vec2-large-xlsr-ukrainian")
|
48 |
-
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
49 |
|
50 |
# Preprocessing the datasets.
|
51 |
# We need to read the aduio files as arrays
|
52 |
|
53 |
def speech_file_to_array_fn(batch):
|
54 |
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
55 |
-
batch["speech"] =
|
56 |
return batch
|
57 |
|
58 |
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
@@ -92,13 +91,18 @@ chars_to_ignore_regex = f'[{"".join(chars_to_ignore)}]'
|
|
92 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
93 |
|
94 |
# Preprocessing the datasets.
|
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().strip()
|
98 |
batch["sentence"] = re.sub(re.compile('i'), 'і', batch['sentence'])
|
|
|
|
|
|
|
|
|
|
|
99 |
batch['sentence'] = re.sub(' ', ' ', batch['sentence'])
|
100 |
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
101 |
-
batch["speech"] =
|
102 |
return batch
|
103 |
|
104 |
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
|
|
45 |
|
46 |
processor = Wav2Vec2Processor.from_pretrained("arampacha/wav2vec2-large-xlsr-ukrainian")
|
47 |
model = Wav2Vec2ForCTC.from_pretrained("arampacha/wav2vec2-large-xlsr-ukrainian")
|
|
|
48 |
|
49 |
# Preprocessing the datasets.
|
50 |
# We need to read the aduio files as arrays
|
51 |
|
52 |
def speech_file_to_array_fn(batch):
|
53 |
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
54 |
+
batch["speech"] = torchaudio.transforms.Resample(sampling_rate, 16_000)(speech_array).squeeze().numpy()
|
55 |
return batch
|
56 |
|
57 |
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
|
|
91 |
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
92 |
|
93 |
# Preprocessing the datasets.
|
94 |
+
# We need to read the aduio files as arrays and normalize charecters
|
95 |
def speech_file_to_array_fn(batch):
|
96 |
+
batch["sentence"] = re.sub(re.compile(chars_to_ignore_regex), '', batch["sentence"]).lower().strip()
|
97 |
batch["sentence"] = re.sub(re.compile('i'), 'і', batch['sentence'])
|
98 |
+
batch["sentence"] = re.sub(re.compile('o'), 'о', batch['sentence'])
|
99 |
+
batch["sentence"] = re.sub(re.compile('a'), 'а', batch['sentence'])
|
100 |
+
batch["sentence"] = re.sub(re.compile('ы'), 'и', batch['sentence'])
|
101 |
+
batch["sentence"] = re.sub(re.compile("['`]"), '’', batch['sentence'])
|
102 |
+
batch["sentence"] = re.sub(re.compile("–"), '', batch['sentence'])
|
103 |
batch['sentence'] = re.sub(' ', ' ', batch['sentence'])
|
104 |
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
105 |
+
batch["speech"] = torchaudio.transforms.Resample(sampling_rate, 16_000)(speech_array).squeeze().numpy()
|
106 |
return batch
|
107 |
|
108 |
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 1262118359
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:045342a8ae4fc38f2e579a7d22a977235dc905eecb3eae4004b38d1a45835fbb
|
3 |
size 1262118359
|