failed09 commited on
Commit
96349dd
·
verified ·
1 Parent(s): 1e7b82e

Add verified FP32 ONNX BashkirRoBERTa model

Browse files
Files changed (4) hide show
  1. META.json +31 -30
  2. README.md +19 -12
  3. SHA256SUMS +3 -2
  4. onnx/model_fp32.onnx +3 -0
META.json CHANGED
@@ -1,30 +1,31 @@
1
- {
2
- "id": "bashkir_roberta",
3
- "version": "v1",
4
- "type": "masked_language_model",
5
- "status": "current",
6
- "language": "ba",
7
- "license": "apache-2.0",
8
- "source": "a monolingual Bashkir-language dataset",
9
- "created_at": "2026-09-17T18:20:06Z",
10
- "architecture": "Pre-LayerNorm Transformer encoder",
11
- "hidden_size": 640,
12
- "num_hidden_layers": 8,
13
- "num_attention_heads": 10,
14
- "intermediate_size": 2560,
15
- "max_position_embeddings": 256,
16
- "vocab_size": 16384,
17
- "params": 50040000,
18
- "sha256": {
19
- "model.safetensors": "48e4d4e7b8af675d222e58e14776abac24b7e83a937d7884bd9d735ea9dd2173",
20
- "onnx/model_fp16.onnx": "945e1ac0c79c4de1807635171a67c1ef65fac8dee9476ca989116a19978d1012",
21
- "onnx/model_int8.onnx": "7826c5f46be23f17838c7c3478d24f6ea0e29ebe388cae92a102cb125d5b1c19",
22
- "spm_bashkir_bert_16k.model": "4e77b9cfc9ab8c200406ee46c2d20fc46734da9ddcf01dff0f0e370f6c4ac244",
23
- "config.json": "59b773953af5b2a69adb7e3c5d345a90f34f848f6a1543309d5acc7fb78b28c4",
24
- "configuration_bashkir_roberta.py": "e9f179aad7619153724920c86a90ecc3c161fd15ffc3332f200e9f2073a07f72",
25
- "modeling_bashkir_roberta.py": "3c1e098df93d6b47bc429268e87351afbaabf7d9a0be1f8e7ef9b9a3558410e8",
26
- "tokenization_bashkir_roberta.py": "c26cefc431c25c359ddcd1f6587ab132a4240c12bb44151b2afb16a220610fa9",
27
- "tokenizer_config.json": "3e3e87f99f7c91ee6d552da57d5b3e978d847440c5b238a7d3f7df1514c7073c"
28
- },
29
- "source_policy": "Training texts are not redistributed in this repository."
30
- }
 
 
1
+ {
2
+ "id": "bashkir_roberta",
3
+ "version": "v1",
4
+ "type": "masked_language_model",
5
+ "status": "current",
6
+ "language": "ba",
7
+ "license": "apache-2.0",
8
+ "source": "a monolingual Bashkir-language dataset",
9
+ "created_at": "2026-09-17T18:20:06Z",
10
+ "architecture": "Pre-LayerNorm Transformer encoder",
11
+ "hidden_size": 640,
12
+ "num_hidden_layers": 8,
13
+ "num_attention_heads": 10,
14
+ "intermediate_size": 2560,
15
+ "max_position_embeddings": 256,
16
+ "vocab_size": 16384,
17
+ "params": 50040000,
18
+ "sha256": {
19
+ "model.safetensors": "48e4d4e7b8af675d222e58e14776abac24b7e83a937d7884bd9d735ea9dd2173",
20
+ "onnx/model_fp32.onnx": "0ad099ef408b27f6fffaf21f3746efd2c2606514445dfa1ffb01d20dea88a3e4",
21
+ "onnx/model_fp16.onnx": "945e1ac0c79c4de1807635171a67c1ef65fac8dee9476ca989116a19978d1012",
22
+ "onnx/model_int8.onnx": "7826c5f46be23f17838c7c3478d24f6ea0e29ebe388cae92a102cb125d5b1c19",
23
+ "spm_bashkir_bert_16k.model": "4e77b9cfc9ab8c200406ee46c2d20fc46734da9ddcf01dff0f0e370f6c4ac244",
24
+ "config.json": "59b773953af5b2a69adb7e3c5d345a90f34f848f6a1543309d5acc7fb78b28c4",
25
+ "configuration_bashkir_roberta.py": "e9f179aad7619153724920c86a90ecc3c161fd15ffc3332f200e9f2073a07f72",
26
+ "modeling_bashkir_roberta.py": "3c1e098df93d6b47bc429268e87351afbaabf7d9a0be1f8e7ef9b9a3558410e8",
27
+ "tokenization_bashkir_roberta.py": "c26cefc431c25c359ddcd1f6587ab132a4240c12bb44151b2afb16a220610fa9",
28
+ "tokenizer_config.json": "3e3e87f99f7c91ee6d552da57d5b3e978d847440c5b238a7d3f7df1514c7073c"
29
+ },
30
+ "source_policy": "Training texts are not redistributed in this repository."
31
+ }
README.md CHANGED
@@ -23,9 +23,9 @@ tags:
23
 
24
  BashkirRoBERTa predicts masked SentencePiece tokens from context. It can provide
25
  fill-mask suggestions and serve as an encoder for further fine-tuning, including
26
- the related person-name model. The release includes Transformers weights and FP16
27
- and INT8 ONNX graphs. Its custom Pre-LayerNorm architecture requires the included
28
- model code when loaded with Transformers.
29
 
30
  | At a glance | |
31
  | --- | --- |
@@ -41,7 +41,8 @@ model code when loaded with Transformers.
41
  | File | Purpose | Size |
42
  | --- | --- | ---: |
43
  | **`model.safetensors`** | Transformers weights and fine-tuning starting point | 200.2 MB |
44
- | `onnx/model_fp16.onnx` | FP16 ONNX model for GPU / DirectML | 121.2 MB |
 
45
  | **`onnx/model_int8.onnx`** | Compact INT8 ONNX graph for CPU use | 60.9 MB |
46
  | `spm_bashkir_bert_16k.model` | SentencePiece tokenizer | — |
47
  | `config.json` | Model configuration (`auto_map` for custom code) | — |
@@ -87,21 +88,24 @@ sources. The source texts are not distributed in this repository.
87
 
88
  ```text
89
  Bashkir text → SentencePiece tokens → masked-language pretraining
90
- → Transformers checkpoint → FP16 and INT8 ONNX exports
91
  ```
92
 
93
  ### Benchmark
94
 
95
  On a held-out Bashkir encyclopedic evaluation set the project reports **24.7%
96
  top-1** and **54.0% top-5** accuracy for masked subword prediction. These are
97
- diagnostic MLM results, not a general-purpose language-understanding score: a mask
98
- may represent a whole word or a SentencePiece subword fragment.
 
 
99
 
100
  ## Quality and Use
101
 
102
  Use the Transformers checkpoint for fill-mask experiments or fine-tuning and the
103
- INT8 ONNX graph for compact CPU inference. Predictions are token suggestions that
104
- need review in context, especially when the mask represents only part of a word.
 
105
 
106
  ### Limitations
107
 
@@ -139,7 +143,7 @@ prediction_id = logits[0, mask_index].argmax().item()
139
  print(tokenizer.decode([prediction_id])) # яратам
140
  ```
141
 
142
- ONNX Runtime for CPU and edge deployment:
143
 
144
  ```python
145
  import numpy as np
@@ -157,8 +161,11 @@ tokens = [2] + sp.encode("Мин башҡорт телен ") + [6] + sp.encode(
157
  mask_idx = tokens.index(6)
158
  logits = session.run(None, {"input_ids": np.array([tokens], dtype=np.int64)})[0][0, mask_idx]
159
  top_tokens = np.argsort(logits)[::-1][:5]
160
- print([sp.decode([int(t)]) for t in top_tokens]) # ['яратам', 'беләм', 'өйрәнә', ...]
161
- ```
 
 
 
162
 
163
  ## License
164
 
 
23
 
24
  BashkirRoBERTa predicts masked SentencePiece tokens from context. It can provide
25
  fill-mask suggestions and serve as an encoder for further fine-tuning, including
26
+ the related person-name model. The release includes Transformers weights and FP32,
27
+ FP16 and INT8 ONNX graphs. Its custom Pre-LayerNorm architecture requires the
28
+ included model code when loaded with Transformers.
29
 
30
  | At a glance | |
31
  | --- | --- |
 
41
  | File | Purpose | Size |
42
  | --- | --- | ---: |
43
  | **`model.safetensors`** | Transformers weights and fine-tuning starting point | 200.2 MB |
44
+ | `onnx/model_fp32.onnx` | Full-precision ONNX reference for CPU inference | 242.2 MB |
45
+ | `onnx/model_fp16.onnx` | FP16 ONNX model for GPU / DirectML | 121.2 MB |
46
  | **`onnx/model_int8.onnx`** | Compact INT8 ONNX graph for CPU use | 60.9 MB |
47
  | `spm_bashkir_bert_16k.model` | SentencePiece tokenizer | — |
48
  | `config.json` | Model configuration (`auto_map` for custom code) | — |
 
88
 
89
  ```text
90
  Bashkir text → SentencePiece tokens → masked-language pretraining
91
+ → Transformers checkpoint → FP32 / FP16 / INT8 ONNX exports
92
  ```
93
 
94
  ### Benchmark
95
 
96
  On a held-out Bashkir encyclopedic evaluation set the project reports **24.7%
97
  top-1** and **54.0% top-5** accuracy for masked subword prediction. These are
98
+ diagnostic MLM results, not a general-purpose language-understanding score: a mask
99
+ may represent a whole word or a SentencePiece subword fragment.
100
+ The FP32 ONNX graph was checked against the source PyTorch model on multiple
101
+ sequence lengths and batch sizes, with matching top-token predictions.
102
 
103
  ## Quality and Use
104
 
105
  Use the Transformers checkpoint for fill-mask experiments or fine-tuning and the
106
+ INT8 ONNX graph for compact CPU inference. Choose FP32 ONNX when a full-precision
107
+ ONNX reference is needed. Predictions are token suggestions that need review in
108
+ context, especially when the mask represents only part of a word.
109
 
110
  ### Limitations
111
 
 
143
  print(tokenizer.decode([prediction_id])) # яратам
144
  ```
145
 
146
+ ONNX Runtime for CPU and edge deployment:
147
 
148
  ```python
149
  import numpy as np
 
161
  mask_idx = tokens.index(6)
162
  logits = session.run(None, {"input_ids": np.array([tokens], dtype=np.int64)})[0][0, mask_idx]
163
  top_tokens = np.argsort(logits)[::-1][:5]
164
+ print([sp.decode([int(t)]) for t in top_tokens]) # ['яратам', 'беләм', 'өйрәнә', ...]
165
+ ```
166
+
167
+ For full-precision ONNX inference, change the downloaded filename to
168
+ `onnx/model_fp32.onnx`; the input and output names are the same.
169
 
170
  ## License
171
 
SHA256SUMS CHANGED
@@ -1,11 +1,12 @@
1
  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
2
- f6d59748711ddcc45af84d09cf7970a276ee93820a83dda4fb5fda8209f878ca META.json
3
- d11fdb4dffe9cc59684392c54e798f194493bb48862196291e96a067a8471efb README.md
4
  59b773953af5b2a69adb7e3c5d345a90f34f848f6a1543309d5acc7fb78b28c4 config.json
5
  e9f179aad7619153724920c86a90ecc3c161fd15ffc3332f200e9f2073a07f72 configuration_bashkir_roberta.py
6
  48e4d4e7b8af675d222e58e14776abac24b7e83a937d7884bd9d735ea9dd2173 model.safetensors
7
  3c1e098df93d6b47bc429268e87351afbaabf7d9a0be1f8e7ef9b9a3558410e8 modeling_bashkir_roberta.py
8
  945e1ac0c79c4de1807635171a67c1ef65fac8dee9476ca989116a19978d1012 onnx/model_fp16.onnx
 
9
  7826c5f46be23f17838c7c3478d24f6ea0e29ebe388cae92a102cb125d5b1c19 onnx/model_int8.onnx
10
  4e77b9cfc9ab8c200406ee46c2d20fc46734da9ddcf01dff0f0e370f6c4ac244 spm_bashkir_bert_16k.model
11
  c26cefc431c25c359ddcd1f6587ab132a4240c12bb44151b2afb16a220610fa9 tokenization_bashkir_roberta.py
 
1
  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
2
+ 77975c6b9381d349c1dff08922132e287195dcc96d6c2e272cbc07ad7a2007b7 META.json
3
+ 59ffe0f4508a1c28f433e850fe817370ae81308c7e7d348cff6e4bd8f231290d README.md
4
  59b773953af5b2a69adb7e3c5d345a90f34f848f6a1543309d5acc7fb78b28c4 config.json
5
  e9f179aad7619153724920c86a90ecc3c161fd15ffc3332f200e9f2073a07f72 configuration_bashkir_roberta.py
6
  48e4d4e7b8af675d222e58e14776abac24b7e83a937d7884bd9d735ea9dd2173 model.safetensors
7
  3c1e098df93d6b47bc429268e87351afbaabf7d9a0be1f8e7ef9b9a3558410e8 modeling_bashkir_roberta.py
8
  945e1ac0c79c4de1807635171a67c1ef65fac8dee9476ca989116a19978d1012 onnx/model_fp16.onnx
9
+ 0ad099ef408b27f6fffaf21f3746efd2c2606514445dfa1ffb01d20dea88a3e4 onnx/model_fp32.onnx
10
  7826c5f46be23f17838c7c3478d24f6ea0e29ebe388cae92a102cb125d5b1c19 onnx/model_int8.onnx
11
  4e77b9cfc9ab8c200406ee46c2d20fc46734da9ddcf01dff0f0e370f6c4ac244 spm_bashkir_bert_16k.model
12
  c26cefc431c25c359ddcd1f6587ab132a4240c12bb44151b2afb16a220610fa9 tokenization_bashkir_roberta.py
onnx/model_fp32.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ad099ef408b27f6fffaf21f3746efd2c2606514445dfa1ffb01d20dea88a3e4
3
+ size 242207010