birgermoell
commited on
Commit
·
d409491
1
Parent(s):
c498527
Updated model
Browse files- alphabet.json +1 -1
- get_tokens.py +5 -3
- 5gram_correct.arpa → language_model/5gram_correct.arpa +0 -0
- language_model/attrs.json +1 -0
- language_model/unigrams.txt +3 -0
- preprocessor_config.json +1 -2
- tokenizer_config.json +1 -9
alphabet.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"labels": ["", "
|
|
|
1 |
+
{"labels": ["", "<s>", "</s>", "\u2047", " ", "T", "E", "A", "N", "R", "S", "I", "L", "D", "O", "M", "K", "G", "U", "V", "F", "H", "\u00c4", "\u00c5", "P", "\u00d6", "B", "J", "C", "Y", "X", "W", "Z", "\u00c9", "Q", "8", "2", "5", "9", "1", "6", "7", "3", "4", "0", "'"], "is_bpe": false}
|
get_tokens.py
CHANGED
@@ -5,11 +5,11 @@ processor = AutoProcessor.from_pretrained(model_id)
|
|
5 |
|
6 |
vocab_dict = processor.tokenizer.get_vocab()
|
7 |
# print(vocab_dict)
|
8 |
-
sorted_vocab_dict = {k
|
|
|
9 |
|
10 |
from pyctcdecode import build_ctcdecoder
|
11 |
|
12 |
-
|
13 |
decoder = build_ctcdecoder(
|
14 |
labels=list(sorted_vocab_dict.keys()),
|
15 |
kenlm_model_path="5gram_correct.arpa",
|
@@ -21,4 +21,6 @@ processor_with_lm = Wav2Vec2ProcessorWithLM(
|
|
21 |
feature_extractor=processor.feature_extractor,
|
22 |
tokenizer=processor.tokenizer,
|
23 |
decoder=decoder
|
24 |
-
)
|
|
|
|
|
|
5 |
|
6 |
vocab_dict = processor.tokenizer.get_vocab()
|
7 |
# print(vocab_dict)
|
8 |
+
sorted_vocab_dict = {k: v for k, v in sorted(vocab_dict.items(), key=lambda item: item[1])}
|
9 |
+
print("the sorted vocab list is", sorted_vocab_dict)
|
10 |
|
11 |
from pyctcdecode import build_ctcdecoder
|
12 |
|
|
|
13 |
decoder = build_ctcdecoder(
|
14 |
labels=list(sorted_vocab_dict.keys()),
|
15 |
kenlm_model_path="5gram_correct.arpa",
|
|
|
21 |
feature_extractor=processor.feature_extractor,
|
22 |
tokenizer=processor.tokenizer,
|
23 |
decoder=decoder
|
24 |
+
)
|
25 |
+
|
26 |
+
processor_with_lm.save_pretrained(".")
|
5gram_correct.arpa → language_model/5gram_correct.arpa
RENAMED
File without changes
|
language_model/attrs.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"alpha": 0.5, "beta": 1.5, "unk_score_offset": -10.0, "score_boundary": true}
|
language_model/unigrams.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:62489a53c88421993c0cb90a248f9f662c45469db1a9106b953ceb44726215bd
|
3 |
+
size 5139633
|
preprocessor_config.json
CHANGED
@@ -4,8 +4,7 @@
|
|
4 |
"feature_size": 1,
|
5 |
"padding_side": "right",
|
6 |
"padding_value": 0,
|
|
|
7 |
"return_attention_mask": true,
|
8 |
"sampling_rate": 16000
|
9 |
}
|
10 |
-
|
11 |
-
|
|
|
4 |
"feature_size": 1,
|
5 |
"padding_side": "right",
|
6 |
"padding_value": 0,
|
7 |
+
"processor_class": "Wav2Vec2ProcessorWithLM",
|
8 |
"return_attention_mask": true,
|
9 |
"sampling_rate": 16000
|
10 |
}
|
|
|
|
tokenizer_config.json
CHANGED
@@ -1,9 +1 @@
|
|
1 |
-
{
|
2 |
-
"bos_token" : "<s>",
|
3 |
-
"do_lower_case" : true,
|
4 |
-
"eos_token" : "</s>",
|
5 |
-
"pad_token" : "<pad>",
|
6 |
-
"tokenizer_class" : "Wav2Vec2CTCTokenizer",
|
7 |
-
"unk_token" : "<unk>",
|
8 |
-
"word_delimiter_token" : "|"
|
9 |
-
}
|
|
|
1 |
+
{"unk_token": "<unk>", "bos_token": "<s>", "eos_token": "</s>", "pad_token": "<pad>", "do_lower_case": true, "word_delimiter_token": "|", "special_tokens_map_file": "./special_tokens_map.json", "tokenizer_file": null, "name_or_path": ".", "tokenizer_class": "Wav2Vec2CTCTokenizer", "processor_class": "Wav2Vec2ProcessorWithLM"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|