nguyenvulebinh commited on
Commit
b027e24
1 Parent(s): 0a5c13e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +57 -2
README.md CHANGED
@@ -13,7 +13,7 @@ license: cc-by-nc-4.0
13
 
14
  We use wav2vec2 architecture for doing Self-Supervised learning
15
 
16
- <img src="https://raw.githubusercontent.com/patrickvonplaten/scientific_images/master/wav2vec2.png" width=50% height=50%>
17
 
18
  ## Data
19
 
@@ -22,10 +22,12 @@ Our self-supervised model is pre-trained on a massive audio set of 13k hours of
22
  - Noise audio
23
  - Conversation
24
  - Multi-gender and dialects
 
25
 
26
  ## Download
27
 
28
- We have already upload our pre-trained model to the Huggingface.
 
29
  - [Based version](https://huggingface.co/nguyenvulebinh/wav2vec2-base-vi) ~ 95M params
30
  - [Large version](https://huggingface.co/nguyenvulebinh/wav2vec2-large-vi) ~ 317M params
31
 
@@ -44,6 +46,56 @@ processor = Wav2Vec2Processor.from_pretrained(model_name)
44
 
45
  Since our model has the same architecture as the English wav2vec2 version, you can use [this notebook](https://colab.research.google.com/drive/1FjTsqbYKphl9kL-eILgUc-bl4zVThL8F?usp=sharing) for more information on how to fine-tune the model.
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  ## Contact
48
 
49
  nguyenvulebinh@gmail.com / binh@vietai.org
@@ -51,3 +103,6 @@ nguyenvulebinh@gmail.com / binh@vietai.org
51
  [![Follow](https://img.shields.io/twitter/follow/nguyenvulebinh?style=social)](https://twitter.com/intent/follow?screen_name=nguyenvulebinh)
52
 
53
 
 
 
 
 
13
 
14
  We use wav2vec2 architecture for doing Self-Supervised learning
15
 
16
+ <img src="https://raw.githubusercontent.com/patrickvonplaten/scientific_images/master/wav2vec2.png" width=75% height=75%>
17
 
18
  ## Data
19
 
 
22
  - Noise audio
23
  - Conversation
24
  - Multi-gender and dialects
25
+
26
 
27
  ## Download
28
 
29
+ We have already upload our pre-trained model to the Huggingface. The base model trained 35 epochs and the large model trained 20 epochs in about 30 days using TPU V3-8.
30
+
31
  - [Based version](https://huggingface.co/nguyenvulebinh/wav2vec2-base-vi) ~ 95M params
32
  - [Large version](https://huggingface.co/nguyenvulebinh/wav2vec2-large-vi) ~ 317M params
33
 
 
46
 
47
  Since our model has the same architecture as the English wav2vec2 version, you can use [this notebook](https://colab.research.google.com/drive/1FjTsqbYKphl9kL-eILgUc-bl4zVThL8F?usp=sharing) for more information on how to fine-tune the model.
48
 
49
+ ## Finetuned version
50
+
51
+ ### VLSP 2020 ASR dataset
52
+
53
+ Benchmark WER result on VLSP T1 testset:
54
+
55
+ | | [base model](https://huggingface.co/nguyenvulebinh/wav2vec2-base-vi-vlsp2020) | [large model](https://huggingface.co/nguyenvulebinh/wav2vec2-large-vi-vlsp2020) |
56
+ |---|---|---|
57
+ |without LM| 8.66 | 6.90 |
58
+ |with 5-grams LM| 6.53 | 5.32 |
59
+
60
+ Usage
61
+
62
+ ```python
63
+ #pytorch
64
+ #!pip install transformers==4.20.0
65
+ #!pip install https://github.com/kpu/kenlm/archive/master.zip
66
+ #!pip install pyctcdecode==0.4.0
67
+ from transformers.file_utils import cached_path, hf_bucket_url
68
+ from importlib.machinery import SourceFileLoader
69
+ from transformers import Wav2Vec2ProcessorWithLM
70
+ from IPython.lib.display import Audio
71
+ import torchaudio
72
+ import torch
73
+
74
+ # Load model & processor
75
+ model_name = "nguyenvulebinh/wav2vec2-base-vi-vlsp2020"
76
+ # model_name = "nguyenvulebinh/wav2vec2-large-vi-vlsp2020"
77
+ model = SourceFileLoader("model", cached_path(hf_bucket_url(model_name,filename="model_handling.py"))).load_module().Wav2Vec2ForCTC.from_pretrained(model_name)
78
+ processor = Wav2Vec2ProcessorWithLM.from_pretrained(model_name)
79
+
80
+ # Load an example audio (16k)
81
+ audio, sample_rate = torchaudio.load(cached_path(hf_bucket_url(model_name, filename="t2_0000006682.wav")))
82
+ input_data = processor.feature_extractor(audio[0], sampling_rate=16000, return_tensors='pt')
83
+
84
+ # Infer
85
+ output = model(**input_data)
86
+
87
+ # Output transcript without LM
88
+ print(processor.tokenizer.decode(output.logits.argmax(dim=-1)[0].detach().cpu().numpy()))
89
+
90
+ # Output transcript with LM
91
+ print(processor.decode(output.logits.cpu().detach().numpy()[0], beam_width=100).text)
92
+ ```
93
+
94
+ ## Acknowledgment
95
+
96
+ - We would like to thank the Google TPU Research Cloud (TRC) program and Soonson Kwon (Google ML Ecosystem programs Lead) for their support.
97
+ - Special thanks to my colleagues at [VietAI](https://vietai.org/) and [VAIS](https://vais.vn/) for their advice.
98
+
99
  ## Contact
100
 
101
  nguyenvulebinh@gmail.com / binh@vietai.org
 
103
  [![Follow](https://img.shields.io/twitter/follow/nguyenvulebinh?style=social)](https://twitter.com/intent/follow?screen_name=nguyenvulebinh)
104
 
105
 
106
+
107
+
108
+