radoslavralev commited on
Commit
61fe45c
·
verified ·
1 Parent(s): 633eec3

Add new SentenceTransformer model

Browse files
Files changed (3) hide show
  1. README.md +28 -42
  2. sentence_bert_config.json +1 -1
  3. tokenizer_config.json +7 -1
README.md CHANGED
@@ -13,8 +13,8 @@ tags:
13
  - reranking
14
  - generated_from_trainer
15
  - dataset_size:483820
16
- - loss:MultipleNegativesSymmetricRankingLoss
17
- base_model: Alibaba-NLP/gte-modernbert-base
18
  widget:
19
  - source_sentence: 'See Precambrian time scale # Proposed Geologic timeline for another
20
  set of periods 4600 -- 541 MYA .'
@@ -87,41 +87,41 @@ model-index:
87
  type: test
88
  metrics:
89
  - type: cosine_accuracy
90
- value: 0.7035681462730365
91
  name: Cosine Accuracy
92
  - type: cosine_accuracy_threshold
93
- value: 0.8473721742630005
94
  name: Cosine Accuracy Threshold
95
  - type: cosine_f1
96
- value: 0.712274188436637
97
  name: Cosine F1
98
  - type: cosine_f1_threshold
99
- value: 0.8116312026977539
100
  name: Cosine F1 Threshold
101
  - type: cosine_precision
102
- value: 0.5987668417446905
103
  name: Cosine Precision
104
  - type: cosine_recall
105
- value: 0.8788826815642458
106
  name: Cosine Recall
107
  - type: cosine_ap
108
- value: 0.6473811496690576
109
  name: Cosine Ap
110
  - type: cosine_mcc
111
- value: 0.4419218320172892
112
  name: Cosine Mcc
113
  ---
114
 
115
  # Redis fine-tuned BiEncoder model for semantic caching on LangCache
116
 
