Pascalymb commited on
Commit
3ac0d41
·
verified ·
1 Parent(s): 10fc23d

pascalymb/hack_ai_embbedding_model

Browse files
Files changed (1) hide show
  1. README.md +221 -54
README.md CHANGED
@@ -4,42 +4,56 @@ tags:
4
  - sentence-similarity
5
  - feature-extraction
6
  - generated_from_trainer
7
- - dataset_size:80
8
  - loss:CoSENTLoss
9
  base_model: abdeljalilELmajjodi/model
10
  widget:
11
- - source_sentence: A person on a horse jumps over a broken down airplane.
12
  sentences:
13
- - A person is at a diner, ordering an omelette.
14
- - The man with the sign is caucasian.
15
- - A man in a restaurant is waiting for his meal to arrive.
16
- - source_sentence: Woman in white in foreground and a man slightly behind walking
17
- with a sign for John's Pizza and Gyro in the background.
18
  sentences:
19
- - The women enjoy having a good fashion sense.
20
- - The man is sitting down while he has a sign for John's Pizza and Gyro in his arms.
21
- - Olympic swimming.
22
- - source_sentence: A man and a woman cross the street in front of a pizza and gyro
23
- restaurant.
24
  sentences:
25
- - The people are standing still on the curb.
26
- - two coworkers cross pathes on a street
27
- - Two adults swimming in water
28
- - source_sentence: A few people in a restaurant setting, one of them is drinking orange
29
- juice.
30
  sentences:
31
- - The diners are at a restaurant.
32
- - A family of three is at the mall shopping.
33
- - The mans briefcase is for work.
34
- - source_sentence: Two adults, one female in white, with shades and one male, gray
35
- clothes, walking across a street, away from a eatery with a blurred image of a
36
- dark colored red shirted person in the foreground.
37
  sentences:
38
- - Two women are at a restaurant drinking wine.
39
- - A man and a woman walk down a crowded city street.
40
- - Two adults walk across the street.
41
  pipeline_tag: sentence-similarity
42
  library_name: sentence-transformers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  ---
44
 
45
  # SentenceTransformer based on abdeljalilELmajjodi/model
@@ -92,9 +106,9 @@ from sentence_transformers import SentenceTransformer
92
  model = SentenceTransformer("sentence_transformers_model_id")
93
  # Run inference
94
  sentences = [
95
- 'Two adults, one female in white, with shades and one male, gray clothes, walking across a street, away from a eatery with a blurred image of a dark colored red shirted person in the foreground.',
96
- 'Two adults walk across the street.',
97
- 'Two women are at a restaurant drinking wine.',
98
  ]
99
  embeddings = model.encode(sentences)
100
  print(embeddings.shape)
@@ -103,9 +117,9 @@ print(embeddings.shape)
103
  # Get the similarity scores for the embeddings
104
  similarities = model.similarity(embeddings, embeddings)
105
  print(similarities)
106
- # tensor([[1.0000, 0.9900, 0.9921],
107
- # [0.9900, 1.0000, 0.9920],
108
- # [0.9921, 0.9920, 1.0000]])
109
  ```
110
  <!--
111
  ### Direct Usage (Transformers)
@@ -131,6 +145,20 @@ You can finetune this model on your own dataset.
131
  *List how the model may foreseeably be misused and address what users ought not to do with the model.*
132
  -->
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  <!--
135
  ## Bias, Risks and Limitations
136
 
@@ -150,19 +178,19 @@ You can finetune this model on your own dataset.
150
  #### all-nli
151
 
152
  * Dataset: all-nli
153
- * Size: 80 training samples
154
  * Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
155
- * Approximate statistics based on the first 80 samples:
156
- | | sentence1 | sentence2 | score |
157
- |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
158
- | type | string | string | float |
159
- | details | <ul><li>min: 10 tokens</li><li>mean: 24.73 tokens</li><li>max: 52 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 11.85 tokens</li><li>max: 29 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.53</li><li>max: 1.0</li></ul> |
160
  * Samples:
161
- | sentence1 | sentence2 | score |
162
- |:-------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------|:-----------------|
163
- | <code>A man and a woman cross the street in front of a pizza and gyro restaurant.</code> | <code>The couple are walking across the street together.</code> | <code>0.5</code> |
164
- | <code>A couple playing with a little boy on the beach.</code> | <code>A couple watch a little girl play by herself on the beach.</code> | <code>0.0</code> |
165
- | <code>Woman in white in foreground and a man slightly behind walking with a sign for John's Pizza and Gyro in the background.</code> | <code>The woman is wearing white.</code> | <code>1.0</code> |
166
  * Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
167
  ```json
