skypro1111
commited on
Upload 9 files
Browse files- README.md +89 -0
- added_tokens.json +4 -0
- alphabet.json +1 -0
- config.json +82 -0
- model.safetensors +3 -0
- preprocessor_config.json +11 -0
- special_tokens_map.json +30 -0
- tokenizer_config.json +48 -0
- vocab.json +39 -0
README.md
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: facebook/w2v-bert-2.0
|
3 |
+
library_name: transformers
|
4 |
+
language:
|
5 |
+
- uk
|
6 |
+
license: "apache-2.0"
|
7 |
+
tags:
|
8 |
+
- automatic-speech-recognition
|
9 |
+
datasets:
|
10 |
+
- espnet/yodas2
|
11 |
+
metrics:
|
12 |
+
- wer
|
13 |
+
model-index:
|
14 |
+
- name: w2v-bert-uk-v2.1
|
15 |
+
results:
|
16 |
+
- task:
|
17 |
+
name: Automatic Speech Recognition
|
18 |
+
type: automatic-speech-recognition
|
19 |
+
dataset:
|
20 |
+
name: common_voice_10_0
|
21 |
+
type: common_voice_10_0
|
22 |
+
config: uk
|
23 |
+
split: test
|
24 |
+
args: uk
|
25 |
+
metrics:
|
26 |
+
- name: Wer
|
27 |
+
type: wer
|
28 |
+
value: 0.0000
|
29 |
+
---
|
30 |
+
|
31 |
+
# w2v-bert-uk `v2.1`
|
32 |
+
|
33 |
+
|
34 |
+
## Community
|
35 |
+
|
36 |
+
- **Discord**: https://bit.ly/discord-uds
|
37 |
+
- Speech Recognition: https://t.me/speech_recognition_uk
|
38 |
+
- Speech Synthesis: https://t.me/speech_synthesis_uk
|
39 |
+
|
40 |
+
## Overview
|
41 |
+
|
42 |
+
This is a next model of https://huggingface.co/Yehor/w2v-bert-uk
|
43 |
+
|
44 |
+
## Demo
|
45 |
+
|
46 |
+
Use https://huggingface.co/spaces/Yehor/w2v-bert-uk-v2.1-demo space to see how the model works with your audios.
|
47 |
+
|
48 |
+
## Usage
|
49 |
+
|
50 |
+
```python
|
51 |
+
# pip install -U torch soundfile transformers
|
52 |
+
|
53 |
+
import torch
|
54 |
+
import soundfile as sf
|
55 |
+
from transformers import AutoModelForCTC, Wav2Vec2BertProcessor
|
56 |
+
|
57 |
+
# Config
|
58 |
+
model_name = 'Yehor/w2v-bert-2.0-uk-v2.1'
|
59 |
+
device = 'cuda:1' # or cpu
|
60 |
+
sampling_rate = 16_000
|
61 |
+
|
62 |
+
# Load the model
|
63 |
+
asr_model = AutoModelForCTC.from_pretrained(model_name).to(device)
|
64 |
+
processor = Wav2Vec2BertProcessor.from_pretrained(model_name)
|
65 |
+
|
66 |
+
paths = [
|
67 |
+
'sample1.wav',
|
68 |
+
]
|
69 |
+
|
70 |
+
# Extract audio
|
71 |
+
audio_inputs = []
|
72 |
+
for path in paths:
|
73 |
+
audio_input, _ = sf.read(path)
|
74 |
+
audio_inputs.append(audio_input)
|
75 |
+
|
76 |
+
# Transcribe the audio
|
77 |
+
inputs = processor(audio_inputs, sampling_rate=sampling_rate).input_features
|
78 |
+
features = torch.tensor(inputs).to(device)
|
79 |
+
|
80 |
+
with torch.inference_mode():
|
81 |
+
logits = asr_model(features).logits
|
82 |
+
|
83 |
+
predicted_ids = torch.argmax(logits, dim=-1)
|
84 |
+
predictions = processor.batch_decode(predicted_ids)
|
85 |
+
|
86 |
+
# Log results
|
87 |
+
print('Predictions:')
|
88 |
+
print(predictions)
|
89 |
+
```
|
added_tokens.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"</s>": 38,
|
3 |
+
"<s>": 37
|
4 |
+
}
|
alphabet.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"labels": ["'", "", "\u2047", " ", "\u0430", "\u0431", "\u0432", "\u0433", "\u0434", "\u0435", "\u0436", "\u0437", "\u0438", "\u0439", "\u043a", "\u043b", "\u043c", "\u043d", "\u043e", "\u043f", "\u0440", "\u0441", "\u0442", "\u0443", "\u0444", "\u0445", "\u0446", "\u0447", "\u0448", "\u0449", "\u044c", "\u044e", "\u044f", "\u0454", "\u0456", "\u0457", "\u0491", "<s>", "</s>"], "is_bpe": false}
|
config.json
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "facebook/w2v-bert-2.0",
|
3 |
+
"activation_dropout": 0.05,
|
4 |
+
"adapter_act": "relu",
|
5 |
+
"adapter_kernel_size": 3,
|
6 |
+
"adapter_stride": 2,
|
7 |
+
"add_adapter": true,
|
8 |
+
"apply_spec_augment": true,
|
9 |
+
"architectures": [
|
10 |
+
"Wav2Vec2BertForCTC"
|
11 |
+
],
|
12 |
+
"attention_dropout": 0.0,
|
13 |
+
"bos_token_id": 1,
|
14 |
+
"classifier_proj_size": 768,
|
15 |
+
"codevector_dim": 768,
|
16 |
+
"conformer_conv_dropout": 0.1,
|
17 |
+
"contrastive_logits_temperature": 0.1,
|
18 |
+
"conv_depthwise_kernel_size": 31,
|
19 |
+
"ctc_loss_reduction": "mean",
|
20 |
+
"ctc_zero_infinity": true,
|
21 |
+
"diversity_loss_weight": 0.1,
|
22 |
+
"eos_token_id": 2,
|
23 |
+
"feat_proj_dropout": 0.05,
|
24 |
+
"feat_quantizer_dropout": 0.0,
|
25 |
+
"feature_projection_input_dim": 160,
|
26 |
+
"final_dropout": 0.0,
|
27 |
+
"hidden_act": "swish",
|
28 |
+
"hidden_dropout": 0.05,
|
29 |
+
"hidden_size": 1024,
|
30 |
+
"initializer_range": 0.02,
|
31 |
+
"intermediate_size": 4096,
|
32 |
+
"layer_norm_eps": 1e-05,
|
33 |
+
"layerdrop": 0.0,
|
34 |
+
"left_max_position_embeddings": 64,
|
35 |
+
"mask_feature_length": 10,
|
36 |
+
"mask_feature_min_masks": 0,
|
37 |
+
"mask_feature_prob": 0.15,
|
38 |
+
"mask_time_length": 10,
|
39 |
+
"mask_time_min_masks": 2,
|
40 |
+
"mask_time_prob": 0.05,
|
41 |
+
"max_source_positions": 5000,
|
42 |
+
"model_type": "wav2vec2-bert",
|
43 |
+
"num_adapter_layers": 1,
|
44 |
+
"num_attention_heads": 16,
|
45 |
+
"num_codevector_groups": 2,
|
46 |
+
"num_codevectors_per_group": 320,
|
47 |
+
"num_hidden_layers": 24,
|
48 |
+
"num_negatives": 100,
|
49 |
+
"output_hidden_size": 1024,
|
50 |
+
"pad_token_id": 1,
|
51 |
+
"position_embeddings_type": "relative_key",
|
52 |
+
"proj_codevector_dim": 768,
|
53 |
+
"right_max_position_embeddings": 8,
|
54 |
+
"rotary_embedding_base": 10000,
|
55 |
+
"tdnn_dilation": [
|
56 |
+
1,
|
57 |
+
2,
|
58 |
+
3,
|
59 |
+
1,
|
60 |
+
1
|
61 |
+
],
|
62 |
+
"tdnn_dim": [
|
63 |
+
512,
|
64 |
+
512,
|
65 |
+
512,
|
66 |
+
512,
|
67 |
+
1500
|
68 |
+
],
|
69 |
+
"tdnn_kernel": [
|
70 |
+
5,
|
71 |
+
3,
|
72 |
+
3,
|
73 |
+
1,
|
74 |
+
1
|
75 |
+
],
|
76 |
+
"torch_dtype": "float32",
|
77 |
+
"transformers_version": "4.43.3",
|
78 |
+
"use_intermediate_ffn_before_adapter": false,
|
79 |
+
"use_weighted_layer_sum": false,
|
80 |
+
"vocab_size": 39,
|
81 |
+
"xvector_output_dim": 512
|
82 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e9da62ad9ef6b9eab87eb8f9386a1b3ec919d533bab6183ab00bfa6b046c4f40
|
3 |
+
size 729088
|
preprocessor_config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"feature_extractor_type": "SeamlessM4TFeatureExtractor",
|
3 |
+
"feature_size": 80,
|
4 |
+
"num_mel_bins": 80,
|
5 |
+
"padding_side": "right",
|
6 |
+
"padding_value": 1,
|
7 |
+
"processor_class": "Wav2Vec2ProcessorWithLM",
|
8 |
+
"return_attention_mask": true,
|
9 |
+
"sampling_rate": 16000,
|
10 |
+
"stride": 2
|
11 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "</s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "<pad>",
|
18 |
+
"lstrip": true,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": true,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"unk_token": {
|
24 |
+
"content": "<unk>",
|
25 |
+
"lstrip": true,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": true,
|
28 |
+
"single_word": false
|
29 |
+
}
|
30 |
+
}
|
tokenizer_config.json
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"1": {
|
4 |
+
"content": "<pad>",
|
5 |
+
"lstrip": true,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": true,
|
8 |
+
"single_word": false,
|
9 |
+
"special": false
|
10 |
+
},
|
11 |
+
"2": {
|
12 |
+
"content": "<unk>",
|
13 |
+
"lstrip": true,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": true,
|
16 |
+
"single_word": false,
|
17 |
+
"special": false
|
18 |
+
},
|
19 |
+
"37": {
|
20 |
+
"content": "<s>",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"38": {
|
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": true,
|
38 |
+
"do_lower_case": false,
|
39 |
+
"eos_token": "</s>",
|
40 |
+
"model_max_length": 1000000000000000019884624838656,
|
41 |
+
"pad_token": "<pad>",
|
42 |
+
"processor_class": "Wav2Vec2ProcessorWithLM",
|
43 |
+
"replace_word_delimiter_char": " ",
|
44 |
+
"target_lang": null,
|
45 |
+
"tokenizer_class": "Wav2Vec2CTCTokenizer",
|
46 |
+
"unk_token": "<unk>",
|
47 |
+
"word_delimiter_token": "|"
|
48 |
+
}
|
vocab.json
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"'": 0,
|
3 |
+
"<pad>": 1,
|
4 |
+
"<unk>": 2,
|
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 |
+
}
|