Views
No views yet
For the first time that learning powerful representations from speech audio alone followed by fine-tuning on transcribed speech can outperform the best semi-supervised methods while being conceptually simpler.
| Model | #params | Pre-training data | Fine-tune data |
|---|---|---|---|
| base | 95M | 13k hours | 250 hours |
| VIVOS | COMMON VOICE VI | VLSP-T1 | VLSP-T2 | |
|---|---|---|---|---|
| without LM | 10.77 | 18.34 | 13.33 | 51.45 |
| with 4-grams LM | 6.15 | 11.52 | 9.11 | 40.81 |
1from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
2from datasets import load_dataset
3import soundfile as sf
4import torch
5
6# load model and tokenizer
7processor = Wav2Vec2Processor.from_pretrained("nguyenvulebinh/wav2vec2-base-vietnamese-250h")
8model = Wav2Vec2ForCTC.from_pretrained("nguyenvulebinh/wav2vec2-base-vietnamese-250h")
9
10# define function to read in sound file
11def map_to_array(batch):
12 speech, _ = sf.read(batch["file"])
13 batch["speech"] = speech
14 return batch
15
16# load dummy dataset and read soundfiles
17ds = map_to_array({
18 "file": 'audio-test/t1_0001-00010.wav'
19})
20
21# tokenize
22input_values = processor(ds["speech"], return_tensors="pt", padding="longest").input_values # Batch size 1
23
24# retrieve logits
25logits = model(input_values).logits
26
27# take argmax and decode
28predicted_ids = torch.argmax(logits, dim=-1)
29transcription = processor.batch_decode(predicted_ids)1@misc{Thai_Binh_Nguyen_wav2vec2_vi_2021,
2 author = {Thai Binh Nguyen},
3 doi = {10.5281/zenodo.5356039},
4 month = {09},
5 title = {{Vietnamese end-to-end speech recognition using wav2vec 2.0}},
6 url = {https://github.com/vietai/ASR},
7 year = {2021}
8}