168
  {
@@ -176,19 +204,19 @@ You can finetune this model on your own dataset.
176
  #### all-nli
177
 
178
  * Dataset: all-nli
179
- * Size: 20 evaluation samples
180
  * Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
181
- * Approximate statistics based on the first 20 samples:
182
- | | sentence1 | sentence2 | score |
183
- |:--------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------|
184
- | type | string | string | float |
185
- | details | <ul><li>min: 15 tokens</li><li>mean: 29.75 tokens</li><li>max: 52 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 12.5 tokens</li><li>max: 24 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.42</li><li>max: 1.0</li></ul> |
186
  * Samples:
187
- | sentence1 | sentence2 | score |
188
- |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------|:-----------------|
189
- | <code>Two adults, one female in white, with shades and one male, gray clothes, walking across a street, away from a eatery with a blurred image of a dark colored red shirted person in the foreground.</code> | <code>Two adults walking across a road</code> | <code>1.0</code> |
190
- | <code>A woman is walking across the street eating a banana, while a man is following with his briefcase.</code> | <code>The mans briefcase is for work.</code> | <code>0.5</code> |
191
- | <code>Woman in white in foreground and a man slightly behind walking with a sign for John's Pizza and Gyro in the background.</code> | <code>The man with the sign is caucasian.</code> | <code>0.5</code> |
192
  * Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
193
  ```json
194
  {
@@ -197,6 +225,145 @@ You can finetune this model on your own dataset.
197
  }
198
  ```
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  ### Framework Versions
201
  - Python: 3.12.13
202
  - Sentence Transformers: 5.4.1
 
4
  - sentence-similarity
5
  - feature-extraction
6
  - generated_from_trainer
7
+ - dataset_size:16000
8
  - loss:CoSENTLoss
9
  base_model: abdeljalilELmajjodi/model
10
  widget:
11
+ - source_sentence: A man and woman are walking in a restaurant that has signs in Chinese.
12
  sentences:
13
+ - A newlywed couple is walking through a Chinese restaurant.
14
+ - The woman is sitting on the ground.
15
+ - they are playing basketball
16
+ - source_sentence: Several Asian cooks in a kitchen wearing white Dress Shirts.
 
17
  sentences:
18
+ - A group of women carry woven baskets and large red rugs as they walk down a street.
19
+ - A group of people is observing aquatic life.
20
+ - Severl cooks are in a kitchen.
21
+ - source_sentence: An Asian fish market with fish being cut up for sale.
 
22
  sentences:
23
+ - A man in a blue and white shirt buys fish.
24
+ - Fish are being sold.
25
+ - The only amish person to own a cellphone.
26
+ - source_sentence: An Asian man pushing a wheelchair.
 
27
  sentences:
28
+ - A surfer is in the water.
29
+ - There are at least four people.
30
+ - A girl sitting in a wheelchair waiting for a friend.
31
+ - source_sentence: Seven people are wading in a natural pool.
 
 
32
  sentences:
33
+ - there were five people
34
+ - A man is standing alone.
35
+ - The man is riding a unicycle.
36
  pipeline_tag: sentence-similarity
37
  library_name: sentence-transformers
38
+ metrics:
39
+ - pearson_cosine
40
+ - spearman_cosine
41
+ model-index:
42
+ - name: SentenceTransformer based on abdeljalilELmajjodi/model
43
+ results:
44
+ - task:
45
+ type: semantic-similarity
46
+ name: Semantic Similarity
47
+ dataset:
48
+ name: pair score evaluator dev
49
+ type: pair-score-evaluator-dev
50
+ metrics:
51
+ - type: pearson_cosine
52
+ value: 0.6451319585193018
53
+ name: Pearson Cosine
54
+ - type: spearman_cosine
55
+ value: 0.6628169159235177
56
+ name: Spearman Cosine
57
  ---
58
 
59
  # SentenceTransformer based on abdeljalilELmajjodi/model
 
106
  model = SentenceTransformer("sentence_transformers_model_id")
107
  # Run inference
108
  sentences = [
109
+ 'Seven people are wading in a natural pool.',
110
+ 'there were five people',
111
+ 'The man is riding a unicycle.',
112
  ]
113
  embeddings = model.encode(sentences)
114
  print(embeddings.shape)
 
117
  # Get the similarity scores for the embeddings
118
  similarities = model.similarity(embeddings, embeddings)
119
  print(similarities)
120
+ # tensor([[1.0000, 0.7814, 0.6510],
121
+ # [0.7814, 1.0000, 0.7047],
122
+ # [0.6510, 0.7047, 1.0000]])
123
  ```
124
  <!--
125
  ### Direct Usage (Transformers)
 
145
  *List how the model may foreseeably be misused and address what users ought not to do with the model.*
146
  -->
147
 
148
+ ## Evaluation
149
+
150
+ ### Metrics
151
+
152
+ #### Semantic Similarity
153
+
154
+ * Dataset: `pair-score-evaluator-dev`
155
+ * Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.sentence_transformer.evaluation.EmbeddingSimilarityEvaluator)
156
+
157
+ | Metric | Value |
158
+ |:--------------------|:-----------|
159
+ | pearson_cosine | 0.6451 |
160
+ | **spearman_cosine** | **0.6628** |
161
+
162
  <!--
163
  ## Bias, Risks and Limitations
164
 
 
178
  #### all-nli
179
 
180
  * Dataset: all-nli
181
+ * Size: 16,000 training samples
182
  * Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
183
+ * Approximate statistics based on the first 1000 samples:
184
+ | | sentence1 | sentence2 | score |
185
+ |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
186
+ | type | string | string | float |
187
+ | details | <ul><li>min: 7 tokens</li><li>mean: 18.91 tokens</li><li>max: 66 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 11.42 tokens</li><li>max: 36 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.53</li><li>max: 1.0</li></ul> |
188
  * Samples:
189
+ | sentence1 | sentence2 | score |
190
+ |:---------------------------------------------------------------------------------------------|:------------------------------------------------------|:-----------------|
191
+ | <code>A man in a white shirt is on a rooftop lifting a board.</code> | <code>A man has a white shirt.</code> | <code>1.0</code> |
192
+ | <code>Two men in shorts and sandals are carrying food and drinks at a farmers market.</code> | <code>Men shopping their local market.</code> | <code>1.0</code> |
193
+ | <code>A woman with her head down is in a very run down area.</code> | <code>the man in a suit talks on his cellphone</code> | <code>0.0</code> |
194
  * Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
195
  ```json
196
  {
 
204
  #### all-nli
205
 
206
  * Dataset: all-nli
207
+ * Size: 4,000 evaluation samples
208
  * Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
209
+ * Approximate statistics based on the first 1000 samples:
210
+ | | sentence1 | sentence2 | score |
211
+ |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
212
+ | type | string | string | float |
213
+ | details | <ul><li>min: 7 tokens</li><li>mean: 19.28 tokens</li><li>max: 70 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 11.46 tokens</li><li>max: 46 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.49</li><li>max: 1.0</li></ul> |
214
  * Samples:
215
+ | sentence1 | sentence2 | score |
216
+ |:---------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------|:-----------------|
217
+ | <code>A person dressed in natural clothing taking their picture in a mirror.</code> | <code>the person is nude at the bay</code> | <code>0.0</code> |
218
+ | <code>A basketball team of 8 girls is doing a hand huddle.</code> | <code>An all girls basketball team gets ready to start a game.</code> | <code>1.0</code> |
219
+ | <code>A person in a tan and blue sweater hanging clothes on a clothesline outside the window of her building.</code> | <code>There are no clothes.</code> | <code>0.0</code> |
220
  * Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
221
  ```json
222
  {
 
225
  }
226
  ```
227
 
228
+ ### Training Hyperparameters
229
+ #### Non-Default Hyperparameters
230
+
231
+ - `per_device_eval_batch_size`: 16
232
+ - `gradient_accumulation_steps`: 4
233
+ - `learning_rate`: 2e-05
234
+ - `num_train_epochs`: 4
235
+ - `warmup_steps`: 0.05
236
+ - `bf16`: True
237
+ - `bf16_full_eval`: True
238
+ - `dataloader_num_workers`: 4
239
+ - `load_best_model_at_end`: True
240
+ - `push_to_hub`: True
241
+ - `gradient_checkpointing`: True
242
+
243
+ #### All Hyperparameters
244
+ <details><summary>Click to expand</summary>
245
+
246
+ - `do_predict`: False
247
+ - `prediction_loss_only`: True
248
+ - `per_device_train_batch_size`: 8
249
+ - `per_device_eval_batch_size`: 16
250
+ - `gradient_accumulation_steps`: 4
251
+ - `eval_accumulation_steps`: None
252
+ - `torch_empty_cache_steps`: None
253
+ - `learning_rate`: 2e-05
254
+ - `weight_decay`: 0.0
255
+ - `adam_beta1`: 0.9
256
+ - `adam_beta2`: 0.999
257
+ - `adam_epsilon`: 1e-08
258
+ - `max_grad_norm`: 1.0
259
+ - `num_train_epochs`: 4
260
+ - `max_steps`: -1
261
+ - `lr_scheduler_type`: linear
262
+ - `lr_scheduler_kwargs`: None
263
+ - `warmup_ratio`: None
264
+ - `warmup_steps`: 0.05
265
+ - `log_level`: passive
266
+ - `log_level_replica`: warning
267
+ - `log_on_each_node`: True
268
+ - `logging_nan_inf_filter`: True
269
+ - `enable_jit_checkpoint`: False
270
+ - `save_on_each_node`: False
271
+ - `save_only_model`: False
272
+ - `restore_callback_states_from_checkpoint`: False
273
+ - `use_cpu`: False
274
+ - `seed`: 42
275
+ - `data_seed`: None
276
+ - `bf16`: True
277
+ - `fp16`: False
278
+ - `bf16_full_eval`: True
279
+ - `fp16_full_eval`: False
280
+ - `tf32`: None
281
+ - `local_rank`: -1
282
+ - `ddp_backend`: None
283
+ - `debug`: []
284
+ - `dataloader_drop_last`: False
285
+ - `dataloader_num_workers`: 4
286
+ - `dataloader_prefetch_factor`: None
287
+ - `disable_tqdm`: False
288
+ - `remove_unused_columns`: True
289
+ - `label_names`: None
290
+ - `load_best_model_at_end`: True
291
+ - `ignore_data_skip`: False
292
+ - `fsdp`: []
293
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
294
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
295
+ - `parallelism_config`: None
296
+ - `deepspeed`: None
297
+ - `label_smoothing_factor`: 0.0
298
+ - `optim`: adamw_torch_fused
299
+ - `optim_args`: None
300
+ - `group_by_length`: False
301
+ - `length_column_name`: length
302
+ - `project`: huggingface
303
+ - `trackio_space_id`: trackio
304
+ - `ddp_find_unused_parameters`: None
305
+ - `ddp_bucket_cap_mb`: None
306
+ - `ddp_broadcast_buffers`: False
307
+ - `dataloader_pin_memory`: True
308
+ - `dataloader_persistent_workers`: False
309
+ - `skip_memory_metrics`: True
310
+ - `push_to_hub`: True
311
+ - `resume_from_checkpoint`: None
312
+ - `hub_model_id`: None
313
+ - `hub_strategy`: every_save
314
+ - `hub_private_repo`: None
315
+ - `hub_always_push`: False
316
+ - `hub_revision`: None
317
+ - `gradient_checkpointing`: True
318
+ - `gradient_checkpointing_kwargs`: None
319
+ - `include_for_metrics`: []
320
+ - `eval_do_concat_batches`: True
321
+ - `auto_find_batch_size`: False
322
+ - `full_determinism`: False
323
+ - `ddp_timeout`: 1800
324
+ - `torch_compile`: False
325
+ - `torch_compile_backend`: None
326
+ - `torch_compile_mode`: None
327
+ - `include_num_input_tokens_seen`: no
328
+ - `neftune_noise_alpha`: None
329
+ - `optim_target_modules`: None
330
+ - `batch_eval_metrics`: False
331
+ - `eval_on_start`: False
332
+ - `use_liger_kernel`: False
333
+ - `liger_kernel_config`: None
334
+ - `eval_use_gather_object`: False
335
+ - `average_tokens_across_devices`: True
336
+ - `use_cache`: False
337
+ - `prompts`: None
338
+ - `batch_sampler`: batch_sampler
339
+ - `multi_dataset_batch_sampler`: proportional
340
+ - `router_mapping`: {}
341
+ - `learning_rate_mapping`: {}
342
+
343
+ </details>
344
+
345
+ ### Training Logs
346
+ | Epoch | Step | Training Loss | Validation Loss | pair-score-evaluator-dev_spearman_cosine |
347
+ |:-------:|:--------:|:-------------:|:---------------:|:----------------------------------------:|
348
+ | -1 | -1 | - | - | 0.1511 |
349
+ | 0.002 | 1 | 3.0124 | - | - |
350
+ | 0.4 | 200 | 2.8949 | - | - |
351
+ | 0.8 | 400 | 2.7600 | - | - |
352
+ | 1.2 | 600 | 2.6245 | - | - |
353
+ | 1.6 | 800 | 2.5053 | - | - |
354
+ | 2.0 | 1000 | 2.4926 | - | - |
355
+ | 2.4 | 1200 | 2.2290 | - | - |
356
+ | 2.8 | 1400 | 2.1972 | - | - |
357
+ | 3.2 | 1600 | 2.0796 | - | - |
358
+ | 3.6 | 1800 | 1.9814 | - | - |
359
+ | **4.0** | **2000** | **1.9559** | **4.461** | **0.6628** |
360
+ | -1 | -1 | - | - | 0.6628 |
361
+
362
+ * The bold row denotes the saved checkpoint.
363
+
364
+ ### Training Time
365
+ - **Training**: 1.6 hours
366
+
367
  ### Framework Versions
368
  - Python: 3.12.13
369
  - Sentence Transformers: 5.4.1