dleemiller commited on
Commit
89cf932
·
verified ·
1 Parent(s): aa6c2bf

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,357 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - cross-encoder
5
+ - reranker
6
+ - generated_from_trainer
7
+ - dataset_size:5749
8
+ - loss:BinaryCrossEntropyLoss
9
+ pipeline_tag: text-ranking
10
+ library_name: sentence-transformers
11
+ metrics:
12
+ - pearson
13
+ - spearman
14
+ model-index:
15
+ - name: CrossEncoder
16
+ results:
17
+ - task:
18
+ type: cross-encoder-correlation
19
+ name: Cross Encoder Correlation
20
+ dataset:
21
+ name: sts validation
22
+ type: sts-validation
23
+ metrics:
24
+ - type: pearson
25
+ value: 0.8859307010127053
26
+ name: Pearson
27
+ - type: spearman
28
+ value: 0.8833616735795622
29
+ name: Spearman
30
+ ---
31
+
32
+ # CrossEncoder
33
+
34
+ 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.
35
+
36
+ ## Model Details
37
+
38
+ ### Model Description
39
+ - **Model Type:** Cross Encoder
40
+ <!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
41
+ - **Maximum Sequence Length:** 512 tokens
42
+ - **Number of Output Labels:** 1 label
43
+ <!-- - **Training Dataset:** Unknown -->
44
+ <!-- - **Language:** Unknown -->
45
+ <!-- - **License:** Unknown -->
46
+
47
+ ### Model Sources
48
+
49
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
50
+ - **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
51
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
52
+ - **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
53
+
54
+ ## Usage
55
+
56
+ ### Direct Usage (Sentence Transformers)
57
+
58
+ First install the Sentence Transformers library:
59
+
60
+ ```bash
61
+ pip install -U sentence-transformers
62
+ ```
63
+
64
+ Then you can load this model and run inference.
65
+ ```python
66
+ from sentence_transformers import CrossEncoder
67
+
68
+ # Download from the 🤗 Hub
69
+ model = CrossEncoder("cross_encoder_model_id")
70
+ # Get scores for pairs of texts
71
+ pairs = [
72
+ ['The little boy is singing and playing the guitar.', 'A baby is playing a guitar.'],
73
+ ['executive director of the arms control association in washington daryl kimball stated that-- the iaea report is 1 in a series of bad signs. ', 'executive director of the arms control association in washington daryl kimball stated the israeli document could affect the debate over india.'],
74
+ ['it did not say if the men had been hanged in prison. ', 'dozens of such criminals have been hanged in public.'],
75
+ ['Child sliding in the snow.', 'Man sleeping on the street.'],
76
+ ["Your confusion doesn't make me a liar.", "Then your confusion doesn't make me a liar either."],
77
+ ]
78
+ scores = model.predict(pairs)
79
+ print(scores.shape)
80
+ # (5,)
81
+
82
+ # Or rank different texts based on similarity to a single text
83
+ ranks = model.rank(
84
+ 'The little boy is singing and playing the guitar.',
85
+ [
86
+ 'A baby is playing a guitar.',
87
+ 'executive director of the arms control association in washington daryl kimball stated the israeli document could affect the debate over india.',
88
+ 'dozens of such criminals have been hanged in public.',
89
+ 'Man sleeping on the street.',
90
+ "Then your confusion doesn't make me a liar either.",
91
+ ]
92
+ )
93
+ # [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
94
+ ```
95
+
96
+ <!--
97
+ ### Direct Usage (Transformers)
98
+
99
+ <details><summary>Click to see the direct usage in Transformers</summary>
100
+
101
+ </details>
102
+ -->
103
+
104
+ <!--
105
+ ### Downstream Usage (Sentence Transformers)
106
+
107
+ You can finetune this model on your own dataset.
108
+
109
+ <details><summary>Click to expand</summary>
110
+
111
+ </details>
112
+ -->
113
+
114
+ <!--
115
+ ### Out-of-Scope Use
116
+
117
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
118
+ -->
119
+
120
+ ## Evaluation
121
+
122
+ ### Metrics
123
+
124
+ #### Cross Encoder Correlation
125
+
126
+ * Dataset: `sts-validation`
127
+ * Evaluated with [<code>CECorrelationEvaluator</code>](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CECorrelationEvaluator)
128
+
129
+ | Metric | Value |
130
+ |:-------------|:-----------|
131
+ | pearson | 0.8859 |
132
+ | **spearman** | **0.8834** |
133
+
134
+ <!--
135
+ ## Bias, Risks and Limitations
136
+
137
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
138
+ -->
139
+
140
+ <!--
141
+ ### Recommendations
142
+
143
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
144
+ -->
145
+
146
+ ## Training Details
147
+
148
+ ### Training Dataset
149
+
150
+ #### Unnamed Dataset
151
+
152
+ * Size: 5,749 training samples
153
+ * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
154
+ * Approximate statistics based on the first 1000 samples:
155
+ | | sentence_0 | sentence_1 | label |
156
+ |:--------|:------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
157
+ | type | string | string | float |
158
+ | details | <ul><li>min: 17 characters</li><li>mean: 56.58 characters</li><li>max: 234 characters</li></ul> | <ul><li>min: 16 characters</li><li>mean: 57.3 characters</li><li>max: 235 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.53</li><li>max: 1.0</li></ul> |
159
+ * Samples:
160
+ | sentence_0 | sentence_1 | label |
161
+ |:----------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------|
162
+ | <code>The little boy is singing and playing the guitar.</code> | <code>A baby is playing a guitar.</code> | <code>0.56</code> |
163
+ | <code>executive director of the arms control association in washington daryl kimball stated that-- the iaea report is 1 in a series of bad signs. </code> | <code>executive director of the arms control association in washington daryl kimball stated the israeli document could affect the debate over india.</code> | <code>0.72</code> |
164
+ | <code>it did not say if the men had been hanged in prison. </code> | <code>dozens of such criminals have been hanged in public.</code> | <code>0.36</code> |
165
+ * Loss: [<code>BinaryCrossEntropyLoss</code>](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
166
+ ```json
167
+ {
168
+ "activation_fn": "torch.nn.modules.linear.Identity",
169
+ "pos_weight": null
170
+ }
171
+ ```
172
+
173
+ ### Training Hyperparameters
174
+ #### Non-Default Hyperparameters
175
+
176
+ - `eval_strategy`: steps
177
+ - `per_device_train_batch_size`: 96
178
+ - `per_device_eval_batch_size`: 96
179
+ - `fp16`: True
180
+
181
+ #### All Hyperparameters
182
+ <details><summary>Click to expand</summary>
183
+
184
+ - `overwrite_output_dir`: False
185
+ - `do_predict`: False
186
+ - `eval_strategy`: steps
187
+ - `prediction_loss_only`: True
188
+ - `per_device_train_batch_size`: 96
189
+ - `per_device_eval_batch_size`: 96
190
+ - `per_gpu_train_batch_size`: None
191
+ - `per_gpu_eval_batch_size`: None
192
+ - `gradient_accumulation_steps`: 1
193
+ - `eval_accumulation_steps`: None
194
+ - `torch_empty_cache_steps`: None
195
+ - `learning_rate`: 5e-05
196
+ - `weight_decay`: 0.0
197
+ - `adam_beta1`: 0.9
198
+ - `adam_beta2`: 0.999
199
+ - `adam_epsilon`: 1e-08
200
+ - `max_grad_norm`: 1
201
+ - `num_train_epochs`: 3
202
+ - `max_steps`: -1
203
+ - `lr_scheduler_type`: linear
204
+ - `lr_scheduler_kwargs`: {}
205
+ - `warmup_ratio`: 0.0
206
+ - `warmup_steps`: 0
207
+ - `log_level`: passive
208
+ - `log_level_replica`: warning
209
+ - `log_on_each_node`: True
210
+ - `logging_nan_inf_filter`: True
211
+ - `save_safetensors`: True
212
+ - `save_on_each_node`: False
213
+ - `save_only_model`: False
214
+ - `restore_callback_states_from_checkpoint`: False
215
+ - `no_cuda`: False
216
+ - `use_cpu`: False
217
+ - `use_mps_device`: False
218
+ - `seed`: 42
219
+ - `data_seed`: None
220
+ - `jit_mode_eval`: False
221
+ - `use_ipex`: False
222
+ - `bf16`: False
223
+ - `fp16`: True
224
+ - `fp16_opt_level`: O1
225
+ - `half_precision_backend`: auto
226
+ - `bf16_full_eval`: False
227
+ - `fp16_full_eval`: False
228
+ - `tf32`: None
229
+ - `local_rank`: 0
230
+ - `ddp_backend`: None
231
+ - `tpu_num_cores`: None
232
+ - `tpu_metrics_debug`: False
233
+ - `debug`: []
234
+ - `dataloader_drop_last`: False
235
+ - `dataloader_num_workers`: 0
236
+ - `dataloader_prefetch_factor`: None
237
+ - `past_index`: -1
238
+ - `disable_tqdm`: False
239
+ - `remove_unused_columns`: True
240
+ - `label_names`: None
241
+ - `load_best_model_at_end`: False
242
+ - `ignore_data_skip`: False
243
+ - `fsdp`: []
244
+ - `fsdp_min_num_params`: 0
245
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
246
+ - `tp_size`: 0
247
+ - `fsdp_transformer_layer_cls_to_wrap`: None
248
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
249
+ - `deepspeed`: None
250
+ - `label_smoothing_factor`: 0.0
251
+ - `optim`: adamw_torch
252
+ - `optim_args`: None
253
+ - `adafactor`: False
254
+ - `group_by_length`: False
255
+ - `length_column_name`: length
256
+ - `ddp_find_unused_parameters`: None
257
+ - `ddp_bucket_cap_mb`: None
258
+ - `ddp_broadcast_buffers`: False
259
+ - `dataloader_pin_memory`: True
260
+ - `dataloader_persistent_workers`: False
261
+ - `skip_memory_metrics`: True
262
+ - `use_legacy_prediction_loop`: False
263
+ - `push_to_hub`: False
264
+ - `resume_from_checkpoint`: None
265
+ - `hub_model_id`: None
266
+ - `hub_strategy`: every_save
267
+ - `hub_private_repo`: None
268
+ - `hub_always_push`: False
269
+ - `gradient_checkpointing`: False
270
+ - `gradient_checkpointing_kwargs`: None
271
+ - `include_inputs_for_metrics`: False
272
+ - `include_for_metrics`: []
273
+ - `eval_do_concat_batches`: True
274
+ - `fp16_backend`: auto
275
+ - `push_to_hub_model_id`: None
276
+ - `push_to_hub_organization`: None
277
+ - `mp_parameters`:
278
+ - `auto_find_batch_size`: False
279
+ - `full_determinism`: False
280
+ - `torchdynamo`: None
281
+ - `ray_scope`: last
282
+ - `ddp_timeout`: 1800
283
+ - `torch_compile`: False
284
+ - `torch_compile_backend`: None
285
+ - `torch_compile_mode`: None
286
+ - `include_tokens_per_second`: False
287
+ - `include_num_input_tokens_seen`: False
288
+ - `neftune_noise_alpha`: None
289
+ - `optim_target_modules`: None
290
+ - `batch_eval_metrics`: False
291
+ - `eval_on_start`: False
292
+ - `use_liger_kernel`: False
293
+ - `eval_use_gather_object`: False
294
+ - `average_tokens_across_devices`: False
295
+ - `prompts`: None
296
+ - `batch_sampler`: batch_sampler
297
+ - `multi_dataset_batch_sampler`: proportional
298
+ - `router_mapping`: {}
299
+ - `learning_rate_mapping`: {}
300
+
301
+ </details>
302
+
303
+ ### Training Logs
304
+ | Epoch | Step | sts-validation_spearman |
305
+ |:------:|:----:|:-----------------------:|
306
+ | 0.3333 | 20 | 0.8758 |
307
+ | 0.6667 | 40 | 0.8787 |
308
+ | 1.0 | 60 | 0.8800 |
309
+ | 1.3333 | 80 | 0.8796 |
310
+ | 1.6667 | 100 | 0.8813 |
311
+ | 2.0 | 120 | 0.8826 |
312
+ | 2.3333 | 140 | 0.8834 |
313
+
314
+
315
+ ### Framework Versions
316
+ - Python: 3.12.2
317
+ - Sentence Transformers: 5.0.0
318
+ - Transformers: 4.51.3
319
+ - PyTorch: 2.7.1+cu126
320
+ - Accelerate: 1.9.0
321
+ - Datasets: 4.0.0
322
+ - Tokenizers: 0.21.2
323
+
324
+ ## Citation
325
+
326
+ ### BibTeX
327
+
328
+ #### Sentence Transformers
329
+ ```bibtex
330
+ @inproceedings{reimers-2019-sentence-bert,
331
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
332
+ author = "Reimers, Nils and Gurevych, Iryna",
333
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
334
+ month = "11",
335
+ year = "2019",
336
+ publisher = "Association for Computational Linguistics",
337
+ url = "https://arxiv.org/abs/1908.10084",
338
+ }
339
+ ```
340
+
341
+ <!--
342
+ ## Glossary
343
+
344
+ *Clearly define terms in order to be accessible across audiences.*
345
+ -->
346
+
347
+ <!--
348
+ ## Model Card Authors
349
+
350
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
351
+ -->
352
+
353
+ <!--
354
+ ## Model Card Contact
355
+
356
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
357
+ -->
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.3,
6
+ "classifier_dropout": 0.1,
7
+ "hidden_act": "gelu",
8
+ "hidden_dropout_prob": 0.3,
9
+ "hidden_size": 384,
10
+ "id2label": {
11
+ "0": "LABEL_0"
12
+ },
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 1536,
15
+ "label2id": {
16
+ "LABEL_0": 0
17
+ },
18
+ "layer_norm_eps": 1e-12,
19
+ "max_position_embeddings": 512,
20
+ "model_type": "bert",
21
+ "num_attention_heads": 12,
22
+ "num_hidden_layers": 6,
23
+ "pad_token_id": 0,
24
+ "position_embedding_type": "absolute",
25
+ "sentence_transformers": {
26
+ "activation_fn": "torch.nn.modules.activation.Sigmoid",
27
+ "version": "5.0.0"
28
+ },
29
+ "torch_dtype": "float32",
30
+ "transformers_version": "4.51.3",
31
+ "type_vocab_size": 2,
32
+ "use_cache": true,
33
+ "vocab_size": 30522
34
+ }
eval/CrossEncoderCorrelationEvaluator_sts-test-eval_results.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ epoch,steps,Pearson_Correlation,Spearman_Correlation
2
+ -1,-1,0.8578400847296047,0.8479099561443355
3
+ -1,-1,0.8391974525981273,0.8335150811870069
eval/CrossEncoderCorrelationEvaluator_sts-validation-eval_results.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ epoch,steps,Pearson_Correlation,Spearman_Correlation
2
+ -1,-1,0.8859307010127053,0.8833616735795622
3
+ -1,-1,0.8823145257832288,0.8806692410467581
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1841447465214e64260b347b087cd5fcb3c2256e1919bbd0fbc8e5037a2473c
3
+ size 90866412
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,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
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": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "max_length": 512,
50
+ "model_max_length": 512,
51
+ "pad_to_multiple_of": null,
52
+ "pad_token": "[PAD]",
53
+ "pad_token_type_id": 0,
54
+ "padding_side": "right",
55
+ "sep_token": "[SEP]",
56
+ "stride": 0,
57
+ "strip_accents": null,
58
+ "tokenize_chinese_chars": true,
59
+ "tokenizer_class": "BertTokenizer",
60
+ "truncation_side": "right",
61
+ "truncation_strategy": "longest_first",
62
+ "unk_token": "[UNK]"
63
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff