nguyenvulebinh commited on
Commit
b240351
1 Parent(s): 5d70e26

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -0
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: vi
3
+ datasets:
4
+ - vlsp-asr-2020
5
+ tags:
6
+ - audio
7
+ - automatic-speech-recognition
8
+ license: cc-by-nc-4.0
9
+ ---
10
+
11
+ ## Model description
12
+
13
+ Our models use wav2vec2 architecture, pre-trained on 13k hours of Vietnamese youtube audio (un-label data) and fine-tuned on 250 hours labeled of VLSP ASR dataset on 16kHz sampled speech audio. You can find more description [here](https://github.com/nguyenvulebinh/vietnamese-wav2vec2)
14
+
15
+ ## Benchmark WER result on VLSP T1 testset:
16
+
17
+ | | [base model](https://huggingface.co/nguyenvulebinh/wav2vec2-base-vi-vlsp2020) | [large model](https://huggingface.co/nguyenvulebinh/wav2vec2-base-vi-vlsp2020) |
18
+ |---|---|---|
19
+ |without LM| 8.66 | 6.90 |
20
+ |with 5-grams LM| 6.53 | 5.32 |
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ #pytorch
26
+ #!pip install transformers==4.20.0
27
+ #!pip install https://github.com/kpu/kenlm/archive/master.zip
28
+ #!pip install pyctcdecode==0.4.0
29
+ from transformers.file_utils import cached_path, hf_bucket_url
30
+ from importlib.machinery import SourceFileLoader
31
+ from transformers import Wav2Vec2ProcessorWithLM
32
+ from IPython.lib.display import Audio
33
+ import torchaudio
34
+ import torch
35
+
36
+ # Load model & processor
37
+ model_name = "nguyenvulebinh/wav2vec2-base-vi-vlsp2020"
38
+ model = SourceFileLoader("model", cached_path(hf_bucket_url(model_name,filename="model_handling.py"))).load_module().Wav2Vec2ForCTC.from_pretrained(model_name)
39
+ processor = Wav2Vec2ProcessorWithLM.from_pretrained(model_name)
40
+
41
+ # Load an example audio (16k)
42
+ audio, sample_rate = torchaudio.load(cached_path(hf_bucket_url(model_name, filename="t2_0000006682.wav")))
43
+ input_data = processor.feature_extractor(audio[0], sampling_rate=16000, return_tensors='pt')
44
+
45
+ # Infer
46
+ output = model(**input_data)
47
+
48
+ # Output transcript without LM
49
+ print(processor.tokenizer.decode(output.logits.argmax(dim=-1)[0].detach().cpu().numpy()))
50
+
51
+ # Output transcript with LM
52
+ print(processor.decode(output.logits.cpu().detach().numpy()[0], beam_width=100).text)
53
+ ```
54
+
55
+ ### Model Parameters License
56
+
57
+ The ASR model parameters are made available for non-commercial use only, under the terms of the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. You can find details at: https://creativecommons.org/licenses/by-nc/4.0/legalcode
58
+
59
+
60
+ ### Contact
61
+
62
+ nguyenvulebinh@gmail.com
63
+
64
+ [![Follow](https://img.shields.io/twitter/follow/nguyenvulebinh?style=social)](https://twitter.com/intent/follow?screen_name=nguyenvulebinh)