Borsa356 commited on
Commit
796c55a
·
verified ·
1 Parent(s): 72fc854

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,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - dense
7
+ - generated_from_trainer
8
+ - dataset_size:2976
9
+ - loss:MultipleNegativesRankingLoss
10
+ base_model: microsoft/MiniLM-L12-H384-uncased
11
+ widget:
12
+ - source_sentence: Two girls in red soccer uniforms running after a soccer ball.
13
+ sentences:
14
+ - A man is holding a girls hand and walking through a creek.
15
+ - A boy is in a competition.
16
+ - Two girls are playing a game of soccer.
17
+ - source_sentence: A girl sits outside at a large fountain.
18
+ sentences:
19
+ - The woman has tears in her eyes.
20
+ - A human
21
+ - The woman is playing a sport
22
+ - source_sentence: A man is tying his shoe lace.
23
+ sentences:
24
+ - A couple of young boys are washing their hands.
25
+ - Youth in white T-shirt on a white surfboard in the water.
26
+ - A man is lacing up his shoes.
27
+ - source_sentence: three ladies posing for the camera
28
+ sentences:
29
+ - People are crowded around and walking by the large Oriental structure.
30
+ - Ladies are posing for the camera
31
+ - A woman is blonde
32
+ - source_sentence: A local swimmer is wearing a swim cap and swim goggles while swimming
33
+ in a lake.
34
+ sentences:
35
+ - A young man rides a skateboard.
36
+ - A toddler is walking.
37
+ - the swimmer is in the lake
38
+ pipeline_tag: sentence-similarity
39
+ library_name: sentence-transformers
40
+ ---
41
+
42
+ # SentenceTransformer based on microsoft/MiniLM-L12-H384-uncased
43
+
44
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [microsoft/MiniLM-L12-H384-uncased](https://huggingface.co/microsoft/MiniLM-L12-H384-uncased). 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.
45
+
46
+ ## Model Details
47
+
48
+ ### Model Description
49
+ - **Model Type:** Sentence Transformer
50
+ - **Base model:** [microsoft/MiniLM-L12-H384-uncased](https://huggingface.co/microsoft/MiniLM-L12-H384-uncased) <!-- at revision 44acabbec0ef496f6dbc93adadea57f376b7c0ec -->
51
+ - **Maximum Sequence Length:** 512 tokens
52
+ - **Output Dimensionality:** 384 dimensions
53
+ - **Similarity Function:** Cosine Similarity
54
+ <!-- - **Training Dataset:** Unknown -->
55
+ <!-- - **Language:** Unknown -->
56
+ <!-- - **License:** Unknown -->
57
+
58
+ ### Model Sources
59
+
60
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
61
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
62
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
63
+
64
+ ### Full Model Architecture
65
+
66
+ ```
67
+ SentenceTransformer(
68
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'BertModel'})
69
+ (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})
70
+ )
71
+ ```
72
+
73
+ ## Usage
74
+
75
+ ### Direct Usage (Sentence Transformers)
76
+
77
+ First install the Sentence Transformers library:
78
+
79
+ ```bash
80
+ pip install -U sentence-transformers
81
+ ```
82
+
83
+ Then you can load this model and run inference.
84
+ ```python
85
+ from sentence_transformers import SentenceTransformer
86
+
87
+ # Download from the 🤗 Hub
88
+ model = SentenceTransformer("Borsa356/bert_mnr_3")
89
+ # Run inference
90
+ sentences = [
91
+ 'A local swimmer is wearing a swim cap and swim goggles while swimming in a lake.',
92
+ 'the swimmer is in the lake',
93
+ 'A toddler is walking.',
94
+ ]
95
+ embeddings = model.encode(sentences)
96
+ print(embeddings.shape)
97
+ # [3, 384]
98
+
99
+ # Get the similarity scores for the embeddings
100
+ similarities = model.similarity(embeddings, embeddings)
101
+ print(similarities)
102
+ # tensor([[1.0000, 0.8986, 0.3437],
103
+ # [0.8986, 1.0000, 0.3590],
104
+ # [0.3437, 0.3590, 1.0000]])
105
+ ```
106
+
107
+ <!--
108
+ ### Direct Usage (Transformers)
109
+
110
+ <details><summary>Click to see the direct usage in Transformers</summary>
111
+
112
+ </details>
113
+ -->
114
+
115
+ <!--
116
+ ### Downstream Usage (Sentence Transformers)
117
+
118
+ You can finetune this model on your own dataset.
119
+
120
+ <details><summary>Click to expand</summary>
121
+
122
+ </details>
123
+ -->
124
+
125
+ <!--
126
+ ### Out-of-Scope Use
127
+
128
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
129
+ -->
130
+
131
+ <!--
132
+ ## Bias, Risks and Limitations
133
+
134
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
135
+ -->
136
+
137
+ <!--
138
+ ### Recommendations
139
+
140
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
141
+ -->
142
+
143
+ ## Training Details
144
+
145
+ ### Training Dataset
146
+
147
+ #### Unnamed Dataset
148
+
149
+ * Size: 2,976 training samples
150
+ * Columns: <code>sentence_0</code> and <code>sentence_1</code>
151
+ * Approximate statistics based on the first 1000 samples:
152
+ | | sentence_0 | sentence_1 |
153
+ |:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|
154
+ | type | string | string |
155
+ | details | <ul><li>min: 5 tokens</li><li>mean: 16.75 tokens</li><li>max: 64 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 9.62 tokens</li><li>max: 31 tokens</li></ul> |
156
+ * Samples:
157
+ | sentence_0 | sentence_1 |
158
+ |:-------------------------------------------------------------------------------------------------------|:------------------------------------------------------|
159
+ | <code>A rock climber grasps a ledge with his chalk covered hand.</code> | <code>A climber scaling an incline.</code> |
160
+ | <code>A group of construction workers wearing hard hats are standing, holding gloves and tools.</code> | <code>People are standing.</code> |
161
+ | <code>a blond girl in a white dress holding a bird in a tree.</code> | <code>A lady is wearing a dress holding a bird</code> |
162
+ * Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
163
+ ```json
164
+ {
165
+ "scale": 20.0,
166
+ "similarity_fct": "cos_sim"
167
+ }
168
+ ```
169
+
170
+ ### Training Hyperparameters
171
+ #### Non-Default Hyperparameters
172
+
173
+ - `per_device_train_batch_size`: 32
174
+ - `per_device_eval_batch_size`: 32
175
+ - `num_train_epochs`: 1
176
+ - `batch_sampler`: no_duplicates
177
+ - `multi_dataset_batch_sampler`: round_robin
178
+
179
+ #### All Hyperparameters
180
+ <details><summary>Click to expand</summary>
181
+
182
+ - `overwrite_output_dir`: False
183
+ - `do_predict`: False
184
+ - `eval_strategy`: no
185
+ - `prediction_loss_only`: True
186
+ - `per_device_train_batch_size`: 32
187
+ - `per_device_eval_batch_size`: 32
188
+ - `per_gpu_train_batch_size`: None
189
+ - `per_gpu_eval_batch_size`: None
190
+ - `gradient_accumulation_steps`: 1
191
+ - `eval_accumulation_steps`: None
192
+ - `torch_empty_cache_steps`: None
193
+ - `learning_rate`: 5e-05
194
+ - `weight_decay`: 0.0
195
+ - `adam_beta1`: 0.9
196
+ - `adam_beta2`: 0.999
197
+ - `adam_epsilon`: 1e-08
198
+ - `max_grad_norm`: 1
199
+ - `num_train_epochs`: 1
200
+ - `max_steps`: -1
201
+ - `lr_scheduler_type`: linear
202
+ - `lr_scheduler_kwargs`: {}
203
+ - `warmup_ratio`: 0.0
204
+ - `warmup_steps`: 0
205
+ - `log_level`: passive
206
+ - `log_level_replica`: warning
207
+ - `log_on_each_node`: True
208
+ - `logging_nan_inf_filter`: True
209
+ - `save_safetensors`: True
210
+ - `save_on_each_node`: False
211
+ - `save_only_model`: False
212
+ - `restore_callback_states_from_checkpoint`: False
213
+ - `no_cuda`: False
214
+ - `use_cpu`: False
215
+ - `use_mps_device`: False
216
+ - `seed`: 42
217
+ - `data_seed`: None
218
+ - `jit_mode_eval`: False
219
+ - `use_ipex`: False
220
+ - `bf16`: False
221
+ - `fp16`: False
222
+ - `fp16_opt_level`: O1
223
+ - `half_precision_backend`: auto
224
+ - `bf16_full_eval`: False
225
+ - `fp16_full_eval`: False
226
+ - `tf32`: None
227
+ - `local_rank`: 0
228
+ - `ddp_backend`: None
229
+ - `tpu_num_cores`: None
230
+ - `tpu_metrics_debug`: False
231
+ - `debug`: []
232
+ - `dataloader_drop_last`: False
233
+ - `dataloader_num_workers`: 0
234
+ - `dataloader_prefetch_factor`: None
235
+ - `past_index`: -1
236
+ - `disable_tqdm`: False
237
+ - `remove_unused_columns`: True
238
+ - `label_names`: None
239
+ - `load_best_model_at_end`: False
240
+ - `ignore_data_skip`: False
241
+ - `fsdp`: []
242
+ - `fsdp_min_num_params`: 0
243
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
244
+ - `fsdp_transformer_layer_cls_to_wrap`: None
245
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
246
+ - `deepspeed`: None
247
+ - `label_smoothing_factor`: 0.0
248
+ - `optim`: adamw_torch
249
+ - `optim_args`: None
250
+ - `adafactor`: False
251
+ - `group_by_length`: False
252
+ - `length_column_name`: length
253
+ - `ddp_find_unused_parameters`: None
254
+ - `ddp_bucket_cap_mb`: None
255
+ - `ddp_broadcast_buffers`: False
256
+ - `dataloader_pin_memory`: True
257
+ - `dataloader_persistent_workers`: False
258
+ - `skip_memory_metrics`: True
259
+ - `use_legacy_prediction_loop`: False
260
+ - `push_to_hub`: False
261
+ - `resume_from_checkpoint`: None
262
+ - `hub_model_id`: None
263
+ - `hub_strategy`: every_save
264
+ - `hub_private_repo`: None
265
+ - `hub_always_push`: False
266
+ - `hub_revision`: None
267
+ - `gradient_checkpointing`: False
268
+ - `gradient_checkpointing_kwargs`: None
269
+ - `include_inputs_for_metrics`: False
270
+ - `include_for_metrics`: []
271
+ - `eval_do_concat_batches`: True
272
+ - `fp16_backend`: auto
273
+ - `push_to_hub_model_id`: None
274
+ - `push_to_hub_organization`: None
275
+ - `mp_parameters`:
276
+ - `auto_find_batch_size`: False
277
+ - `full_determinism`: False
278
+ - `torchdynamo`: None
279
+ - `ray_scope`: last
280
+ - `ddp_timeout`: 1800
281
+ - `torch_compile`: False
282
+ - `torch_compile_backend`: None
283
+ - `torch_compile_mode`: None
284
+ - `include_tokens_per_second`: False
285
+ - `include_num_input_tokens_seen`: False
286
+ - `neftune_noise_alpha`: None
287
+ - `optim_target_modules`: None
288
+ - `batch_eval_metrics`: False
289
+ - `eval_on_start`: False
290
+ - `use_liger_kernel`: False
291
+ - `liger_kernel_config`: None
292
+ - `eval_use_gather_object`: False
293
+ - `average_tokens_across_devices`: False
294
+ - `prompts`: None
295
+ - `batch_sampler`: no_duplicates
296
+ - `multi_dataset_batch_sampler`: round_robin
297
+ - `router_mapping`: {}
298
+ - `learning_rate_mapping`: {}
299
+
300
+ </details>
301
+
302
+ ### Framework Versions
303
+ - Python: 3.13.5
304
+ - Sentence Transformers: 5.0.0
305
+ - Transformers: 4.53.0
306
+ - PyTorch: 2.7.1+cpu
307
+ - Accelerate: 1.8.1
308
+ - Datasets: 3.6.0
309
+ - Tokenizers: 0.21.2
310
+
311
+ ## Citation
312
+
313
+ ### BibTeX
314
+
315
+ #### Sentence Transformers
316
+ ```bibtex
317
+ @inproceedings{reimers-2019-sentence-bert,
318
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
319
+ author = "Reimers, Nils and Gurevych, Iryna",
320
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
321
+ month = "11",
322
+ year = "2019",
323
+ publisher = "Association for Computational Linguistics",
324
+ url = "https://arxiv.org/abs/1908.10084",
325
+ }
326
+ ```
327
+
328
+ #### MultipleNegativesRankingLoss
329
+ ```bibtex
330
+ @misc{henderson2017efficient,
331
+ title={Efficient Natural Language Response Suggestion for Smart Reply},
332
+ author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
333
+ year={2017},
334
+ eprint={1705.00652},
335
+ archivePrefix={arXiv},
336
+ primaryClass={cs.CL}
337
+ }
338
+ ```
339
+
340
+ <!--
341
+ ## Glossary
342
+
343
+ *Clearly define terms in order to be accessible across audiences.*
344
+ -->
345
+
346
+ <!--
347
+ ## Model Card Authors
348
+
349
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
350
+ -->
351
+
352
+ <!--
353
+ ## Model Card Contact
354
+
355
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
356
+ -->
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "hidden_act": "gelu",
8
+ "hidden_dropout_prob": 0.1,
9
+ "hidden_size": 384,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 1536,
12
+ "layer_norm_eps": 1e-12,
13
+ "max_position_embeddings": 512,
14
+ "model_type": "bert",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 12,
17
+ "pad_token_id": 0,
18
+ "position_embedding_type": "absolute",
19
+ "torch_dtype": "float32",
20
+ "transformers_version": "4.53.0",
21
+ "type_vocab_size": 2,
22
+ "use_cache": true,
23
+ "vocab_size": 30522
24
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "SentenceTransformer",
3
+ "__version__": {
4
+ "sentence_transformers": "5.0.0",
5
+ "transformers": "4.53.0",
6
+ "pytorch": "2.7.1+cpu"
7
+ },
8
+ "prompts": {
9
+ "query": "",
10
+ "document": ""
11
+ },
12
+ "default_prompt_name": null,
13
+ "similarity_fn_name": "cosine"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35ba03b5db141e3801da73d5eb07bbfc76c4b5128fc7b400f2fca51644ecd7af
3
+ size 133462128
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 512,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "model_max_length": 1000000000000000019884624838656,
51
+ "never_split": null,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "strip_accents": null,
55
+ "tokenize_chinese_chars": true,
56
+ "tokenizer_class": "BertTokenizer",
57
+ "unk_token": "[UNK]"
58
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff