failed09 commited on
Commit
f762861
·
verified ·
1 Parent(s): a663551

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +98 -67
  2. SHA256SUMS +1 -1
README.md CHANGED
@@ -3,6 +3,7 @@ language:
3
  - ba
4
  - ru
5
  license: apache-2.0
 
6
  library_name: onnxruntime
7
  pipeline_tag: text-classification
8
  tags:
@@ -13,112 +14,142 @@ tags:
13
  - onnx
14
  - onnxruntime
15
  - low-resource
 
16
  ---
17
 
18
- # Bashkir Pair Scorer
19
 
20
- Compact ONNX models for estimating whether a Bashkir–Russian sentence pair is
21
- parallel and suitable for corpus filtering. The release contains three sizes:
 
 
22
 
23
- - `nano` — fastest first-pass filter;
24
- - `mini` — balanced default;
25
- - `medium` — strongest compact verifier.
26
 
27
- All models use the same SentencePiece vocabulary and the `fast128` profile:
28
- maximum 128 tokens, FP16 weights, dynamic batch dimension. The models return a
29
- single logit named `score_logit`. Apply sigmoid to obtain a probability-like
30
- score. The project API maps scores to `accepted`, `review` and `quarantine`
31
- using configurable thresholds; those thresholds are not universal and should
32
- be calibrated for a target corpus.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  ## Files
35
 
36
  | Path | Purpose |
37
- | --- | --- |
38
- | `models/nano/model.onnx` | fastest scorer |
39
- | `models/mini/model.onnx` | recommended default |
40
- | `models/medium/model.onnx` | higher-quality verifier |
41
- | `spm_bpe_16k.model` | shared tokenizer |
42
- | `config.json` | runtime contract |
43
- | `benchmark_summary.json` | reproducible benchmark index |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- ## Minimal inference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  ```python
48
  import numpy as np
49
  import onnxruntime as ort
50
  import sentencepiece as spm
51
 
52
- session = ort.InferenceSession("models/mini/model.onnx", providers=["CUDAExecutionProvider", "CPUExecutionProvider"])
53
- sp = spm.SentencePieceProcessor(model_file="spm_bpe_16k.model")
 
 
 
54
 
55
  def encode(ba, ru, max_len=128):
56
  limit = (max_len - 3) // 2
57
- ru_ids = sp.encode(ru, out_type=int)[:limit]
58
- ba_ids = sp.encode(ba, out_type=int)[:limit]
59
  ids = [1, *ru_ids, 2, *ba_ids, 2]
60
- ids += [sp.pad_id()] * (max_len - len(ids))
61
  ids = np.asarray([ids], dtype=np.int64)
62
- return {"input_ids": ids, "attention_mask": ids != sp.pad_id()}
63
 
64
  logit = session.run(["score_logit"], encode("Сәләм донъя", "Привет мир"))[0][0]
65
  score = float(1 / (1 + np.exp(-logit)))
66
  print(score)
67
  ```
68
 
69
- For corpus-scale jobs, use the source project's direct batch runner
70
- `scripts/score_pairs_batch.py`; it avoids HTTP/JSON overhead and streams
71
- Parquet, CSV/TSV and JSONL inputs.
72
-
73
- ## Benchmark
74
-
75
- The machine-readable comparison is in `benchmark_summary.json`. The evaluation
76
- uses a calibrated Aygiz-derived bilingual dataset with 10,000 positive pairs
77
- and 20,000 deterministic global and local hard negatives. This evaluation
78
- sample is excluded from training. Reference models are reported alongside the
79
- released ONNX scorers; LaBSE/LASER are included as quality baselines. The
80
- benchmark is intended for comparison, not as a guarantee of production
81
- precision on every corpus.
82
 
83
  ## Limitations
84
 
85
- These are alignment-quality scorers, not translation models. Scores are not
86
- human probabilities and must be calibrated on reviewed data. The training
87
- split used pair-level hard negatives, so document-level leakage or systematic
88
- source errors may remain. Do not treat `accepted` as a quality guarantee
89
- without a task-specific Gold audit.
 
 
90
 
91
  ## License
92
 
93
  Distributed under the [Apache-2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
94
- The models are released as derived alignment-scoring software and do not
95
- contain source corpus text.
96
-
97
- ## Loading
98
-
99
- ```python
100
- import numpy as np
101
- import onnxruntime as ort
102
- import sentencepiece as spm
103
-
104
- session = ort.InferenceSession(
105
- "models/mini/model.onnx",
106
- providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
107
- )
108
- tokenizer = spm.SentencePieceProcessor(model_file="spm_bpe_16k.model")
109
- ```
110
-
111
- Use the inference example above to prepare the two text inputs and apply a
112
- sigmoid to `score_logit`.
113
 
114
  ## Citation
115
 
116
  ```bibtex
