foochun commited on
Commit
76a7d5b
·
verified ·
1 Parent(s): dd20515

finetuned with additional names

Browse files
Files changed (8) hide show
  1. README.md +322 -0
  2. config.json +37 -0
  3. merges.txt +0 -0
  4. model.safetensors +3 -0
  5. special_tokens_map.json +51 -0
  6. tokenizer.json +0 -0
  7. tokenizer_config.json +66 -0
  8. vocab.json +0 -0
README.md ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - cross-encoder
5
+ - reranker
6
+ - generated_from_trainer
7
+ - dataset_size:30415
8
+ - loss:BinaryCrossEntropyLoss
9
+ pipeline_tag: text-ranking
10
+ library_name: sentence-transformers
11
+ ---
12
+
13
+ # CrossEncoder
14
+
15
+ This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model trained using the [sentence-transformers](https://www.SBERT.net) library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
16
+
17
+ ## Model Details
18
+
19
+ ### Model Description
20
+ - **Model Type:** Cross Encoder
21
+ <!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
22
+ - **Maximum Sequence Length:** 512 tokens
23
+ - **Number of Output Labels:** 1 label
24
+ <!-- - **Training Dataset:** Unknown -->
25
+ <!-- - **Language:** Unknown -->
26
+ <!-- - **License:** Unknown -->
27
+
28
+ ### Model Sources
29
+
30
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
31
+ - **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
32
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
33
+ - **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
34
+
35
+ ## Usage
36
+
37
+ ### Direct Usage (Sentence Transformers)
38
+
39
+ First install the Sentence Transformers library:
40
+
41
+ ```bash
42
+ pip install -U sentence-transformers
43
+ ```
44
+
45
+ Then you can load this model and run inference.
46
+ ```python
47
+ from sentence_transformers import CrossEncoder
48
+
49
+ # Download from the 🤗 Hub
50
+ model = CrossEncoder("foochun/bge-reranker-ft-v2")
51
+ # Get scores for pairs of texts
52
+ pairs = [
53
+ ['ruben s/o veerasamy', 'ruben a/p veerasamy'],
54
+ ['aravind a/l krishnamurthy', 'krishnamurthy s/o aravind'],
55
+ ['nazmi bin ishak', 'siti rohani binti kassim'],
56
+ ['lena yap zhen liang', 'liang zhen yap'],
57
+ ['radhika a/p krishnan', 'radhika a/p arun'],
58
+ ]
59
+ scores = model.predict(pairs)
60
+ print(scores.shape)
61
+ # (5,)
62
+
63
+ # Or rank different texts based on similarity to a single text
64
+ ranks = model.rank(
65
+ 'ruben s/o veerasamy',
66
+ [
67
+ 'ruben a/p veerasamy',
68
+ 'krishnamurthy s/o aravind',
69
+ 'siti rohani binti kassim',
70
+ 'liang zhen yap',
71
+ 'radhika a/p arun',
72
+ ]
73
+ )
74
+ # [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
75
+ ```
76
+
77
+ <!--
78
+ ### Direct Usage (Transformers)
79
+
80
+ <details><summary>Click to see the direct usage in Transformers</summary>
81
+
82
+ </details>
83
+ -->
84
+
85
+ <!--
86
+ ### Downstream Usage (Sentence Transformers)
87
+
88
+ You can finetune this model on your own dataset.
89
+
90
+ <details><summary>Click to expand</summary>
91
+
92
+ </details>
93
+ -->
94
+
95
+ <!--
96
+ ### Out-of-Scope Use
97
+
98
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
99
+ -->
100
+
101
+ <!--
102
+ ## Bias, Risks and Limitations
103
+
104
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
105
+ -->
106
+
107
+ <!--
108
+ ### Recommendations
109
+
110
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
111
+ -->
112
+
113
+ ## Training Details
114
+
115
+ ### Training Dataset
116
+
117
+ #### Unnamed Dataset
118
+
119
+ * Size: 30,415 training samples
120
+ * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
121
+ * Approximate statistics based on the first 1000 samples:
122
+ | | sentence_0 | sentence_1 | label |
123
+ |:--------|:-----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|:----------------------------------------------------------------|
124
+ | type | string | string | float |
125
+ | details | <ul><li>min: 10 characters</li><li>mean: 20.81 characters</li><li>max: 45 characters</li></ul> | <ul><li>min: 9 characters</li><li>mean: 19.08 characters</li><li>max: 46 characters</li></ul> | <ul><li>min: 0.55</li><li>mean: 0.74</li><li>max: 1.0</li></ul> |
126
+ * Samples:
127
+ | sentence_0 | sentence_1 | label |
128
+ |:---------------------------------------|:---------------------------------------|:-------------------|
129
+ | <code>ruben s/o veerasamy</code> | <code>ruben a/p veerasamy</code> | <code>0.623</code> |
130
+ | <code>aravind a/l krishnamurthy</code> | <code>krishnamurthy s/o aravind</code> | <code>0.55</code> |
131
+ | <code>nazmi bin ishak</code> | <code>siti rohani binti kassim</code> | <code>0.55</code> |
132
+ * Loss: [<code>BinaryCrossEntropyLoss</code>](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
133
+ ```json
134
+ {
135
+ "activation_fn": "torch.nn.modules.linear.Identity",
136
+ "pos_weight": null
137
+ }
138
+ ```
139
+
140
+ ### Training Hyperparameters
141
+ #### Non-Default Hyperparameters
142
+
143
+ - `per_device_train_batch_size`: 64
144
+ - `per_device_eval_batch_size`: 64
145
+ - `num_train_epochs`: 5
146
+ - `fp16`: True
147
+
148
+ #### All Hyperparameters
149
+ <details><summary>Click to expand</summary>
150
+
151
+ - `overwrite_output_dir`: False
152
+ - `do_predict`: False
153
+ - `eval_strategy`: no
154
+ - `prediction_loss_only`: True
155
+ - `per_device_train_batch_size`: 64
156
+ - `per_device_eval_batch_size`: 64
157
+ - `per_gpu_train_batch_size`: None
158
+ - `per_gpu_eval_batch_size`: None
159
+ - `gradient_accumulation_steps`: 1
160
+ - `eval_accumulation_steps`: None
161
+ - `torch_empty_cache_steps`: None
162
+ - `learning_rate`: 5e-05
163
+ - `weight_decay`: 0.0
164
+ - `adam_beta1`: 0.9
165
+ - `adam_beta2`: 0.999
166
+ - `adam_epsilon`: 1e-08
167
+ - `max_grad_norm`: 1
168
+ - `num_train_epochs`: 5
169
+ - `max_steps`: -1
170
+ - `lr_scheduler_type`: linear
171
+ - `lr_scheduler_kwargs`: {}
172
+ - `warmup_ratio`: 0.0
173
+ - `warmup_steps`: 0
174
+ - `log_level`: passive
175
+ - `log_level_replica`: warning
176
+ - `log_on_each_node`: True
177
+ - `logging_nan_inf_filter`: True
178
+ - `save_safetensors`: True
179
+ - `save_on_each_node`: False
180
+ - `save_only_model`: False
181
+ - `restore_callback_states_from_checkpoint`: False
182
+ - `no_cuda`: False
183
+ - `use_cpu`: False
184
+ - `use_mps_device`: False
185
+ - `seed`: 42
186
+ - `data_seed`: None
187
+ - `jit_mode_eval`: False
188
+ - `use_ipex`: False
189
+ - `bf16`: False
190
+ - `fp16`: True
191
+ - `fp16_opt_level`: O1
192
+ - `half_precision_backend`: auto
193
+ - `bf16_full_eval`: False
194
+ - `fp16_full_eval`: False
195
+ - `tf32`: None
196
+ - `local_rank`: 0
197
+ - `ddp_backend`: None
198
+ - `tpu_num_cores`: None
199
+ - `tpu_metrics_debug`: False
200
+ - `debug`: []
201
+ - `dataloader_drop_last`: False
202
+ - `dataloader_num_workers`: 0
203
+ - `dataloader_prefetch_factor`: None
204
+ - `past_index`: -1
205
+ - `disable_tqdm`: False
206
+ - `remove_unused_columns`: True
207
+ - `label_names`: None
208
+ - `load_best_model_at_end`: False
209
+ - `ignore_data_skip`: False
210
+ - `fsdp`: []
211
+ - `fsdp_min_num_params`: 0
212
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
213
+ - `fsdp_transformer_layer_cls_to_wrap`: None
214
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
215
+ - `deepspeed`: None
216
+ - `label_smoothing_factor`: 0.0
217
+ - `optim`: adamw_torch
218
+ - `optim_args`: None
219
+ - `adafactor`: False
220
+ - `group_by_length`: False
221
+ - `length_column_name`: length
222
+ - `ddp_find_unused_parameters`: None
223
+ - `ddp_bucket_cap_mb`: None
224
+ - `ddp_broadcast_buffers`: False
225
+ - `dataloader_pin_memory`: True
226
+ - `dataloader_persistent_workers`: False
227
+ - `skip_memory_metrics`: True
228
+ - `use_legacy_prediction_loop`: False
229
+ - `push_to_hub`: False
230
+ - `resume_from_checkpoint`: None
231
+ - `hub_model_id`: None
232
+ - `hub_strategy`: every_save
233
+ - `hub_private_repo`: None
234
+ - `hub_always_push`: False
235
+ - `hub_revision`: None
236
+ - `gradient_checkpointing`: False
237
+ - `gradient_checkpointing_kwargs`: None
238
+ - `include_inputs_for_metrics`: False
239
+ - `include_for_metrics`: []
240
+ - `eval_do_concat_batches`: True
241
+ - `fp16_backend`: auto
242
+ - `push_to_hub_model_id`: None
243
+ - `push_to_hub_organization`: None
244
+ - `mp_parameters`:
245
+ - `auto_find_batch_size`: False
246
+ - `full_determinism`: False
247
+ - `torchdynamo`: None
248
+ - `ray_scope`: last
249
+ - `ddp_timeout`: 1800
250
+ - `torch_compile`: False
251
+ - `torch_compile_backend`: None
252
+ - `torch_compile_mode`: None
253
+ - `include_tokens_per_second`: False
254
+ - `include_num_input_tokens_seen`: False
255
+ - `neftune_noise_alpha`: None
256
+ - `optim_target_modules`: None
257
+ - `batch_eval_metrics`: False
258
+ - `eval_on_start`: False
259
+ - `use_liger_kernel`: False
260
+ - `liger_kernel_config`: None
261
+ - `eval_use_gather_object`: False
262
+ - `average_tokens_across_devices`: False
263
+ - `prompts`: None
264
+ - `batch_sampler`: batch_sampler
265
+ - `multi_dataset_batch_sampler`: proportional
266
+ - `router_mapping`: {}
267
+ - `learning_rate_mapping`: {}
268
+
269
+ </details>
270
+
271
+ ### Training Logs
272
+ | Epoch | Step | Training Loss |
273
+ |:------:|:----:|:-------------:|
274
+ | 1.0504 | 500 | 0.4667 |
275
+ | 2.1008 | 1000 | 0.4669 |
276
+ | 3.1513 | 1500 | 0.4658 |
277
+ | 4.2017 | 2000 | 0.4664 |
278
+
279
+
280
+ ### Framework Versions
281
+ - Python: 3.11.9
282
+ - Sentence Transformers: 5.0.0
283
+ - Transformers: 4.53.0
284
+ - PyTorch: 2.6.0+cu124
285
+ - Accelerate: 1.8.1
286
+ - Datasets: 3.6.0
287
+ - Tokenizers: 0.21.2
288
+
289
+ ## Citation
290
+
291
+ ### BibTeX
292
+
293
+ #### Sentence Transformers
294
+ ```bibtex
295
+ @inproceedings{reimers-2019-sentence-bert,
296
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
297
+ author = "Reimers, Nils and Gurevych, Iryna",
298
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
299
+ month = "11",
300
+ year = "2019",
301
+ publisher = "Association for Computational Linguistics",
302
+ url = "https://arxiv.org/abs/1908.10084",
303
+ }
304
+ ```
305
+
306
+ <!--
307
+ ## Glossary
308
+
309
+ *Clearly define terms in order to be accessible across audiences.*
310
+ -->
311
+
312
+ <!--
313
+ ## Model Card Authors
314
+
315
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
316
+ -->
317
+
318
+ <!--
319
+ ## Model Card Contact
320
+
321
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
322
+ -->
config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "RobertaForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "eos_token_id": 2,
9
+ "gradient_checkpointing": false,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 768,
13
+ "id2label": {
14
+ "0": "LABEL_0"
15
+ },
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 3072,
18
+ "label2id": {
19
+ "LABEL_0": 0
20
+ },
21
+ "layer_norm_eps": 1e-05,
22
+ "max_position_embeddings": 514,
23
+ "model_type": "roberta",
24
+ "num_attention_heads": 12,
25
+ "num_hidden_layers": 12,
26
+ "pad_token_id": 1,
27
+ "position_embedding_type": "absolute",
28
+ "sentence_transformers": {
29
+ "activation_fn": "torch.nn.modules.activation.Sigmoid",
30
+ "version": "5.0.0"
31
+ },
32
+ "torch_dtype": "float32",
33
+ "transformers_version": "4.53.2",
34
+ "type_vocab_size": 1,
35
+ "use_cache": true,
36
+ "vocab_size": 50265
37
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59a5c1e90b355682d5319edde509f646c127eea8493dcc7ff63bc13b0dc648d5
3
+ size 498609748
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "50264": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": true,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ }
44
+ },
45
+ "bos_token": "<s>",
46
+ "clean_up_tokenization_spaces": false,
47
+ "cls_token": "<s>",
48
+ "eos_token": "</s>",
49
+ "errors": "replace",
50
+ "extra_special_tokens": {},
51
+ "full_tokenizer_file": null,
52
+ "mask_token": "<mask>",
53
+ "max_length": 512,
54
+ "model_max_length": 512,
55
+ "pad_to_multiple_of": null,
56
+ "pad_token": "<pad>",
57
+ "pad_token_type_id": 0,
58
+ "padding_side": "right",
59
+ "sep_token": "</s>",
60
+ "stride": 0,
61
+ "tokenizer_class": "RobertaTokenizer",
62
+ "trim_offsets": true,
63
+ "truncation_side": "right",
64
+ "truncation_strategy": "longest_first",
65
+ "unk_token": "<unk>"
66
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff