speech-test
commited on
Commit
•
52cd932
1
Parent(s):
8284447
Flexible resampling, just in case
Browse files
README.md
CHANGED
@@ -82,7 +82,7 @@ from tqdm.auto import tqdm
|
|
82 |
from datasets import load_metric
|
83 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
84 |
|
85 |
-
# Download the raw data instead of using HF datasets to save space
|
86 |
data_url = "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-6.1-2020-12-11/sah.tar.gz"
|
87 |
filestream = urllib.request.urlopen(data_url)
|
88 |
data_file = tarfile.open(fileobj=filestream, mode="r|gz")
|
@@ -105,14 +105,13 @@ def clean_sentence(sent):
|
|
105 |
sent = " ".join(sent.split())
|
106 |
return sent
|
107 |
|
108 |
-
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
109 |
-
|
110 |
targets = []
|
111 |
preds = []
|
112 |
|
113 |
for i, row in tqdm(cv_test.iterrows(), total=cv_test.shape[0]):
|
114 |
row["sentence"] = clean_sentence(row["sentence"])
|
115 |
speech_array, sampling_rate = torchaudio.load(clips_path + row["path"])
|
|
|
116 |
row["speech"] = resampler(speech_array).squeeze().numpy()
|
117 |
|
118 |
inputs = processor(row["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
|
@@ -135,4 +134,3 @@ print("WER: {:2f}".format(100 * wer.compute(predictions=preds, references=target
|
|
135 |
|
136 |
The Common Voice `train` and `validation` datasets were used for training.
|
137 |
|
138 |
-
The script used for training can be found [here](github.com)
|
|
|
82 |
from datasets import load_metric
|
83 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
84 |
|
85 |
+
# Download the raw data instead of using HF datasets to save disk space
|
86 |
data_url = "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-6.1-2020-12-11/sah.tar.gz"
|
87 |
filestream = urllib.request.urlopen(data_url)
|
88 |
data_file = tarfile.open(fileobj=filestream, mode="r|gz")
|
|
|
105 |
sent = " ".join(sent.split())
|
106 |
return sent
|
107 |
|
|
|
|
|
108 |
targets = []
|
109 |
preds = []
|
110 |
|
111 |
for i, row in tqdm(cv_test.iterrows(), total=cv_test.shape[0]):
|
112 |
row["sentence"] = clean_sentence(row["sentence"])
|
113 |
speech_array, sampling_rate = torchaudio.load(clips_path + row["path"])
|
114 |
+
resampler = torchaudio.transforms.Resample(sampling_rate, 16_000)
|
115 |
row["speech"] = resampler(speech_array).squeeze().numpy()
|
116 |
|
117 |
inputs = processor(row["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
|
|
|
134 |
|
135 |
The Common Voice `train` and `validation` datasets were used for training.
|
136 |
|
|