Commit
Β·
128e98a
1
Parent(s):
529344d
Update README.md
Browse files
README.md
CHANGED
@@ -25,7 +25,7 @@ model-index:
|
|
25 |
type: wer
|
26 |
value: 32.89
|
27 |
---
|
28 |
-
# Wav2Vec2-Large-XLSR-53-
|
29 |
Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Romansh Vallader using the [Common Voice](https://huggingface.co/datasets/common_voice).
|
30 |
When using this model, make sure that your speech input is sampled at 16kHz.
|
31 |
## Usage
|
@@ -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()
|
|
|
25 |
type: wer
|
26 |
value: 32.89
|
27 |
---
|
28 |
+
# Wav2Vec2-Large-XLSR-53-Romansh Vallader
|
29 |
Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Romansh Vallader using the [Common Voice](https://huggingface.co/datasets/common_voice).
|
30 |
When using this model, make sure that your speech input is sampled at 16kHz.
|
31 |
## Usage
|
|
|
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()
|