RonanMcGovern commited on
Commit
c164766
1 Parent(s): ad5dabc

Add new SentenceTransformer model.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 384,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": true,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": false,
9
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: []
3
+ library_name: sentence-transformers
4
+ tags:
5
+ - sentence-transformers
6
+ - sentence-similarity
7
+ - feature-extraction
8
+ - generated_from_trainer
9
+ - dataset_size:19
10
+ - loss:TripletLoss
11
+ base_model: sentence-transformers/all-MiniLM-L12-v2
12
+ datasets: []
13
+ widget: []
14
+ pipeline_tag: sentence-similarity
15
+ ---
16
+
17
+ # SentenceTransformer based on sentence-transformers/all-MiniLM-L12-v2
18
+
19
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/all-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L12-v2). It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
20
+
21
+ ## Model Details
22
+
23
+ ### Model Description
24
+ - **Model Type:** Sentence Transformer
25
+ - **Base model:** [sentence-transformers/all-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L12-v2) <!-- at revision a05860a77cef7b37e0048a7864658139bc18a854 -->
26
+ - **Maximum Sequence Length:** 128 tokens
27
+ - **Output Dimensionality:** 384 tokens
28
+ - **Similarity Function:** Cosine Similarity
29
+ <!-- - **Training Dataset:** Unknown -->
30
+ <!-- - **Language:** Unknown -->
31
+ <!-- - **License:** Unknown -->
32
+
33
+ ### Model Sources
34
+
35
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
36
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
37
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
38
+
39
+ ### Full Model Architecture
40
+
41
+ ```
42
+ SentenceTransformer(
43
+ (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: BertModel
44
+ (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
45
+ (2): Normalize()
46
+ )
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### Direct Usage (Sentence Transformers)
52
+
53
+ First install the Sentence Transformers library:
54
+
55
+ ```bash
56
+ pip install -U sentence-transformers
57
+ ```
58
+
59
+ Then you can load this model and run inference.
60
+ ```python
61
+ from sentence_transformers import SentenceTransformer
62
+
63
+ # Download from the 🤗 Hub
64
+ model = SentenceTransformer("Trelis/all-MiniLM-L12-v2-ft-Llama-3-70B")
65
+ # Run inference
66
+ sentences = [
67
+ 'The weather is lovely today.',
68
+ "It's so sunny outside!",
69
+ 'He drove to the stadium.',
70
+ ]
71
+ embeddings = model.encode(sentences)
72
+ print(embeddings.shape)
73
+ # [3, 384]
74
+
75
+ # Get the similarity scores for the embeddings
76
+ similarities = model.similarity(embeddings, embeddings)
77
+ print(similarities.shape)
78
+ # [3, 3]
79
+ ```
80
+
81
+ <!--
82
+ ### Direct Usage (Transformers)
83
+
84
+ <details><summary>Click to see the direct usage in Transformers</summary>
85
+
86
+ </details>
87
+ -->
88
+
89
+ <!--
90
+ ### Downstream Usage (Sentence Transformers)
91
+
92
+ You can finetune this model on your own dataset.
93
+
94
+ <details><summary>Click to expand</summary>
95
+
96
+ </details>
97
+ -->
98
+
99
+ <!--
100
+ ### Out-of-Scope Use
101
+
102
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
103
+ -->
104
+
105
+ <!--
106
+ ## Bias, Risks and Limitations
107
+
108
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
109
+ -->
110
+
111
+ <!--
112
+ ### Recommendations
113
+
114
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
115
+ -->
116
+
117
+ ## Training Details
118
+
119
+ ### Training Hyperparameters
120
+ #### Non-Default Hyperparameters
121
+
122
+ - `eval_strategy`: steps
123
+ - `per_device_train_batch_size`: 4
124
+ - `per_device_eval_batch_size`: 1
125
+ - `lr_scheduler_type`: cosine
126
+ - `warmup_ratio`: 0.1
127
+ - `bf16`: True
128
+
129
+ #### All Hyperparameters
130
+ <details><summary>Click to expand</summary>
131
+
132
+ - `overwrite_output_dir`: False
133
+ - `do_predict`: False
134
+ - `eval_strategy`: steps
135
+ - `prediction_loss_only`: True
136
+ - `per_device_train_batch_size`: 4
137
+ - `per_device_eval_batch_size`: 1
138
+ - `per_gpu_train_batch_size`: None
139
+ - `per_gpu_eval_batch_size`: None
140
+ - `gradient_accumulation_steps`: 1
141
+ - `eval_accumulation_steps`: None
142
+ - `learning_rate`: 5e-05
143
+ - `weight_decay`: 0.0
144
+ - `adam_beta1`: 0.9
145
+ - `adam_beta2`: 0.999
146
+ - `adam_epsilon`: 1e-08
147
+ - `max_grad_norm`: 1.0
148
+ - `num_train_epochs`: 3
149
+ - `max_steps`: -1
150
+ - `lr_scheduler_type`: cosine
151
+ - `lr_scheduler_kwargs`: {}
152
+ - `warmup_ratio`: 0.1
153
+ - `warmup_steps`: 0
154
+ - `log_level`: passive
155
+ - `log_level_replica`: warning
156
+ - `log_on_each_node`: True
157
+ - `logging_nan_inf_filter`: True
158
+ - `save_safetensors`: True
159
+ - `save_on_each_node`: False
160
+ - `save_only_model`: False
161
+ - `restore_callback_states_from_checkpoint`: False
162
+ - `no_cuda`: False
163
+ - `use_cpu`: False
164
+ - `use_mps_device`: False
165
+ - `seed`: 42
166
+ - `data_seed`: None
167
+ - `jit_mode_eval`: False
168
+ - `use_ipex`: False
169
+ - `bf16`: True
170
+ - `fp16`: False
171
+ - `fp16_opt_level`: O1
172
+ - `half_precision_backend`: auto
173
+ - `bf16_full_eval`: False
174
+ - `fp16_full_eval`: False
175
+ - `tf32`: None
176
+ - `local_rank`: 0
177
+ - `ddp_backend`: None
178
+ - `tpu_num_cores`: None
179
+ - `tpu_metrics_debug`: False
180
+ - `debug`: []
181
+ - `dataloader_drop_last`: False
182
+ - `dataloader_num_workers`: 0
183
+ - `dataloader_prefetch_factor`: None
184
+ - `past_index`: -1
185
+ - `disable_tqdm`: False
186
+ - `remove_unused_columns`: True
187
+ - `label_names`: None
188
+ - `load_best_model_at_end`: False
189
+ - `ignore_data_skip`: False
190
+ - `fsdp`: []
191
+ - `fsdp_min_num_params`: 0
192
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
193
+ - `fsdp_transformer_layer_cls_to_wrap`: None
194
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
195
+ - `deepspeed`: None
196
+ - `label_smoothing_factor`: 0.0
197
+ - `optim`: adamw_torch
198
+ - `optim_args`: None
199
+ - `adafactor`: False
200
+ - `group_by_length`: False
201
+ - `length_column_name`: length
202
+ - `ddp_find_unused_parameters`: None
203
+ - `ddp_bucket_cap_mb`: None
204
+ - `ddp_broadcast_buffers`: False
205
+ - `dataloader_pin_memory`: True
206
+ - `dataloader_persistent_workers`: False
207
+ - `skip_memory_metrics`: True
208
+ - `use_legacy_prediction_loop`: False
209
+ - `push_to_hub`: False
210
+ - `resume_from_checkpoint`: None
211
+ - `hub_model_id`: None
212
+ - `hub_strategy`: every_save
213
+ - `hub_private_repo`: False
214
+ - `hub_always_push`: False
215
+ - `gradient_checkpointing`: False
216
+ - `gradient_checkpointing_kwargs`: None
217
+ - `include_inputs_for_metrics`: False
218
+ - `eval_do_concat_batches`: True
219
+ - `fp16_backend`: auto
220
+ - `push_to_hub_model_id`: None
221
+ - `push_to_hub_organization`: None
222
+ - `mp_parameters`:
223
+ - `auto_find_batch_size`: False
224
+ - `full_determinism`: False
225
+ - `torchdynamo`: None
226
+ - `ray_scope`: last
227
+ - `ddp_timeout`: 1800
228
+ - `torch_compile`: False
229
+ - `torch_compile_backend`: None
230
+ - `torch_compile_mode`: None
231
+ - `dispatch_batches`: None
232
+ - `split_batches`: None
233
+ - `include_tokens_per_second`: False
234
+ - `include_num_input_tokens_seen`: False
235
+ - `neftune_noise_alpha`: None
236
+ - `optim_target_modules`: None
237
+ - `batch_eval_metrics`: False
238
+ - `batch_sampler`: batch_sampler
239
+ - `multi_dataset_batch_sampler`: proportional
240
+
241
+ </details>
242
+
243
+ ### Training Logs
244
+ | Epoch | Step | Training Loss | loss |
245
+ |:-----:|:----:|:-------------:|:------:|
246
+ | 0.2 | 1 | 4.8075 | 4.8453 |
247
+ | 0.4 | 2 | 4.8735 | 4.8537 |
248
+ | 0.6 | 3 | 4.8842 | 4.8429 |
249
+ | 0.8 | 4 | 4.8188 | 4.8415 |
250
+ | 1.0 | 5 | 4.8559 | 4.8173 |
251
+ | 1.2 | 6 | 4.572 | 4.7875 |
252
+ | 1.4 | 7 | 4.4578 | 4.7541 |
253
+ | 1.6 | 8 | 4.8002 | 4.7324 |
254
+ | 1.8 | 9 | 4.4055 | 4.7193 |
255
+ | 2.0 | 10 | 4.5746 | 4.7130 |
256
+ | 2.2 | 11 | 4.5817 | 4.7137 |
257
+ | 2.4 | 12 | 4.2185 | 4.7118 |
258
+ | 2.6 | 13 | 4.3578 | 4.7116 |
259
+ | 2.8 | 14 | 4.5505 | 4.7118 |
260
+ | 3.0 | 15 | 4.1682 | 4.7124 |
261
+
262
+
263
+ ### Framework Versions
264
+ - Python: 3.10.12
265
+ - Sentence Transformers: 3.0.1
266
+ - Transformers: 4.41.2
267
+ - PyTorch: 2.1.1+cu121
268
+ - Accelerate: 0.31.0
269
+ - Datasets: 2.17.1
270
+ - Tokenizers: 0.19.1
271
+
272
+ ## Citation
273
+
274
+ ### BibTeX
275
+
276
+ #### Sentence Transformers
277
+ ```bibtex
278
+ @inproceedings{reimers-2019-sentence-bert,
279
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
280
+ author = "Reimers, Nils and Gurevych, Iryna",
281
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
282
+ month = "11",
283
+ year = "2019",
284
+ publisher = "Association for Computational Linguistics",
285
+ url = "https://arxiv.org/abs/1908.10084",
286
+ }
287
+ ```
288
+
289
+ #### TripletLoss
290
+ ```bibtex
291
+ @misc{hermans2017defense,
292
+ title={In Defense of the Triplet Loss for Person Re-Identification},
293
+ author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
294
+ year={2017},
295
+ eprint={1703.07737},
296
+ archivePrefix={arXiv},
297
+ primaryClass={cs.CV}
298
+ }
299
+ ```
300
+
301
+ <!--
302
+ ## Glossary
303
+
304
+ *Clearly define terms in order to be accessible across audiences.*
305
+ -->
306
+
307
+ <!--
308
+ ## Model Card Authors
309
+
310
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
311
+ -->
312
+
313
+ <!--
314
+ ## Model Card Contact
315
+
316
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
317
+ -->
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "sentence-transformers/all-MiniLM-L12-v2",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 384,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 1536,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.41.2",
23
+ "type_vocab_size": 2,
24
+ "use_cache": true,
25
+ "vocab_size": 30522
26
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.0.1",
4
+ "transformers": "4.41.2",
5
+ "pytorch": "2.1.1+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52740d1990b48dbc1968fd3db8b86d991bb8540e95c24e05e361f514fa0a47f1
3
+ size 133462128
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 128,
3
+ "do_lower_case": false
4
+ }
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,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "mask_token": "[MASK]",
49
+ "max_length": 128,
50
+ "model_max_length": 128,
51
+ "never_split": null,
52
+ "pad_to_multiple_of": null,
53
+ "pad_token": "[PAD]",
54
+ "pad_token_type_id": 0,
55
+ "padding_side": "right",
56
+ "sep_token": "[SEP]",
57
+ "stride": 0,
58
+ "strip_accents": null,
59
+ "tokenize_chinese_chars": true,
60
+ "tokenizer_class": "BertTokenizer",
61
+ "truncation_side": "right",
62
+ "truncation_strategy": "longest_first",
63
+ "unk_token": "[UNK]"
64
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff