LamaDiab commited on
Commit
260e7db
·
verified ·
1 Parent(s): f39999b

Updating model weights

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,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - dense
7
+ - generated_from_trainer
8
+ - dataset_size:989791
9
+ - loss:MultipleNegativesSymmetricRankingLoss
10
+ base_model: sentence-transformers/all-MiniLM-L6-v2
11
+ widget:
12
+ - source_sentence: turmeric
13
+ sentences:
14
+ - essential oils
15
+ - joint comfort essential oil
16
+ - bubble enigma
17
+ - source_sentence: lavie naturelle sunscreen spf50
18
+ sentences:
19
+ - sunscreen
20
+ - shields uvb sunscreen
21
+ - smashbox 3 travel size box
22
+ - source_sentence: cubs kids cloud slipper pink 25/26
23
+ sentences:
24
+ - monochrome duffle bag
25
+ - ' slipper'
26
+ - slipper
27
+ - source_sentence: rhea glow face cleanser
28
+ sentences:
29
+ - face cleanser
30
+ - ' glow face cleanser'
31
+ - city girl collection lipstick lipstick extra creamy – no. 214
32
+ - source_sentence: skinny royale
33
+ sentences:
34
+ - doughnuts blue icing
35
+ - deli
36
+ - poached eggs skinny royale
37
+ pipeline_tag: sentence-similarity
38
+ library_name: sentence-transformers
39
+ metrics:
40
+ - cosine_accuracy
41
+ model-index:
42
+ - name: SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
43
+ results:
44
+ - task:
45
+ type: triplet
46
+ name: Triplet
47
+ dataset:
48
+ name: Unknown
49
+ type: unknown
50
+ metrics:
51
+ - type: cosine_accuracy
52
+ value: 0.9725362062454224
53
+ name: Cosine Accuracy
54
+ ---
55
+
56
+ # SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
57
+
58
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-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.
59
+
60
+ ## Model Details
61
+
62
+ ### Model Description
63
+ - **Model Type:** Sentence Transformer
64
+ - **Base model:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) <!-- at revision c9745ed1d9f207416be6d2e6f8de32d1f16199bf -->
65
+ - **Maximum Sequence Length:** 256 tokens
66
+ - **Output Dimensionality:** 384 dimensions
67
+ - **Similarity Function:** Cosine Similarity
68
+ <!-- - **Training Dataset:** Unknown -->
69
+ <!-- - **Language:** Unknown -->
70
+ <!-- - **License:** Unknown -->
71
+
72
+ ### Model Sources
73
+
74
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
75
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
76
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
77
+
78
+ ### Full Model Architecture
79
+
80
+ ```
81
+ SentenceTransformer(
82
+ (0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'BertModel'})
83
+ (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})
84
+ (2): Normalize()
85
+ )
86
+ ```
87
+
88
+ ## Usage
89
+
90
+ ### Direct Usage (Sentence Transformers)
91
+
92
+ First install the Sentence Transformers library:
93
+
94
+ ```bash
95
+ pip install -U sentence-transformers
96
+ ```
97
+
98
+ Then you can load this model and run inference.
99
+ ```python
100
+ from sentence_transformers import SentenceTransformer
101
+
102
+ # Download from the 🤗 Hub
103
+ model = SentenceTransformer("LamaDiab/MiniLM-v31-SemanticEngine")
104
+ # Run inference
105
+ sentences = [
106
+ 'skinny royale',
107
+ 'poached eggs skinny royale',
108
+ 'doughnuts blue icing',
109
+ ]
110
+ embeddings = model.encode(sentences)
111
+ print(embeddings.shape)
112
+ # [3, 384]
113
+
114
+ # Get the similarity scores for the embeddings
115
+ similarities = model.similarity(embeddings, embeddings)
116
+ print(similarities)
117
+ # tensor([[1.0000, 0.7055, 0.2723],
118
+ # [0.7055, 1.0000, 0.2485],
119
+ # [0.2723, 0.2485, 1.0000]])
120
+ ```
121
+
122
+ <!--
123
+ ### Direct Usage (Transformers)
124
+
125
+ <details><summary>Click to see the direct usage in Transformers</summary>
126
+
127
+ </details>
128
+ -->
129
+
130
+ <!--
131
+ ### Downstream Usage (Sentence Transformers)
132
+
133
+ You can finetune this model on your own dataset.
134
+
135
+ <details><summary>Click to expand</summary>
136
+
137
+ </details>
138
+ -->
139
+
140
+ <!--
141
+ ### Out-of-Scope Use
142
+
143
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
144
+ -->
145
+
146
+ ## Evaluation
147
+
148
+ ### Metrics
149
+
150
+ #### Triplet
151
+
152
+ * Evaluated with [<code>TripletEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.TripletEvaluator)
153
+
154
+ | Metric | Value |
155
+ |:--------------------|:-----------|
156
+ | **cosine_accuracy** | **0.9725** |
157
+
158
+ <!--
159
+ ## Bias, Risks and Limitations
160
+
161
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
162
+ -->
163
+
164
+ <!--
165
+ ### Recommendations
166
+
167
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
168
+ -->
169
+
170
+ ## Training Details
171
+
172
+ ### Training Dataset
173
+
174
+ #### Unnamed Dataset
175
+
176
+ * Size: 989,791 training samples
177
+ * Columns: <code>anchor</code>, <code>positive</code>, and <code>itemCategory</code>
178
+ * Approximate statistics based on the first 1000 samples:
179
+ | | anchor | positive | itemCategory |
180
+ |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|
181
+ | type | string | string | string |
182
+ | details | <ul><li>min: 3 tokens</li><li>mean: 9.64 tokens</li><li>max: 56 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 5.69 tokens</li><li>max: 25 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 4.03 tokens</li><li>max: 11 tokens</li></ul> |
183
+ * Samples:
184
+ | anchor | positive | itemCategory |
185
+ |:-------------------------------------------|:----------------------------------------------|:------------------------|
186
+ | <code>restaurants</code> | <code>mineral water (s)</code> | <code>beverage</code> |
187
+ | <code>solodex anti age serum 30 ml</code> | <code>face serum</code> | <code>anti-aging</code> |
188
+ | <code>almond, cashew and cherry bar</code> | <code>cashew and cranberry almond, bar</code> | <code>snacks</code> |
189
+ * Loss: [<code>MultipleNegativesSymmetricRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativessymmetricrankingloss) with these parameters:
190
+ ```json
191
+ {
192
+ "scale": 20.0,
193
+ "similarity_fct": "cos_sim",
194
+ "gather_across_devices": false
195
+ }
196
+ ```
197
+
198
+ ### Evaluation Dataset
199
+
200
+ #### Unnamed Dataset
201
+
202
+ * Size: 9,467 evaluation samples
203
+ * Columns: <code>anchor</code>, <code>positive</code>, <code>negative</code>, and <code>itemCategory</code>
204
+ * Approximate statistics based on the first 1000 samples:
205
+ | | anchor | positive | negative | itemCategory |
206
+ |:--------|:--------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:--------------------------------------------------------------------------------|
207
+ | type | string | string | string | string |
208
+ | details | <ul><li>min: 3 tokens</li><li>mean: 9.5 tokens</li><li>max: 38 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 6.3 tokens</li><li>max: 138 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 9.25 tokens</li><li>max: 30 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 3.79 tokens</li><li>max: 9 tokens</li></ul> |
209
+ * Samples:
210
+ | anchor | positive | negative | itemCategory |
211
+ |:---------------------------------------------------|:--------------------------------------|:-----------------------------------------------|:----------------------|
212
+ | <code>ritter sport smarties white chocolate</code> | <code>chocolate</code> | <code>small charcuterie tree</code> | <code>sweet</code> |
213
+ | <code>cordyline</code> | <code>reddish plant</code> | <code>table board</code> | <code>plant</code> |
214
+ | <code>gym strikers leggings purple</code> | <code>shape-retaining leggings</code> | <code>men's tennis t-shirt tts900 - red</code> | <code>trousers</code> |
215
+ * Loss: [<code>MultipleNegativesSymmetricRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativessymmetricrankingloss) with these parameters:
216
+ ```json
217
+ {
218
+ "scale": 20.0,
219
+ "similarity_fct": "cos_sim",
220
+ "gather_across_devices": false
221
+ }
222
+ ```
223
+
224
+ ### Training Hyperparameters
225
+ #### Non-Default Hyperparameters
226
+
227
+ - `eval_strategy`: steps
228
+ - `per_device_train_batch_size`: 256
229
+ - `per_device_eval_batch_size`: 256
230
+ - `learning_rate`: 3e-05
231
+ - `weight_decay`: 0.01
232
+ - `num_train_epochs`: 4
233
+ - `warmup_ratio`: 0.1
234
+ - `fp16`: True
235
+ - `dataloader_num_workers`: 1
236
+ - `dataloader_prefetch_factor`: 2
237
+ - `dataloader_persistent_workers`: True
238
+ - `push_to_hub`: True
239
+ - `hub_model_id`: LamaDiab/MiniLM-v31-SemanticEngine
240
+ - `hub_strategy`: all_checkpoints
241
+
242
+ #### All Hyperparameters
243
+ <details><summary>Click to expand</summary>
244
+
245
+ - `overwrite_output_dir`: False
246
+ - `do_predict`: False
247
+ - `eval_strategy`: steps
248
+ - `prediction_loss_only`: True
249
+ - `per_device_train_batch_size`: 256
250
+ - `per_device_eval_batch_size`: 256
251
+ - `per_gpu_train_batch_size`: None
252
+ - `per_gpu_eval_batch_size`: None
253
+ - `gradient_accumulation_steps`: 1
254
+ - `eval_accumulation_steps`: None
255
+ - `torch_empty_cache_steps`: None
256
+ - `learning_rate`: 3e-05
257
+ - `weight_decay`: 0.01
258
+ - `adam_beta1`: 0.9
259
+ - `adam_beta2`: 0.999
260
+ - `adam_epsilon`: 1e-08
261
+ - `max_grad_norm`: 1.0
262
+ - `num_train_epochs`: 4
263
+ - `max_steps`: -1
264
+ - `lr_scheduler_type`: linear
265
+ - `lr_scheduler_kwargs`: {}
266
+ - `warmup_ratio`: 0.1
267
+ - `warmup_steps`: 0
268
+ - `log_level`: passive
269
+ - `log_level_replica`: warning
270
+ - `log_on_each_node`: True
271
+ - `logging_nan_inf_filter`: True
272
+ - `save_safetensors`: True
273
+ - `save_on_each_node`: False
274
+ - `save_only_model`: False
275
+ - `restore_callback_states_from_checkpoint`: False
276
+ - `no_cuda`: False
277
+ - `use_cpu`: False
278
+ - `use_mps_device`: False
279
+ - `seed`: 42
280
+ - `data_seed`: None
281
+ - `jit_mode_eval`: False
282
+ - `use_ipex`: False
283
+ - `bf16`: False
284
+ - `fp16`: True
285
+ - `fp16_opt_level`: O1
286
+ - `half_precision_backend`: auto
287
+ - `bf16_full_eval`: False
288
+ - `fp16_full_eval`: False
289
+ - `tf32`: None
290
+ - `local_rank`: 0
291
+ - `ddp_backend`: None
292
+ - `tpu_num_cores`: None
293
+ - `tpu_metrics_debug`: False
294
+ - `debug`: []
295
+ - `dataloader_drop_last`: False
296
+ - `dataloader_num_workers`: 1
297
+ - `dataloader_prefetch_factor`: 2
298
+ - `past_index`: -1
299
+ - `disable_tqdm`: False
300
+ - `remove_unused_columns`: True
301
+ - `label_names`: None
302
+ - `load_best_model_at_end`: False
303
+ - `ignore_data_skip`: False
304
+ - `fsdp`: []
305
+ - `fsdp_min_num_params`: 0
306
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
307
+ - `fsdp_transformer_layer_cls_to_wrap`: None
308
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
309
+ - `deepspeed`: None
310
+ - `label_smoothing_factor`: 0.0
311
+ - `optim`: adamw_torch
312
+ - `optim_args`: None
313
+ - `adafactor`: False
314
+ - `group_by_length`: False
315
+ - `length_column_name`: length
316
+ - `ddp_find_unused_parameters`: None
317
+ - `ddp_bucket_cap_mb`: None
318
+ - `ddp_broadcast_buffers`: False
319
+ - `dataloader_pin_memory`: True
320
+ - `dataloader_persistent_workers`: True
321
+ - `skip_memory_metrics`: True
322
+ - `use_legacy_prediction_loop`: False
323
+ - `push_to_hub`: True
324
+ - `resume_from_checkpoint`: None
325
+ - `hub_model_id`: LamaDiab/MiniLM-v31-SemanticEngine
326
+ - `hub_strategy`: all_checkpoints
327
+ - `hub_private_repo`: None
328
+ - `hub_always_push`: False
329
+ - `hub_revision`: None
330
+ - `gradient_checkpointing`: False
331
+ - `gradient_checkpointing_kwargs`: None
332
+ - `include_inputs_for_metrics`: False
333
+ - `include_for_metrics`: []
334
+ - `eval_do_concat_batches`: True
335
+ - `fp16_backend`: auto
336
+ - `push_to_hub_model_id`: None
337
+ - `push_to_hub_organization`: None
338
+ - `mp_parameters`:
339
+ - `auto_find_batch_size`: False
340
+ - `full_determinism`: False
341
+ - `torchdynamo`: None
342
+ - `ray_scope`: last
343
+ - `ddp_timeout`: 1800
344
+ - `torch_compile`: False
345
+ - `torch_compile_backend`: None
346
+ - `torch_compile_mode`: None
347
+ - `include_tokens_per_second`: False
348
+ - `include_num_input_tokens_seen`: False
349
+ - `neftune_noise_alpha`: None
350
+ - `optim_target_modules`: None
351
+ - `batch_eval_metrics`: False
352
+ - `eval_on_start`: False
353
+ - `use_liger_kernel`: False
354
+ - `liger_kernel_config`: None
355
+ - `eval_use_gather_object`: False
356
+ - `average_tokens_across_devices`: False
357
+ - `prompts`: None
358
+ - `batch_sampler`: batch_sampler
359
+ - `multi_dataset_batch_sampler`: proportional
360
+ - `router_mapping`: {}
361
+ - `learning_rate_mapping`: {}
362
+
363
+ </details>
364
+
365
+ ### Training Logs
366
+ | Epoch | Step | Training Loss | Validation Loss | cosine_accuracy |
367
+ |:------:|:-----:|:-------------:|:---------------:|:---------------:|
368
+ | 0.0003 | 1 | 3.5134 | - | - |
369
+ | 0.2586 | 1000 | 2.5294 | 1.1220 | 0.9476 |
370
+ | 0.5172 | 2000 | 1.84 | 1.0357 | 0.9596 |
371
+ | 0.7758 | 3000 | 1.6007 | 0.9693 | 0.9656 |
372
+ | 1.0344 | 4000 | 2.0429 | 0.9276 | 0.9676 |
373
+ | 1.2928 | 5000 | 1.5438 | 0.8986 | 0.9688 |
374
+ | 1.5513 | 6000 | 1.5027 | 0.8980 | 0.9702 |
375
+ | 1.8098 | 7000 | 1.4302 | 0.9006 | 0.9708 |
376
+ | 2.0682 | 8000 | 1.4145 | 0.8990 | 0.9703 |
377
+ | 2.3267 | 9000 | 1.3572 | 0.8929 | 0.9706 |
378
+ | 2.5852 | 10000 | 1.3533 | 0.8818 | 0.9735 |
379
+ | 2.8436 | 11000 | 1.3183 | 0.8857 | 0.9726 |
380
+ | 3.1021 | 12000 | 1.3243 | 0.8805 | 0.9745 |
381
+ | 3.3606 | 13000 | 1.2964 | 0.8851 | 0.9734 |
382
+ | 3.6190 | 14000 | 1.2724 | 0.8803 | 0.9738 |
383
+ | 3.8775 | 15000 | 1.2631 | 0.8834 | 0.9725 |
384
+
385
+
386
+ ### Framework Versions
387
+ - Python: 3.11.13
388
+ - Sentence Transformers: 5.1.2
389
+ - Transformers: 4.53.3
390
+ - PyTorch: 2.6.0+cu124
391
+ - Accelerate: 1.9.0
392
+ - Datasets: 4.4.1
393
+ - Tokenizers: 0.21.2
394
+
395
+ ## Citation
396
+
397
+ ### BibTeX
398
+
399
+ #### Sentence Transformers
400
+ ```bibtex
401
+ @inproceedings{reimers-2019-sentence-bert,
402
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
403
+ author = "Reimers, Nils and Gurevych, Iryna",
404
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
405
+ month = "11",
406
+ year = "2019",
407
+ publisher = "Association for Computational Linguistics",
408
+ url = "https://arxiv.org/abs/1908.10084",
409
+ }
410
+ ```
411
+
412
+ <!--
413
+ ## Glossary
414
+
415
+ *Clearly define terms in order to be accessible across audiences.*
416
+ -->
417
+
418
+ <!--
419
+ ## Model Card Authors
420
+
421
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
422
+ -->
423
+
424
+ <!--
425
+ ## Model Card Contact
426
+
427
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
428
+ -->
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "5.1.2",
4
+ "transformers": "4.53.3",
5
+ "pytorch": "2.6.0+cu124"
6
+ },
7
+ "model_type": "SentenceTransformer",
8
+ "prompts": {
9
+ "query": "",
10
+ "document": ""
11
+ },
12
+ "default_prompt_name": null,
13
+ "similarity_fn_name": "cosine"
14
+ }
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": 256,
3
+ "do_lower_case": false
4
+ }