117
- @software{bashkir_pair_scorer,
118
- title = {Bashkir Pair Scorer},
119
- author = {BashkirCorpus contributors},
120
  year = {2026},
121
  publisher = {Hugging Face},
122
- url = {https://huggingface.co/failed09/bashkir-pair-scorer}
 
123
  }
124
  ```
 
 
 
3
  - ba
4
  - ru
5
  license: apache-2.0
6
+ pretty_name: Bashkir-Russian Pair Scorer
7
  library_name: onnxruntime
8
  pipeline_tag: text-classification
9
  tags:
 
14
  - onnx
15
  - onnxruntime
16
  - low-resource
17
+ - open-source
18
  ---
19
 
20
+ # Bashkir-Russian Pair Scorer
21
 
22
+ Compact ONNX models for estimating whether a Bashkir-Russian sentence pair is
23
+ parallel and suitable for corpus filtering. The release is designed for fast,
24
+ repeatable scoring of large bilingual corpora and contains three model sizes:
25
+ `nano`, `mini` and `medium`.
26
 
27
+ This is an alignment-quality scorer, not a translation model. It returns a
28
+ compatibility score for a pair of texts and can be used to build a filtering
29
+ cascade for corpus preparation.
30
 
31
+ ## Configurations
32
+
33
+ ### nano
34
+
35
+ The smallest and fastest model for a first-pass filter. Use it to remove clear
36
+ non-parallel pairs before a more expensive verification stage.
37
+
38
+ ### mini
39
+
40
+ The recommended default for most batch jobs. It provides a good balance
41
+ between throughput, model size and discrimination quality.
42
+
43
+ ### medium
44
+
45
+ The strongest compact verifier in this release. Use it for the review layer or
46
+ when a higher-quality local scorer is preferred over maximum throughput.
47
+
48
+ All configurations use the same SentencePiece vocabulary and the `fast128`
49
+ profile: FP16 weights, dynamic batch dimension and a maximum of 128 tokens per
50
+ side. This is a deliberate production design for stable speed and predictable
51
+ memory use. Longer inputs are truncated before scoring.
52
 
53
  ## Files
54
 
55
  | Path | Purpose |
56
+ |---|---|
57
+ | `models/nano/model.onnx` | Fast first-pass scorer |
58
+ | `models/mini/model.onnx` | Recommended default scorer |
59
+ | `models/medium/model.onnx` | Compact higher-quality verifier |
60
+ | `spm_bpe_16k.model` | Shared SentencePiece tokenizer |
61
+ | `config.json` | Runtime contract and model metadata |
62
+ | `benchmark_summary.json` | Machine-readable evaluation results |
63
+ | `SHA256SUMS` | Release checksums |
64
+
65
+ ## Source and Processing
66
+
67
+ The models were trained and exported in the BashkirCorpus project for
68
+ Bashkir-Russian parallel-corpus quality estimation. Training used reviewed
69
+ parallel data with hard negative pairs and teacher/reference scoring signals.
70
+ The ONNX release contains model weights and tokenizer assets only; it does not
71
+ include the source corpus text.
72
+
73
+ The evaluation uses a calibrated Aygiz-derived bilingual dataset with 10,000
74
+ positive pairs and 20,000 deterministic global and local hard negatives. This
75
+ evaluation sample was excluded from training.
76
+
77
+ ## Benchmark
78
+
79
+ The benchmark compares the released scorers with compact and reference
80
+ alignment models. Results are reported in `benchmark_summary.json`.
81
 
82
+ | Model | ROC-AUC | Average Precision | RTX 4060 throughput |
83
+ |---|---:|---:|---:|
84
+ | LaBSE | 0.9944 | 0.9895 | 44.8 pairs/s |
85
+ | LaBSE + LASER | 0.9939 | 0.9871 | 44.8 pairs/s |
86
+ | DevLake BERT | 0.9896 | 0.9706 | 112.5 pairs/s |
87
+ | Medium Scorer | 0.9633 | 0.9155 | 2,555.9 pairs/s |
88
+ | Mini Scorer | 0.9590 | 0.9040 | 4,673.5 pairs/s |
89
+ | Nano Scorer | 0.9498 | 0.8785 | 7,472.2 pairs/s |
90
+
91
+ The compact scorers trade a small amount of discrimination quality for a large
92
+ throughput gain. A practical cascade is to use `nano` or `mini` for the first
93
+ pass, `medium` for uncertain pairs and LaBSE/LASER only for the final review
94
+ layer.
95
+
96
+ ## Loading
97
 
98
  ```python
99
  import numpy as np
100
  import onnxruntime as ort
101
  import sentencepiece as spm
102
 
103
+ session = ort.InferenceSession(
104
+ "models/mini/model.onnx",
105
+ providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
106
+ )
107
+ tokenizer = spm.SentencePieceProcessor(model_file="spm_bpe_16k.model")
108
 
109
  def encode(ba, ru, max_len=128):
110
  limit = (max_len - 3) // 2
111
+ ru_ids = tokenizer.encode(ru, out_type=int)[:limit]
112
+ ba_ids = tokenizer.encode(ba, out_type=int)[:limit]
113
  ids = [1, *ru_ids, 2, *ba_ids, 2]
114
+ ids += [tokenizer.pad_id()] * (max_len - len(ids))
115
  ids = np.asarray([ids], dtype=np.int64)
116
+ return {"input_ids": ids, "attention_mask": ids != tokenizer.pad_id()}
117
 
118
  logit = session.run(["score_logit"], encode("Сәләм донъя", "Привет мир"))[0][0]
119
  score = float(1 / (1 + np.exp(-logit)))
120
  print(score)
121
  ```
122
 
123
+ For corpus-scale jobs, use the direct batch runner from the source project to
124
+ avoid HTTP/JSON overhead and stream Parquet, CSV/TSV or JSONL inputs.
 
 
 
 
 
 
 
 
 
 
 
125
 
126
  ## Limitations
127
 
128
+ Scores are not calibrated human probabilities. The `accepted`, `review` and
129
+ `quarantine` thresholds must be calibrated for a target corpus and a reviewed
130
+ sample. The benchmark is intended for comparison and does not guarantee
131
+ production precision on every domain.
132
+
133
+ The `fast128` profile truncates long inputs. For long literary or document
134
+ segments, use a review layer with a longer-context scorer or LaBSE/LASER.
135
 
136
  ## License
137
 
138
  Distributed under the [Apache-2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
139
+ This release contains derived alignment-scoring software and model assets, not
140
+ source corpus text, scans or original page layouts.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
  ## Citation
143
 
144
  ```bibtex
145
+ @software{failed09_bashkir_pair_scorer_2026,
146
+ title = {Bashkir-Russian Pair Scorer},
147
+ author = {failed09},
148
  year = {2026},
149
  publisher = {Hugging Face},
150
+ url = {https://huggingface.co/failed09/bashkir-pair-scorer},
151
+ note = {Open-source compact alignment models for the Bashkir language}
152
  }
153
  ```
154
+
155
+ > Open-source models for the preservation and development of the Bashkir language.
SHA256SUMS CHANGED
@@ -4,6 +4,6 @@ c8136b9fade4a4643e96847f849dcedbdf570a08f233d6b2a3414d327163512a config.json
4
  d0bc430dcf2b7d3792f5e7912fc253012c2d8056f462f3932c341dbba02fd015 models/medium/model.onnx
5
  23693e6e3325638e28d54a6a63de33bc3d878ec971befb55725c9921c7801782 models/mini/model.onnx
6
  019f9b6ece175380bd56fc8554b6d3bb248e21a7e75a1715e1f8066102d49503 models/nano/model.onnx
7
- ccb32c8bf1eb0515dfb6d9ea552eaead0e7c0b5963e425c12e541c1b91e81d31 README.md
8
  de2ba873813f81fc5a87b135d0514f98474dff562270623b08dbba606d0734c3 spm_bpe_16k.model
9
  27179cf9aa04430679af3885abae45b80e6ba4b3efdef689e32a4d16564147de upload.py
 
4
  d0bc430dcf2b7d3792f5e7912fc253012c2d8056f462f3932c341dbba02fd015 models/medium/model.onnx
5
  23693e6e3325638e28d54a6a63de33bc3d878ec971befb55725c9921c7801782 models/mini/model.onnx
6
  019f9b6ece175380bd56fc8554b6d3bb248e21a7e75a1715e1f8066102d49503 models/nano/model.onnx
7
+ 16d2bf2f9e550627932ba9562264b598a009fc462e2877aedf11b8355e0331ae README.md
8
  de2ba873813f81fc5a87b135d0514f98474dff562270623b08dbba606d0734c3 spm_bpe_16k.model
9
  27179cf9aa04430679af3885abae45b80e6ba4b3efdef689e32a4d16564147de upload.py