clturner23 commited on
Commit
f19cf22
·
verified ·
1 Parent(s): 3457c9d

Upload trained CrossEncoder model for job description ranking

Browse files
Files changed (7) hide show
  1. README.md +309 -0
  2. config.json +35 -0
  3. model.safetensors +3 -0
  4. special_tokens_map.json +37 -0
  5. tokenizer.json +0 -0
  6. tokenizer_config.json +65 -0
  7. vocab.txt +0 -0
README.md ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - cross-encoder
5
+ - generated_from_trainer
6
+ - dataset_size:100
7
+ - loss:BinaryCrossEntropyLoss
8
+ base_model: cross-encoder/ms-marco-MiniLM-L4-v2
9
+ pipeline_tag: text-ranking
10
+ library_name: sentence-transformers
11
+ ---
12
+
13
+ # CrossEncoder based on cross-encoder/ms-marco-MiniLM-L4-v2
14
+
15
+ This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [cross-encoder/ms-marco-MiniLM-L4-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L4-v2) 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:** [cross-encoder/ms-marco-MiniLM-L4-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L4-v2) <!-- at revision d19c7578cd190e674bda2b51052768e43b61e747 -->
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("clturner23/cross_encoder_trained_model")
51
+ # Get scores for pairs of texts
52
+ pairs = [
53
+ ['accountant', 'Graphic designer creating logos.'],
54
+ ['software engineer', 'UX designer creating user interfaces.'],
55
+ ['accountant', 'Payroll clerk processing salaries.'],
56
+ ['architect', 'Structural engineer analyzing designs.'],
57
+ ['software engineer', 'Database administrator optimizing SQL queries.'],
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
+ 'accountant',
66
+ [
67
+ 'Graphic designer creating logos.',
68
+ 'UX designer creating user interfaces.',
69
+ 'Payroll clerk processing salaries.',
70
+ 'Structural engineer analyzing designs.',
71
+ 'Database administrator optimizing SQL queries.',
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: 100 training samples
120
+ * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
121
+ * Approximate statistics based on the first 100 samples:
122
+ | | sentence_0 | sentence_1 | label |
123
+ |:--------|:--------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
124
+ | type | string | string | float |
125
+ | details | <ul><li>min: 4 characters</li><li>mean: 8.5 characters</li><li>max: 17 characters</li></ul> | <ul><li>min: 21 characters</li><li>mean: 37.98 characters</li><li>max: 71 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.55</li><li>max: 1.0</li></ul> |
126
+ * Samples:
127
+ | sentence_0 | sentence_1 | label |
128
+ |:-------------------------------|:---------------------------------------------------|:-----------------|
129
+ | <code>accountant</code> | <code>Graphic designer creating logos.</code> | <code>0.0</code> |
130
+ | <code>software engineer</code> | <code>UX designer creating user interfaces.</code> | <code>0.0</code> |
131
+ | <code>accountant</code> | <code>Payroll clerk processing salaries.</code> | <code>1.0</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`: 4
144
+ - `per_device_eval_batch_size`: 4
145
+ - `num_train_epochs`: 10
146
+
147
+ #### All Hyperparameters
148
+ <details><summary>Click to expand</summary>
149
+
150
+ - `overwrite_output_dir`: False
151
+ - `do_predict`: False
152
+ - `eval_strategy`: no
153
+ - `prediction_loss_only`: True
154
+ - `per_device_train_batch_size`: 4
155
+ - `per_device_eval_batch_size`: 4
156
+ - `per_gpu_train_batch_size`: None
157
+ - `per_gpu_eval_batch_size`: None
158
+ - `gradient_accumulation_steps`: 1
159
+ - `eval_accumulation_steps`: None
160
+ - `torch_empty_cache_steps`: None
161
+ - `learning_rate`: 5e-05
162
+ - `weight_decay`: 0.0
163
+ - `adam_beta1`: 0.9
164
+ - `adam_beta2`: 0.999
165
+ - `adam_epsilon`: 1e-08
166
+ - `max_grad_norm`: 1
167
+ - `num_train_epochs`: 10
168
+ - `max_steps`: -1
169
+ - `lr_scheduler_type`: linear
170
+ - `lr_scheduler_kwargs`: {}
171
+ - `warmup_ratio`: 0.0
172
+ - `warmup_steps`: 0
173
+ - `log_level`: passive
174
+ - `log_level_replica`: warning
175
+ - `log_on_each_node`: True
176
+ - `logging_nan_inf_filter`: True
177
+ - `save_safetensors`: True
178
+ - `save_on_each_node`: False
179
+ - `save_only_model`: False
180
+ - `restore_callback_states_from_checkpoint`: False
181
+ - `no_cuda`: False
182
+ - `use_cpu`: False
183
+ - `use_mps_device`: False
184
+ - `seed`: 42
185
+ - `data_seed`: None
186
+ - `jit_mode_eval`: False
187
+ - `use_ipex`: False
188
+ - `bf16`: False
189
+ - `fp16`: False
190
+ - `fp16_opt_level`: O1
191
+ - `half_precision_backend`: auto
192
+ - `bf16_full_eval`: False
193
+ - `fp16_full_eval`: False
194
+ - `tf32`: None
195
+ - `local_rank`: 0
196
+ - `ddp_backend`: None
197
+ - `tpu_num_cores`: None
198
+ - `tpu_metrics_debug`: False
199
+ - `debug`: []
200
+ - `dataloader_drop_last`: False
201
+ - `dataloader_num_workers`: 0
202
+ - `dataloader_prefetch_factor`: None
203
+ - `past_index`: -1
204
+ - `disable_tqdm`: False
205
+ - `remove_unused_columns`: True
206
+ - `label_names`: None
207
+ - `load_best_model_at_end`: False
208
+ - `ignore_data_skip`: False
209
+ - `fsdp`: []
210
+ - `fsdp_min_num_params`: 0
211
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
212
+ - `tp_size`: 0
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
+ - `gradient_checkpointing`: False
236
+ - `gradient_checkpointing_kwargs`: None
237
+ - `include_inputs_for_metrics`: False
238
+ - `include_for_metrics`: []
239
+ - `eval_do_concat_batches`: True
240
+ - `fp16_backend`: auto
241
+ - `push_to_hub_model_id`: None
242
+ - `push_to_hub_organization`: None
243
+ - `mp_parameters`:
244
+ - `auto_find_batch_size`: False
245
+ - `full_determinism`: False
246
+ - `torchdynamo`: None
247
+ - `ray_scope`: last
248
+ - `ddp_timeout`: 1800
249
+ - `torch_compile`: False
250
+ - `torch_compile_backend`: None
251
+ - `torch_compile_mode`: None
252
+ - `include_tokens_per_second`: False
253
+ - `include_num_input_tokens_seen`: False
254
+ - `neftune_noise_alpha`: None
255
+ - `optim_target_modules`: None
256
+ - `batch_eval_metrics`: False
257
+ - `eval_on_start`: False
258
+ - `use_liger_kernel`: False
259
+ - `eval_use_gather_object`: False
260
+ - `average_tokens_across_devices`: False
261
+ - `prompts`: None
262
+ - `batch_sampler`: batch_sampler
263
+ - `multi_dataset_batch_sampler`: proportional
264
+
265
+ </details>
266
+
267
+ ### Framework Versions
268
+ - Python: 3.11.12
269
+ - Sentence Transformers: 4.1.0
270
+ - Transformers: 4.51.3
271
+ - PyTorch: 2.6.0+cu124
272
+ - Accelerate: 1.6.0
273
+ - Datasets: 2.14.4
274
+ - Tokenizers: 0.21.1
275
+
276
+ ## Citation
277
+
278
+ ### BibTeX
279
+
280
+ #### Sentence Transformers
281
+ ```bibtex
282
+ @inproceedings{reimers-2019-sentence-bert,
283
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
284
+ author = "Reimers, Nils and Gurevych, Iryna",
285
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
286
+ month = "11",
287
+ year = "2019",
288
+ publisher = "Association for Computational Linguistics",
289
+ url = "https://arxiv.org/abs/1908.10084",
290
+ }
291
+ ```
292
+
293
+ <!--
294
+ ## Glossary
295
+
296
+ *Clearly define terms in order to be accessible across audiences.*
297
+ -->
298
+
299
+ <!--
300
+ ## Model Card Authors
301
+
302
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
303
+ -->
304
+
305
+ <!--
306
+ ## Model Card Contact
307
+
308
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
309
+ -->
config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "gradient_checkpointing": false,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 384,
11
+ "id2label": {
12
+ "0": "LABEL_0"
13
+ },
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 1536,
16
+ "label2id": {
17
+ "LABEL_0": 0
18
+ },
19
+ "layer_norm_eps": 1e-12,
20
+ "max_position_embeddings": 512,
21
+ "model_type": "bert",
22
+ "num_attention_heads": 12,
23
+ "num_hidden_layers": 4,
24
+ "pad_token_id": 0,
25
+ "position_embedding_type": "absolute",
26
+ "sentence_transformers": {
27
+ "activation_fn": "torch.nn.modules.linear.Identity",
28
+ "version": "4.1.0"
29
+ },
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.51.3",
32
+ "type_vocab_size": 2,
33
+ "use_cache": true,
34
+ "vocab_size": 30522
35
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b7b05f4293de9fa37ff63372d7a27400a4cd338ae4f49a6b3ff667e4cd694cd
3
+ size 76667004
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,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": true,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "max_length": 512,
51
+ "model_max_length": 512,
52
+ "never_split": null,
53
+ "pad_to_multiple_of": null,
54
+ "pad_token": "[PAD]",
55
+ "pad_token_type_id": 0,
56
+ "padding_side": "right",
57
+ "sep_token": "[SEP]",
58
+ "stride": 0,
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "BertTokenizer",
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "[UNK]"
65
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff