AIgrator ekhodzitsky commited on
Commit
74745db
·
0 Parent(s):

Duplicate from ekhodzitsky/rupunct-small-onnx

Browse files

Co-authored-by: Evgeny Khodzitsky <ekhodzitsky@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - ru
5
+ base_model: RUPunct/RUPunct_small
6
+ tags:
7
+ - onnx
8
+ - punctuation
9
+ - capitalization
10
+ - russian
11
+ - token-classification
12
+ library_name: onnxruntime
13
+ ---
14
+
15
+ # RUPunct_small — INT8 ONNX
16
+
17
+ INT8-quantized ONNX export of [RUPunct/RUPunct_small](https://huggingface.co/RUPunct/RUPunct_small)
18
+ (MIT) — Russian **punctuation + capitalization restoration** as token classification.
19
+
20
+ Packaged for use in the [gigastt](https://github.com/ekhodzitsky/gigastt) speech-to-text
21
+ server: it runs via ONNX Runtime (no Python at runtime) with the Rust `tokenizers`
22
+ crate, restoring punctuation/casing on the plain `rnnt` head's bare lowercase output, e.g.
23
+ `шестьдесят тысяч тенге сколько будет стоить` → `Шестьдесят тысяч тенге, сколько будет стоить?`.
24
+
25
+ ## Files
26
+ - `rupunct_small_int8.onnx` — dynamic-INT8 graph (DynamicQuantizeLinear + MatMulInteger), ~29 MB.
27
+ - `tokenizer.json`, `config.json`, `special_tokens_map.json`, `tokenizer_config.json` — HF WordPiece tokenizer + label map (33 labels).
28
+
29
+ ## I/O
30
+ - Inputs: `input_ids`, `attention_mask`, `token_type_ids` (int64, `[batch, seq]`).
31
+ - Output: `logits` `[batch, seq, 33]`. Take the first sub-token label per word (aggregation `first`),
32
+ then apply RUPunct's `process_token` decode (3 case modes × 11 punctuation classes).
33
+
34
+ ## License
35
+ MIT, inherited from the upstream RUPunct/RUPunct_small. Export + INT8 quantization only;
36
+ weights are unchanged in accuracy (fp32 and int8 produce identical labels on test inputs).
config.json ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForTokenClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "dtype": "float32",
8
+ "emb_size": 312,
9
+ "gradient_checkpointing": false,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 312,
13
+ "id2label": {
14
+ "0": "UPPER_PERIOD",
15
+ "1": "LOWER_PERIOD",
16
+ "2": "UPPER_TOTAL_PERIOD",
17
+ "3": "UPPER_COMMA",
18
+ "4": "LOWER_COMMA",
19
+ "5": "UPPER_TOTAL_COMMA",
20
+ "6": "UPPER_QUESTION",
21
+ "7": "LOWER_QUESTION",
22
+ "8": "UPPER_TOTAL_QUESTION",
23
+ "9": "UPPER_TIRE",
24
+ "10": "LOWER_TIRE",
25
+ "11": "UPPER_TOTAL_TIRE",
26
+ "12": "UPPER_VOSKL",
27
+ "13": "LOWER_VOSKL",
28
+ "14": "UPPER_TOTAL_VOSKL",
29
+ "15": "UPPER_DVOETOCHIE",
30
+ "16": "LOWER_DVOETOCHIE",
31
+ "17": "UPPER_TOTAL_DVOETOCHIE",
32
+ "18": "UPPER_PERIODCOMMA",
33
+ "19": "LOWER_PERIODCOMMA",
34
+ "20": "UPPER_TOTAL_PERIODCOMMA",
35
+ "21": "UPPER_DEFIS",
36
+ "22": "LOWER_DEFIS",
37
+ "23": "UPPER_TOTAL_DEFIS",
38
+ "24": "UPPER_QUESTIONVOSKL",
39
+ "25": "LOWER_QUESTIONVOSKL",
40
+ "26": "UPPER_TOTAL_QUESTIONVOSKL",
41
+ "27": "UPPER_MNOGOTOCHIE",
42
+ "28": "LOWER_MNOGOTOCHIE",
43
+ "29": "UPPER_TOTAL_MNOGOTOCHIE",
44
+ "30": "UPPER_O",
45
+ "31": "LOWER_O",
46
+ "32": "UPPER_TOTAL_O"
47
+ },
48
+ "initializer_range": 0.02,
49
+ "intermediate_size": 600,
50
+ "label2id": {
51
+ "LOWER_COMMA": 4,
52
+ "LOWER_DEFIS": 22,
53
+ "LOWER_DVOETOCHIE": 16,
54
+ "LOWER_MNOGOTOCHIE": 28,
55
+ "LOWER_O": 31,
56
+ "LOWER_PERIOD": 1,
57
+ "LOWER_PERIODCOMMA": 19,
58
+ "LOWER_QUESTION": 7,
59
+ "LOWER_QUESTIONVOSKL": 25,
60
+ "LOWER_TIRE": 10,
61
+ "LOWER_VOSKL": 13,
62
+ "UPPER_COMMA": 3,
63
+ "UPPER_DEFIS": 21,
64
+ "UPPER_DVOETOCHIE": 15,
65
+ "UPPER_MNOGOTOCHIE": 27,
66
+ "UPPER_O": 30,
67
+ "UPPER_PERIOD": 0,
68
+ "UPPER_PERIODCOMMA": 18,
69
+ "UPPER_QUESTION": 6,
70
+ "UPPER_QUESTIONVOSKL": 24,
71
+ "UPPER_TIRE": 9,
72
+ "UPPER_TOTAL_COMMA": 5,
73
+ "UPPER_TOTAL_DEFIS": 23,
74
+ "UPPER_TOTAL_DVOETOCHIE": 17,
75
+ "UPPER_TOTAL_MNOGOTOCHIE": 29,
76
+ "UPPER_TOTAL_O": 32,
77
+ "UPPER_TOTAL_PERIOD": 2,
78
+ "UPPER_TOTAL_PERIODCOMMA": 20,
79
+ "UPPER_TOTAL_QUESTION": 8,
80
+ "UPPER_TOTAL_QUESTIONVOSKL": 26,
81
+ "UPPER_TOTAL_TIRE": 11,
82
+ "UPPER_TOTAL_VOSKL": 14,
83
+ "UPPER_VOSKL": 12
84
+ },
85
+ "layer_norm_eps": 1e-12,
86
+ "max_position_embeddings": 2048,
87
+ "model_type": "bert",
88
+ "num_attention_heads": 12,
89
+ "num_hidden_layers": 3,
90
+ "pad_token_id": 0,
91
+ "position_embedding_type": "absolute",
92
+ "transformers_version": "4.57.6",
93
+ "type_vocab_size": 2,
94
+ "use_cache": true,
95
+ "vocab_size": 83828
96
+ }
rupunct_small_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b105da023474d98aa13ba18953ae67b04b17bd0595034bc06030c17536893933
3
+ size 29259673
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": true,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": false,
48
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "model_max_length": 2048,
51
+ "never_split": null,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "strip_accents": false,
55
+ "tokenize_chinese_chars": true,
56
+ "tokenizer_class": "BertTokenizer",
57
+ "unk_token": "[UNK]"
58
+ }