Mirco commited on
Commit
d66003a
1 Parent(s): dbb5e5e

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
+ tokenizer.ckpt filter=lfs diff=lfs merge=lfs -text
29
+ wav2vec2.ckpt filter=lfs diff=lfs merge=lfs -text
30
+ asr.ckpt filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: "fon"
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
+ - Dvoice
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 Fongbe (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) Fongbe 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.16 | 9.19 | 3.98 | 9.00 |
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 is trained with the train transcriptions.
34
+ - 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.
35
+ The obtained final acoustic representation is given to the CTC greedy decoder.
36
+ The system is trained with recordings sampled at 16kHz (single channel).
37
+ The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *transcribe_file* if needed.
38
+
39
+ # Install SpeechBrain
40
+ First of all, please install transformers and SpeechBrain with the following command:
41
+ ```
42
+ pip install speechbrain transformers
43
+ ```
44
+ Please notice that we encourage you to read the SpeechBrain tutorials and learn more about
45
+ [SpeechBrain](https://speechbrain.github.io).
46
+
47
+ # Transcribing your own audio files (in Fongbe)
48
+ ```python
49
+ from speechbrain.pretrained import EncoderASR
50
+ asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-wav2vec2-dvoice-fongbe", savedir="pretrained_models/asr-wav2vec2-dvoice-fongbe")
51
+ asr_model.transcribe_file('speechbrain/asr-wav2vec2-dvoice-fongbe/example_fongbe.wav')
52
+ ```
53
+
54
+ # Inference on GPU
55
+ To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
56
+
57
+ ### Training
58
+ The model was trained with SpeechBrain.
59
+ To train it from scratch follow these steps:
60
+ 1. Clone SpeechBrain:
61
+ ```bash
62
+ git clone https://github.com/speechbrain/speechbrain/
63
+ ```
64
+ 2. Install it:
65
+ ```bash
66
+ cd speechbrain
67
+ pip install -r requirements.txt
68
+ pip install -e .
69
+ ```
70
+ 3. Run Training:
71
+ ```bash
72
+ cd recipes/DVoice/ASR/CTC
73
+ python train_with_wav2vec2.py hparams/train_fon_with_wav2vec.yaml --data_folder=/localscratch/ALFFA_PUBLIC/ASR/FONGBE/data/
74
+ ```
75
+ You can find our training results (models, logs, etc) [here](https://drive.google.com/drive/folders/1vNT7RjRuELs7pumBHmfYsrOp9m46D0ym?usp=sharing).
76
+
77
+ # Limitations
78
+ The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
79
+
80
+ # About DVoice
81
+ DVoice is a community initiative that aims to provide African 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 retrieved from social media. 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.
82
+
83
+ For this project, AIOX Labs and the SI2M Laboratory are joining forces to build the future of technologies together.
84
+
85
+ # About AIOX Labs
86
+ Based in Rabat, London, and Paris, AIOX-Labs mobilizes artificial intelligence technologies to meet the business needs and data projects of companies.
87
+
88
+ - He is at the service of the growth of groups, the optimization of processes, or the improvement of the customer experience.
89
+ - AIOX-Labs is multi-sector, from fintech to industry, including retail and consumer goods.
90
+ - Business-ready data products with a solid algorithmic base and adaptability for the specific needs of each client.
91
+ - A complementary team made up of doctors in AI and business experts with a solid scientific base and international publications.
92
+
93
+ Website: [https://www.aiox-labs.com/](https://www.aiox-labs.com/)
94
+
95
+ # SI2M Laboratory
96
+ 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, and Mathematical Modelling.
97
+
98
+ 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)
99
+
100
+ # About SpeechBrain
101
+ 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.
102
+ Website: https://speechbrain.github.io/
103
+ GitHub: https://github.com/speechbrain/speechbrain
104
+
105
+
106
+ # Referencing SpeechBrain
107
+ ```
108
+ @misc{SB2021,
109
+ 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 },
110
+ title = {SpeechBrain},
111
+ year = {2021},
112
+ publisher = {GitHub},
113
+ journal = {GitHub repository},
114
+ howpublished = {\\\\url{https://github.com/speechbrain/speechbrain}},
115
+ }
116
+ ```
117
+ # Acknowledgements
118
+ 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:fcc6a9e546d8bb848f67baafc4eef1d1d5ca31e2b02cb5b4359862b3e493f4d1
3
+ size 12860384
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_fonge.wav ADDED
Binary file (97.3 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: 51 # 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:88c2fca7ff875633f101fb7a6ca8d2125ddf9321f94bf35da5bdeb73f6a48bdd
3
+ size 238274
wav2vec2.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:010e322124669a9215a8aa0437abb026b216e7e569552edca0f7644c8c7eff17
3
+ size 1261920693