Mirco commited on
Commit
dcc7665
1 Parent(s): b2509e1

model upload

Browse files
.gitattributes CHANGED
@@ -25,3 +25,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ asr.ckpt filter=lfs diff=lfs merge=lfs -text
29
+ tokenizer.ckpt filter=lfs diff=lfs merge=lfs -text
30
+ wav2vec2.ckpt filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: "wo"
3
+ thumbnail:
4
+ pipeline_tag: automatic-speech-recognition
5
+ tags:
6
+ - CTC
7
+ - pytorch
8
+ - speechbrain
9
+ - Transformer
10
+ license: "apache-2.0"
11
+ datasets:
12
+ - commonvoice
13
+ metrics:
14
+ - wer
15
+ - cer
16
+ ---
17
+
18
+ <iframe src="https://ghbtns.com/github-btn.html?user=speechbrain&repo=speechbrain&type=star&count=true&size=large&v=2" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
19
+ <br/><br/>
20
+
21
+ # wav2vec 2.0 with CTC/Attention trained on DVoice Wolof (No LM)
22
+ This repository provides all the necessary tools to perform automatic speech
23
+ recognition from an end-to-end system pretrained on a [ALFFA](https://github.com/besacier/ALFFA_PUBLIC) Wolof dataset within
24
+ SpeechBrain. For a better experience, we encourage you to learn more about
25
+ [SpeechBrain](https://speechbrain.github.io).
26
+
27
+ | DVoice Release | Val. CER | Val. WER | Test CER | Test WER |
28
+ |:-------------:|:---------------------------:| -----:| -----:| -----:|
29
+ | v2.0 | 4.81 | 16.25 | 4.83 | 16.05 |
30
+
31
+ # Pipeline description
32
+ This ASR system is composed of 2 different but linked blocks:
33
+ - Tokenizer (unigram) that transforms words into subword units and trained with
34
+ the train transcriptions.
35
+ - Acoustic model (wav2vec2.0 + CTC). A pretrained wav2vec 2.0 model ([facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53)) is combined with two DNN layers and finetuned on the Darija dataset.
36
+ The obtained final acoustic representation is given to the CTC greedy decoder.
37
+ The system is trained with recordings sampled at 16kHz (single channel).
38
+ The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *transcribe_file* if needed.
39
+
40
+ # Install SpeechBrain
41
+ First of all, please install tranformers and SpeechBrain with the following command:
42
+ ```
43
+ pip install speechbrain transformers
44
+ ```
45
+ Please notice that we encourage you to read the SpeechBrain tutorials and learn more about
46
+ [SpeechBrain](https://speechbrain.github.io).
47
+
48
+ # Transcribing your own audio files (in Wolof)
49
+ ```python
50
+ from speechbrain.pretrained import EncoderASR
51
+ asr_model = EncoderASR.from_hparams(source="aioxlabs/dvoice-wolof", savedir="pretrained_models/asr-wav2vec2-dvoice-wol")
52
+ asr_model.transcribe_file('./the_path_to_your_audio_file')
53
+ ```
54
+
55
+ # Inference on GPU
56
+ To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
57
+
58
+ # Training
59
+ To train the model from scratch, please see our GitHub tutorial [here](https://github.com/AIOXLABS/DVoice).
60
+
61
+ # Limitations
62
+ The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
63
+
64
+ # Referencing SpeechBrain
65
+ ```
66
+ @misc{SB2021,
67
+ author = {Ravanelli, Mirco and Parcollet, Titouan and Rouhe, Aku and Plantinga, Peter and Rastorgueva, Elena and Lugosch, Loren and Dawalatabad, Nauman and Ju-Chieh, Chou and Heba, Abdel and Grondin, Francois and Aris, William and Liao, Chien-Feng and Cornell, Samuele and Yeh, Sung-Lin and Na, Hwidong and Gao, Yan and Fu, Szu-Wei and Subakan, Cem and De Mori, Renato and Bengio, Yoshua },
68
+ title = {SpeechBrain},
69
+ year = {2021},
70
+ publisher = {GitHub},
71
+ journal = {GitHub repository},
72
+ howpublished = {\\\\url{https://github.com/speechbrain/speechbrain}},
73
+ }
74
+ ```
75
+
76
+ # About DVoice
77
+ DVoice is a community initiative that aims to provide Africa low resources languages with data and models to facilitate their use of voice technologies. The lack of data on these languages makes it necessary to collect data using methods that are specific to each one. Two different approaches are currently used: the DVoice platforms ([https://dvoice.ma](https://dvoice.ma) and [https://dvoice.sn](https://dvoice.sn)), which are based on Mozilla Common Voice, for collecting authentic recordings from the community, and transfer learning techniques for automatically labeling recordings that are retrived from social medias. The DVoice platform currently manages 7 languages including Darija (Moroccan Arabic dialect) whose dataset appears on this version, Wolof, Mandingo, Serere, Pular, Diola and Soninke.
78
+
79
+ For this project, AIOX Labs the SI2M Laboratory are joining forces to build the future of technologies together.
80
+
81
+ # About AIOX Labs
82
+ Based in Rabat, London and Paris, AIOX-Labs mobilizes artificial intelligence technologies to meet the business needs and data projects of companies.
83
+
84
+ - He is at the service of the growth of groups, the optimization of processes or the improvement of the customer experience.
85
+ - AIOX-Labs is multi-sector, from fintech to industry, including retail and consumer goods.
86
+ - Business ready data products with a solid algorithmic base and adaptability for the specific needs of each client.
87
+ - A complementary team made up of doctors in AI and business experts with a solid scientific base and international publications.
88
+
89
+ Website: [https://www.aiox-labs.com/](https://www.aiox-labs.com/)
90
+
91
+ # SI2M Laboratory
92
+ The Information Systems, Intelligent Systems and Mathematical Modeling Research Laboratory (SI2M) is an academic research laboratory of the National Institute of Statistics and Applied Economics (INSEA). The research areas of the laboratories are Information Systems, Intelligent Systems, Artificial Intelligence, Decision Support, Network and System Security, Mathematical Modelling.
93
+
94
+ Website: [SI2M Laboratory](https://insea.ac.ma/index.php/pole-recherche/equipe-de-recherche/150-laboratoire-de-recherche-en-systemes-d-information-systemes-intelligents-et-modelisation-mathematique)
95
+
96
+ # About SpeechBrain
97
+ SpeechBrain is an open-source and all-in-one speech toolkit. It is designed to be simple, extremely flexible, and user-friendly. Competitive or state-of-the-art performance is obtained in various domains.
98
+ Website: https://speechbrain.github.io/
99
+ GitHub: https://github.com/speechbrain/speechbrain
100
+
101
+
102
+ # Referencing SpeechBrain
103
+ ```
104
+ @misc{SB2021,
105
+ author = {Ravanelli, Mirco and Parcollet, Titouan and Rouhe, Aku and Plantinga, Peter and Rastorgueva, Elena and Lugosch, Loren and Dawalatabad, Nauman and Ju-Chieh, Chou and Heba, Abdel and Grondin, Francois and Aris, William and Liao, Chien-Feng and Cornell, Samuele and Yeh, Sung-Lin and Na, Hwidong and Gao, Yan and Fu, Szu-Wei and Subakan, Cem and De Mori, Renato and Bengio, Yoshua },
106
+ title = {SpeechBrain},
107
+ year = {2021},
108
+ publisher = {GitHub},
109
+ journal = {GitHub repository},
110
+ howpublished = {\\\\url{https://github.com/speechbrain/speechbrain}},
111
+ }
112
+ ```
113
+ # Acknowledgements
114
+ This research was supported through computational resources of HPC-MARWAN (www.marwan.ma/hpc) provided by CNRST, Rabat, Morocco. We deeply thank this institution.
asr.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cdca73004fbf40674204a68d781a00df48c3df7a7d86990ae9c52c074f81dee
3
+ size 12798880
config.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "speechbrain_interface": "EncoderASR",
3
+ "activation_dropout": 0.0,
4
+ "apply_spec_augment": true,
5
+ "architectures": [
6
+ "Wav2Vec2Model"
7
+ ],
8
+ "attention_dropout": 0.1,
9
+ "bos_token_id": 1,
10
+ "conv_bias": true,
11
+ "conv_dim": [
12
+ 512,
13
+ 512,
14
+ 512,
15
+ 512,
16
+ 512,
17
+ 512,
18
+ 512
19
+ ],
20
+ "conv_kernel": [
21
+ 10,
22
+ 3,
23
+ 3,
24
+ 3,
25
+ 3,
26
+ 2,
27
+ 2
28
+ ],
29
+ "conv_stride": [
30
+ 5,
31
+ 2,
32
+ 2,
33
+ 2,
34
+ 2,
35
+ 2,
36
+ 2
37
+ ],
38
+ "ctc_loss_reduction": "sum",
39
+ "ctc_zero_infinity": false,
40
+ "do_stable_layer_norm": true,
41
+ "eos_token_id": 2,
42
+ "feat_extract_activation": "gelu",
43
+ "feat_extract_dropout": 0.0,
44
+ "feat_extract_norm": "layer",
45
+ "feat_proj_dropout": 0.1,
46
+ "final_dropout": 0.0,
47
+ "gradient_checkpointing": false,
48
+ "hidden_act": "gelu",
49
+ "hidden_dropout": 0.1,
50
+ "hidden_size": 1024,
51
+ "initializer_range": 0.02,
52
+ "intermediate_size": 4096,
53
+ "layer_norm_eps": 1e-05,
54
+ "layerdrop": 0.1,
55
+ "mask_channel_length": 10,
56
+ "mask_channel_min_space": 1,
57
+ "mask_channel_other": 0.0,
58
+ "mask_channel_prob": 0.0,
59
+ "mask_channel_selection": "static",
60
+ "mask_feature_length": 10,
61
+ "mask_feature_prob": 0.0,
62
+ "mask_time_length": 10,
63
+ "mask_time_min_space": 1,
64
+ "mask_time_other": 0.0,
65
+ "mask_time_prob": 0.075,
66
+ "mask_time_selection": "static",
67
+ "model_type": "wav2vec2",
68
+ "num_attention_heads": 16,
69
+ "num_conv_pos_embedding_groups": 16,
70
+ "num_conv_pos_embeddings": 128,
71
+ "num_feat_extract_layers": 7,
72
+ "num_hidden_layers": 24,
73
+ "pad_token_id": 0,
74
+ "transformers_version": "4.5.1",
75
+ "vocab_size": 32
76
+ }
example_wolof.wav ADDED
Binary file (187 kB). View file
 
hyperparams.yaml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ################################
2
+ # Model: wav2vec2 + DNN + CTC/Attention
3
+ # Augmentation: SpecAugment
4
+ # Authors: Titouan Parcollet 2021
5
+ # ################################
6
+
7
+ sample_rate: 16000
8
+ wav2vec2_hub: facebook/wav2vec2-large-xlsr-53
9
+ # wav2vec2_hub: facebook/wav2vec2-xls-r-300m
10
+
11
+ # BPE parameters
12
+ token_type: char # ["unigram", "bpe", "char"]
13
+ character_coverage: 1.0
14
+
15
+ # Model parameters
16
+ activation: !name:torch.nn.LeakyReLU
17
+ dnn_layers: 2
18
+ dnn_neurons: 1024
19
+ emb_size: 128
20
+ dec_neurons: 1024
21
+
22
+ # Outputs
23
+ output_neurons: 36 # BPE size, index(blank/eos/bos) = 0
24
+
25
+ # Decoding parameters
26
+ # Be sure that the bos and eos index match with the BPEs ones
27
+ blank_index: 0
28
+ bos_index: 1
29
+ eos_index: 2
30
+ min_decode_ratio: 0.0
31
+ max_decode_ratio: 1.0
32
+ beam_size: 80
33
+ eos_threshold: 1.5
34
+ using_max_attn_shift: True
35
+ max_attn_shift: 140
36
+ ctc_weight_decode: 0.0
37
+ temperature: 1.50
38
+
39
+ enc: !new:speechbrain.nnet.containers.Sequential
40
+ input_shape: [null, null, 1024]
41
+ linear1: !name:speechbrain.nnet.linear.Linear
42
+ n_neurons: 1024
43
+ bias: True
44
+ bn1: !name:speechbrain.nnet.normalization.BatchNorm1d
45
+ activation: !new:torch.nn.LeakyReLU
46
+ drop: !new:torch.nn.Dropout
47
+ p: 0.15
48
+ linear2: !name:speechbrain.nnet.linear.Linear
49
+ n_neurons: 1024
50
+ bias: True
51
+ bn2: !name:speechbrain.nnet.normalization.BatchNorm1d
52
+ activation2: !new:torch.nn.LeakyReLU
53
+ drop2: !new:torch.nn.Dropout
54
+ p: 0.15
55
+ linear3: !name:speechbrain.nnet.linear.Linear
56
+ n_neurons: 1024
57
+ bias: True
58
+ bn3: !name:speechbrain.nnet.normalization.BatchNorm1d
59
+ activation3: !new:torch.nn.LeakyReLU
60
+
61
+ wav2vec2: !new:speechbrain.lobes.models.huggingface_wav2vec.HuggingFaceWav2Vec2
62
+ source: !ref <wav2vec2_hub>
63
+ output_norm: True
64
+ freeze: True
65
+ save_path: model_checkpoints
66
+
67
+ ctc_lin: !new:speechbrain.nnet.linear.Linear
68
+ input_size: !ref <dnn_neurons>
69
+ n_neurons: !ref <output_neurons>
70
+
71
+ log_softmax: !new:speechbrain.nnet.activations.Softmax
72
+ apply_log: True
73
+
74
+ ctc_cost: !name:speechbrain.nnet.losses.ctc_loss
75
+ blank_index: !ref <blank_index>
76
+
77
+ asr_model: !new:torch.nn.ModuleList
78
+ - [!ref <enc>, !ref <ctc_lin>]
79
+
80
+ tokenizer: !new:sentencepiece.SentencePieceProcessor
81
+
82
+ encoder: !new:speechbrain.nnet.containers.LengthsCapableSequential
83
+ wav2vec2: !ref <wav2vec2>
84
+ enc: !ref <enc>
85
+ ctc_lin: !ref <ctc_lin>
86
+
87
+ decoding_function: !name:speechbrain.decoders.ctc_greedy_decode
88
+ blank_id: !ref <blank_index>
89
+
90
+ modules:
91
+ encoder: !ref <encoder>
92
+
93
+ pretrainer: !new:speechbrain.utils.parameter_transfer.Pretrainer
94
+ loadables:
95
+ wav2vec2: !ref <wav2vec2>
96
+ asr: !ref <asr_model>
97
+ tokenizer: !ref <tokenizer>
preprocessor_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "feature_size": 1,
4
+ "padding_side": "right",
5
+ "padding_value": 0.0,
6
+ "return_attention_mask": true,
7
+ "sampling_rate": 16000
8
+ }
tokenizer.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee0f1d47170b6ea99bd904919fe98df28c72af426184f7f68bddefbe5bc056de
3
+ size 238094
wav2vec2.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7f712c755fd3968b1ac9e91652992b2bbfeb54639ca45e2a63d7c06cb1bcce5
3
+ size 1261920693