117
- This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Alibaba-NLP/gte-modernbert-base](https://huggingface.co/Alibaba-NLP/gte-modernbert-base) on the [LangCache Sentence Pairs (all)](https://huggingface.co/datasets/redis/langcache-sentencepairs-v1) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for sentence pair similarity.
118
 
119
  ## Model Details
120
 
121
  ### Model Description
122
  - **Model Type:** Sentence Transformer
123
- - **Base model:** [Alibaba-NLP/gte-modernbert-base](https://huggingface.co/Alibaba-NLP/gte-modernbert-base) <!-- at revision e7f32e3c00f91d699e8c43b53106206bcc72bb22 -->
124
- - **Maximum Sequence Length:** 8192 tokens
125
  - **Output Dimensionality:** 768 dimensions
126
  - **Similarity Function:** Cosine Similarity
127
  - **Training Dataset:**
@@ -139,7 +139,7 @@ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [A
139
 
140
  ```
141
  SentenceTransformer(
142
- (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
143
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
144
  )
145
  ```
@@ -173,9 +173,9 @@ print(embeddings.shape)
173
  # Get the similarity scores for the embeddings
174
  similarities = model.similarity(embeddings, embeddings)
175
  print(similarities)
176
- # tensor([[0.9922, 0.9922, 0.5352],
177
- # [0.9922, 0.9961, 0.5391],
178
- # [0.5352, 0.5391, 1.0000]], dtype=torch.bfloat16)
179
  ```
180
 
181
  <!--
@@ -213,14 +213,14 @@ You can finetune this model on your own dataset.
213
 
214
  | Metric | Value |
215
  |:--------------------------|:-----------|
216
- | cosine_accuracy | 0.7036 |
217
- | cosine_accuracy_threshold | 0.8474 |
218
- | cosine_f1 | 0.7123 |
219
- | cosine_f1_threshold | 0.8116 |
220
- | cosine_precision | 0.5988 |
221
- | cosine_recall | 0.8789 |
222
- | **cosine_ap** | **0.6474** |
223
- | cosine_mcc | 0.4419 |
224
 
225
  <!--
226
  ## Bias, Risks and Limitations
@@ -254,14 +254,7 @@ You can finetune this model on your own dataset.
254
  | <code>The newer Punts are still very much in existence today and race in the same fleets as the older boats .</code> | <code>The newer punts are still very much in existence today and run in the same fleets as the older boats .</code> | <code>1</code> |
255
  | <code>After losing his second election , he resigned as opposition leader and was replaced by Geoff Pearsall .</code> | <code>Max Bingham resigned as opposition leader after losing his second election , and was replaced by Geoff Pearsall .</code> | <code>1</code> |
256
  | <code>The 12F was officially homologated on August 21 , 1929 and exhibited at the Paris Salon in 1930 .</code> | <code>The 12F was officially homologated on 21 August 1929 and displayed at the 1930 Paris Salon .</code> | <code>1</code> |
257
- * Loss: [<code>MultipleNegativesSymmetricRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativessymmetricrankingloss) with these parameters:
258
- ```json
259
- {
260
- "scale": 20.0,
261
- "similarity_fct": "cos_sim",
262
- "gather_across_devices": false
263
- }
264
- ```
265
 
266
  ### Evaluation Dataset
267
 
@@ -281,19 +274,12 @@ You can finetune this model on your own dataset.
281
  | <code>The newer Punts are still very much in existence today and race in the same fleets as the older boats .</code> | <code>The newer punts are still very much in existence today and run in the same fleets as the older boats .</code> | <code>1</code> |
282
  | <code>After losing his second election , he resigned as opposition leader and was replaced by Geoff Pearsall .</code> | <code>Max Bingham resigned as opposition leader after losing his second election , and was replaced by Geoff Pearsall .</code> | <code>1</code> |
283
  | <code>The 12F was officially homologated on August 21 , 1929 and exhibited at the Paris Salon in 1930 .</code> | <code>The 12F was officially homologated on 21 August 1929 and displayed at the 1930 Paris Salon .</code> | <code>1</code> |
284
- * Loss: [<code>MultipleNegativesSymmetricRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativessymmetricrankingloss) with these parameters:
285
- ```json
286
- {
287
- "scale": 20.0,
288
- "similarity_fct": "cos_sim",
289
- "gather_across_devices": false
290
- }
291
- ```
292
 
293
  ### Training Logs
294
  | Epoch | Step | test_cosine_ap |
295
  |:-----:|:----:|:--------------:|
296
- | -1 | -1 | 0.6474 |
297
 
298
 
299
  ### Framework Versions
 
13
  - reranking
14
  - generated_from_trainer
15
  - dataset_size:483820
16
+ - loss:OnlineContrastiveLoss
17
+ base_model: redis/langcache-embed-v3
18
  widget:
19
  - source_sentence: 'See Precambrian time scale # Proposed Geologic timeline for another
20
  set of periods 4600 -- 541 MYA .'
 
87
  type: test
88
  metrics:
89
  - type: cosine_accuracy
90
+ value: 0.7213201979974525
91
  name: Cosine Accuracy
92
  - type: cosine_accuracy_threshold
93
+ value: 0.8022605776786804
94
  name: Cosine Accuracy Threshold
95
  - type: cosine_f1
96
+ value: 0.7271285588186892
97
  name: Cosine F1
98
  - type: cosine_f1_threshold
99
+ value: 0.7352645397186279
100
  name: Cosine F1 Threshold
101
  - type: cosine_precision
102
+ value: 0.6076617238878748
103
  name: Cosine Precision
104
  - type: cosine_recall
105
+ value: 0.9050651769087523
106
  name: Cosine Recall
107
  - type: cosine_ap
108
+ value: 0.6862317912116369
109
  name: Cosine Ap
110
  - type: cosine_mcc
111
+ value: 0.47517110412821156
112
  name: Cosine Mcc
113
  ---
114
 
115
  # Redis fine-tuned BiEncoder model for semantic caching on LangCache
116
 
117
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [redis/langcache-embed-v3](https://huggingface.co/redis/langcache-embed-v3) on the [LangCache Sentence Pairs (all)](https://huggingface.co/datasets/redis/langcache-sentencepairs-v1) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for sentence pair similarity.
118
 
119
  ## Model Details
120
 
121
  ### Model Description
122
  - **Model Type:** Sentence Transformer
123
+ - **Base model:** [redis/langcache-embed-v3](https://huggingface.co/redis/langcache-embed-v3) <!-- at revision 633eec346df6e939f4ab69457313792491ab1a5e -->
124
+ - **Maximum Sequence Length:** 100 tokens
125
  - **Output Dimensionality:** 768 dimensions
126
  - **Similarity Function:** Cosine Similarity
127
  - **Training Dataset:**
 
139
 
140
  ```
141
  SentenceTransformer(
142
+ (0): Transformer({'max_seq_length': 100, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
143
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
144
  )
145
  ```
 
173
  # Get the similarity scores for the embeddings
174
  similarities = model.similarity(embeddings, embeddings)
175
  print(similarities)
176
+ # tensor([[1.0000, 0.9961, 0.1328],
177
+ # [0.9961, 1.0000, 0.1235],
178
+ # [0.1328, 0.1235, 0.9961]], dtype=torch.bfloat16)
179
  ```
180
 
181
  <!--
 
213
 
214
  | Metric | Value |
215
  |:--------------------------|:-----------|
216
+ | cosine_accuracy | 0.7213 |
217
+ | cosine_accuracy_threshold | 0.8023 |
218
+ | cosine_f1 | 0.7271 |
219
+ | cosine_f1_threshold | 0.7353 |
220
+ | cosine_precision | 0.6077 |
221
+ | cosine_recall | 0.9051 |
222
+ | **cosine_ap** | **0.6862** |
223
+ | cosine_mcc | 0.4752 |
224
 
225
  <!--
226
  ## Bias, Risks and Limitations
 
254
  | <code>The newer Punts are still very much in existence today and race in the same fleets as the older boats .</code> | <code>The newer punts are still very much in existence today and run in the same fleets as the older boats .</code> | <code>1</code> |
255
  | <code>After losing his second election , he resigned as opposition leader and was replaced by Geoff Pearsall .</code> | <code>Max Bingham resigned as opposition leader after losing his second election , and was replaced by Geoff Pearsall .</code> | <code>1</code> |
256
  | <code>The 12F was officially homologated on August 21 , 1929 and exhibited at the Paris Salon in 1930 .</code> | <code>The 12F was officially homologated on 21 August 1929 and displayed at the 1930 Paris Salon .</code> | <code>1</code> |
257
+ * Loss: [<code>OnlineContrastiveLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#onlinecontrastiveloss)
 
 
 
 
 
 
 
258
 
259
  ### Evaluation Dataset
260
 
 
274
  | <code>The newer Punts are still very much in existence today and race in the same fleets as the older boats .</code> | <code>The newer punts are still very much in existence today and run in the same fleets as the older boats .</code> | <code>1</code> |
275
  | <code>After losing his second election , he resigned as opposition leader and was replaced by Geoff Pearsall .</code> | <code>Max Bingham resigned as opposition leader after losing his second election , and was replaced by Geoff Pearsall .</code> | <code>1</code> |
276
  | <code>The 12F was officially homologated on August 21 , 1929 and exhibited at the Paris Salon in 1930 .</code> | <code>The 12F was officially homologated on 21 August 1929 and displayed at the 1930 Paris Salon .</code> | <code>1</code> |
277
+ * Loss: [<code>OnlineContrastiveLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#onlinecontrastiveloss)
 
 
 
 
 
 
 
278
 
279
  ### Training Logs
280
  | Epoch | Step | test_cosine_ap |
281
  |:-----:|:----:|:--------------:|
282
+ | -1 | -1 | 0.6862 |
283
 
284
 
285
  ### Framework Versions
sentence_bert_config.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "max_seq_length": 8192,
3
  "do_lower_case": false
4
  }
 
1
  {
2
+ "max_seq_length": 100,
3
  "do_lower_case": false
4
  }
tokenizer_config.json CHANGED
@@ -938,9 +938,15 @@
938
  "input_ids",
939
  "attention_mask"
940
  ],
941
- "model_max_length": 1000000000000000019884624838656,
 
942
  "pad_token": "[PAD]",
 
 
943
  "sep_token": "[SEP]",
 
944
  "tokenizer_class": "PreTrainedTokenizerFast",
 
 
945
  "unk_token": "[UNK]"
946
  }
 
938
  "input_ids",
939
  "attention_mask"
940
  ],
941
+ "model_max_length": 8192,
942
+ "pad_to_multiple_of": null,
943
  "pad_token": "[PAD]",
944
+ "pad_token_type_id": 0,
945
+ "padding_side": "right",
946
  "sep_token": "[SEP]",
947
+ "stride": 0,
948
  "tokenizer_class": "PreTrainedTokenizerFast",
949
+ "truncation_side": "right",
950
+ "truncation_strategy": "longest_first",
951
  "unk_token": "[UNK]"
952
  }