Souphaxay Naovalath commited on
Commit
ae23cf2
·
verified ·
1 Parent(s): f65fe00

Upload XLS-R Lao ASR model

Browse files
.DS_Store ADDED
Binary file (6.15 kB). View file
 
README.md CHANGED
@@ -1,3 +1,47 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: lo
3
+ license: apache-2.0
4
+ tags:
5
+ - automatic-speech-recognition
6
+ - speech
7
+ - audio
8
+ - lao
9
+ - wav2vec2
10
+ - xls-r
11
+ datasets:
12
+ - h3llohihi/lao-asr-thesis-dataset
13
+ ---
14
+
15
+ # XLS-R Lao ASR
16
+
17
+ Fine-tuned XLS-R-300M model for Lao automatic speech recognition.
18
+
19
+ ## Model Performance
20
+ - **Test CER**: 15.14%
21
+ - **Training Time**: 2.1 hours
22
+ - **Dialects**: Central, Northern, Southern Lao
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
28
+ import torch
29
+ import librosa
30
+
31
+ # Load model and processor
32
+ model = Wav2Vec2ForCTC.from_pretrained("h3llohihi/xls-r-lao-asr")
33
+ processor = Wav2Vec2Processor.from_pretrained("h3llohihi/xls-r-lao-asr")
34
+
35
+ # Load audio
36
+ audio, sr = librosa.load("audio.wav", sr=16000)
37
+
38
+ # Process audio
39
+ inputs = processor(audio, sampling_rate=16000, return_tensors="pt")
40
+
41
+ # Generate prediction
42
+ with torch.no_grad():
43
+ logits = model(**inputs).logits
44
+ predicted_ids = torch.argmax(logits, dim=-1)
45
+ transcription = processor.batch_decode(predicted_ids)[0]
46
+
47
+ print(transcription)
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "</s>": 56,
3
+ "<s>": 55
4
+ }
config.json ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_dropout": 0.0,
3
+ "adapter_attn_dim": null,
4
+ "adapter_kernel_size": 3,
5
+ "adapter_stride": 2,
6
+ "add_adapter": false,
7
+ "apply_spec_augment": true,
8
+ "architectures": [
9
+ "Wav2Vec2ForCTC"
10
+ ],
11
+ "attention_dropout": 0.1,
12
+ "bos_token_id": 1,
13
+ "classifier_proj_size": 256,
14
+ "codevector_dim": 768,
15
+ "contrastive_logits_temperature": 0.1,
16
+ "conv_bias": true,
17
+ "conv_dim": [
18
+ 512,
19
+ 512,
20
+ 512,
21
+ 512,
22
+ 512,
23
+ 512,
24
+ 512
25
+ ],
26
+ "conv_kernel": [
27
+ 10,
28
+ 3,
29
+ 3,
30
+ 3,
31
+ 3,
32
+ 2,
33
+ 2
34
+ ],
35
+ "conv_stride": [
36
+ 5,
37
+ 2,
38
+ 2,
39
+ 2,
40
+ 2,
41
+ 2,
42
+ 2
43
+ ],
44
+ "ctc_loss_reduction": "mean",
45
+ "ctc_zero_infinity": false,
46
+ "diversity_loss_weight": 0.1,
47
+ "do_stable_layer_norm": true,
48
+ "eos_token_id": 2,
49
+ "feat_extract_activation": "gelu",
50
+ "feat_extract_dropout": 0.0,
51
+ "feat_extract_norm": "layer",
52
+ "feat_proj_dropout": 0.1,
53
+ "feat_quantizer_dropout": 0.0,
54
+ "final_dropout": 0.0,
55
+ "gradient_checkpointing": false,
56
+ "hidden_act": "gelu",
57
+ "hidden_dropout": 0.1,
58
+ "hidden_size": 1024,
59
+ "initializer_range": 0.02,
60
+ "intermediate_size": 4096,
61
+ "layer_norm_eps": 1e-05,
62
+ "layerdrop": 0.1,
63
+ "mask_feature_length": 10,
64
+ "mask_feature_min_masks": 0,
65
+ "mask_feature_prob": 0.0,
66
+ "mask_time_length": 10,
67
+ "mask_time_min_masks": 2,
68
+ "mask_time_prob": 0.075,
69
+ "model_type": "wav2vec2",
70
+ "num_adapter_layers": 3,
71
+ "num_attention_heads": 16,
72
+ "num_codevector_groups": 2,
73
+ "num_codevectors_per_group": 320,
74
+ "num_conv_pos_embedding_groups": 16,
75
+ "num_conv_pos_embeddings": 128,
76
+ "num_feat_extract_layers": 7,
77
+ "num_hidden_layers": 24,
78
+ "num_negatives": 100,
79
+ "output_hidden_size": 1024,
80
+ "pad_token_id": 0,
81
+ "proj_codevector_dim": 768,
82
+ "tdnn_dilation": [
83
+ 1,
84
+ 2,
85
+ 3,
86
+ 1,
87
+ 1
88
+ ],
89
+ "tdnn_dim": [
90
+ 512,
91
+ 512,
92
+ 512,
93
+ 512,
94
+ 1500
95
+ ],
96
+ "tdnn_kernel": [
97
+ 5,
98
+ 3,
99
+ 3,
100
+ 1,
101
+ 1
102
+ ],
103
+ "torch_dtype": "float32",
104
+ "transformers_version": "4.52.4",
105
+ "use_weighted_layer_sum": false,
106
+ "vocab_size": 57,
107
+ "xvector_output_dim": 512
108
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0282c350405915a500648ae0dca13cc5523cac618c5b80984eec0840259a017a
3
+ size 1262041180
preprocessor_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
4
+ "feature_size": 1,
5
+ "padding_side": "right",
6
+ "padding_value": 0,
7
+ "processor_class": "Wav2Vec2Processor",
8
+ "return_attention_mask": true,
9
+ "sampling_rate": 16000
10
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "pad_token": "<pad>",
5
+ "unk_token": "<unk>"
6
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<pad>",
5
+ "lstrip": true,
6
+ "normalized": false,
7
+ "rstrip": true,
8
+ "single_word": false,
9
+ "special": false
10
+ },
11
+ "1": {
12
+ "content": "<unk>",
13
+ "lstrip": true,
14
+ "normalized": false,
15
+ "rstrip": true,
16
+ "single_word": false,
17
+ "special": false
18
+ },
19
+ "55": {
20
+ "content": "<s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "56": {
28
+ "content": "</s>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ }
35
+ },
36
+ "bos_token": "<s>",
37
+ "clean_up_tokenization_spaces": false,
38
+ "do_lower_case": false,
39
+ "eos_token": "</s>",
40
+ "extra_special_tokens": {},
41
+ "model_max_length": 1000000000000000019884624838656,
42
+ "pad_token": "<pad>",
43
+ "processor_class": "Wav2Vec2Processor",
44
+ "replace_word_delimiter_char": " ",
45
+ "target_lang": null,
46
+ "tokenizer_class": "Wav2Vec2CTCTokenizer",
47
+ "unk_token": "<unk>",
48
+ "word_delimiter_token": "|"
49
+ }
vocab.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ " ": 2,
3
+ "<pad>": 0,
4
+ "<unk>": 1,
5
+ "ກ": 3,
6
+ "ຂ": 4,
7
+ "ຄ": 5,
8
+ "ງ": 6,
9
+ "ຈ": 7,
10
+ "ຊ": 8,
11
+ "ຍ": 9,
12
+ "ດ": 10,
13
+ "ຕ": 11,
14
+ "ຖ": 12,
15
+ "ທ": 13,
16
+ "ນ": 14,
17
+ "ບ": 15,
18
+ "ປ": 16,
19
+ "ຜ": 17,
20
+ "ຝ": 18,
21
+ "ພ": 19,
22
+ "ຟ": 20,
23
+ "ມ": 21,
24
+ "ຢ": 22,
25
+ "ຣ": 23,
26
+ "ລ": 24,
27
+ "ວ": 25,
28
+ "ສ": 26,
29
+ "ຫ": 27,
30
+ "ອ": 28,
31
+ "ຮ": 29,
32
+ "ະ": 30,
33
+ "ັ": 31,
34
+ "າ": 32,
35
+ "ຳ": 33,
36
+ "ິ": 34,
37
+ "ີ": 35,
38
+ "ຶ": 36,
39
+ "ື": 37,
40
+ "ຸ": 38,
41
+ "ູ": 39,
42
+ "ົ": 40,
43
+ "ຼ": 41,
44
+ "ຽ": 42,
45
+ "ເ": 43,
46
+ "ແ": 44,
47
+ "ໂ": 45,
48
+ "ໃ": 46,
49
+ "ໄ": 47,
50
+ "ໆ": 48,
51
+ "່": 49,
52
+ "້": 50,
53
+ "໋": 51,
54
+ "ໍ": 52,
55
+ "ໜ": 53,
56
+ "ໝ": 54
57
+ }