aismlv commited on
Commit
5e7d20b
1 Parent(s): b6df156

Add model files

Browse files
config.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/wav2vec2-large-xlsr-53",
3
+ "activation_dropout": 0,
4
+ "apply_spec_augment": true,
5
+ "architectures": [
6
+ "Wav2Vec2ForCTC"
7
+ ],
8
+ "attention_dropout": 0,
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": "mean",
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.0,
46
+ "final_dropout": 0.0,
47
+ "gradient_checkpointing": true,
48
+ "hidden_act": "gelu",
49
+ "hidden_dropout": 0,
50
+ "hidden_size": 1024,
51
+ "initializer_range": 0.02,
52
+ "intermediate_size": 4096,
53
+ "layer_norm_eps": 1e-05,
54
+ "layerdrop": 0,
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,
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": 44,
74
+ "transformers_version": "4.5.0.dev0",
75
+ "vocab_size": 45
76
+ }
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
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad8b539264b74e769a7115cdc8830ee7024abbfc055befa33747a8a13115ef3a
3
+ size 1262118359
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "[UNK]", "pad_token": "[PAD]"}
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "bos_token": "<s>", "eos_token": "</s>", "pad_token": "[PAD]", "do_lower_case": false, "word_delimiter_token": "|"}
utils.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+ import torchaudio
3
+ import re
4
+
5
+
6
+ def get_test_dataset(data_path='ISSAI_KSC_335RS_v1.1'):
7
+ def read_sentence(idx):
8
+ with open(f"{data_path}/Transcriptions/{idx}.txt", 'r') as f:
9
+ text = ' '.join(f.readlines())
10
+ return text
11
+
12
+ def read_text(batch):
13
+ batch["sentence"] = read_sentence(batch['uttID'])
14
+ return batch
15
+
16
+ chars_to_ignore = ["f", "m"]
17
+ chars_to_ignore_regex = f'[{"".join(chars_to_ignore)}]'
18
+
19
+ def process_text(batch):
20
+ batch["text"] = re.sub(chars_to_ignore_regex, "", batch["sentence"]).lower() + " "
21
+ batch['text'] = batch['text'].replace('a', 'а').replace('ə', 'ә').replace('ɵ', 'ө')
22
+ return batch
23
+
24
+ def load_audio(batch):
25
+ path = f"{data_path}/Audios_flac/{batch['uttID']}.flac"
26
+ speech_array, sr = torchaudio.load(path)
27
+ batch["speech"] = speech_array
28
+ batch["sampling_rate"] = sr
29
+ return batch
30
+
31
+ test_dataset = datasets.load_dataset(
32
+ 'csv',
33
+ data_files=f"{data_path}/Meta/test.csv",
34
+ delimiter=' ',
35
+ split='train'
36
+ )
37
+
38
+ test_dataset = test_dataset.map(read_text)
39
+ test_dataset = test_dataset.map(process_text)
40
+ test_dataset = test_dataset.map(load_audio, num_proc=1)
41
+
42
+ return test_dataset
vocab.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"и": 0, "й": 1, "у": 2, "ь": 3, "ә": 4, "п": 5, "ы": 6, "щ": 7, "ч": 8, "е": 9, "р": 10, "з": 11, "ү": 12, "қ": 13, "х": 14, "г": 15, "б": 16, "я": 17, "с": 18, "ш": 19, "ө": 20, "ғ": 21, "т": 22, "і": 23, "м": 24, "ц": 25, "һ": 26, "ң": 27, "ж": 28, "ю": 29, "в": 30, "а": 32, "д": 33, "ф": 34, "э": 35, "ъ": 36, "л": 37, "ё": 38, "н": 39, "к": 40, "о": 41, "ұ": 42, "|": 31, "[UNK]": 43, "[PAD]": 44}