Updated README to a bare minimum template
#4
by
srijithrajamohan
- opened
README.md
CHANGED
|
@@ -2,24 +2,16 @@
|
|
| 2 |
tags:
|
| 3 |
- sentence-transformers
|
| 4 |
- sentence-similarity
|
| 5 |
-
- feature-extraction
|
| 6 |
-
- generated_from_trainer
|
| 7 |
-
- dataset_size:2438
|
| 8 |
-
- loss:MatryoshkaLoss
|
| 9 |
- loss:OnlineContrastiveLoss
|
| 10 |
base_model: Alibaba-NLP/gte-modernbert-base
|
| 11 |
-
|
| 12 |
pipeline_tag: sentence-similarity
|
| 13 |
library_name: sentence-transformers
|
| 14 |
metrics:
|
| 15 |
- cosine_accuracy
|
| 16 |
-
- cosine_accuracy_threshold
|
| 17 |
-
- cosine_f1
|
| 18 |
-
- cosine_f1_threshold
|
| 19 |
- cosine_precision
|
| 20 |
- cosine_recall
|
|
|
|
| 21 |
- cosine_ap
|
| 22 |
-
- cosine_mcc
|
| 23 |
model-index:
|
| 24 |
- name: SentenceTransformer based on Alibaba-NLP/gte-modernbert-base
|
| 25 |
results:
|
|
@@ -27,38 +19,29 @@ model-index:
|
|
| 27 |
type: my-binary-classification
|
| 28 |
name: My Binary Classification
|
| 29 |
dataset:
|
| 30 |
-
name:
|
| 31 |
type: unknown
|
| 32 |
metrics:
|
| 33 |
- type: cosine_accuracy
|
| 34 |
-
value:
|
| 35 |
name: Cosine Accuracy
|
| 36 |
-
- type: cosine_accuracy_threshold
|
| 37 |
-
value: 0.8090976476669312
|
| 38 |
-
name: Cosine Accuracy Threshold
|
| 39 |
- type: cosine_f1
|
| 40 |
-
value:
|
| 41 |
name: Cosine F1
|
| 42 |
-
- type: cosine_f1_threshold
|
| 43 |
-
value: 0.8090976476669312
|
| 44 |
-
name: Cosine F1 Threshold
|
| 45 |
- type: cosine_precision
|
| 46 |
-
value:
|
| 47 |
name: Cosine Precision
|
| 48 |
- type: cosine_recall
|
| 49 |
-
value:
|
| 50 |
name: Cosine Recall
|
| 51 |
- type: cosine_ap
|
| 52 |
-
value:
|
| 53 |
name: Cosine Ap
|
| 54 |
-
- type: cosine_mcc
|
| 55 |
-
value: 0.8312925398469787
|
| 56 |
-
name: Cosine Mcc
|
| 57 |
---
|
| 58 |
|
| 59 |
# SentenceTransformer based on Alibaba-NLP/gte-modernbert-base
|
| 60 |
|
| 61 |
-
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 csv dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity
|
| 62 |
|
| 63 |
## Model Details
|
| 64 |
|
|
@@ -69,7 +52,7 @@ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [A
|
|
| 69 |
- **Output Dimensionality:** 768 dimensions
|
| 70 |
- **Similarity Function:** Cosine Similarity
|
| 71 |
- **Training Dataset:**
|
| 72 |
-
- csv
|
| 73 |
<!-- - **Language:** Unknown -->
|
| 74 |
<!-- - **License:** Unknown -->
|
| 75 |
|
|
@@ -83,15 +66,13 @@ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [A
|
|
| 83 |
|
| 84 |
```
|
| 85 |
SentenceTransformer(
|
| 86 |
-
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: ModernBertModel
|
| 87 |
(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})
|
| 88 |
)
|
| 89 |
```
|
| 90 |
|
| 91 |
## Usage
|
| 92 |
|
| 93 |
-
### Direct Usage (Sentence Transformers)
|
| 94 |
-
|
| 95 |
First install the Sentence Transformers library:
|
| 96 |
|
| 97 |
```bash
|
|
@@ -103,12 +84,12 @@ Then you can load this model and run inference.
|
|
| 103 |
from sentence_transformers import SentenceTransformer
|
| 104 |
|
| 105 |
# Download from the 🤗 Hub
|
| 106 |
-
model = SentenceTransformer("
|
| 107 |
# Run inference
|
| 108 |
sentences = [
|
| 109 |
-
'
|
| 110 |
-
|
| 111 |
-
|
| 112 |
]
|
| 113 |
embeddings = model.encode(sentences)
|
| 114 |
print(embeddings.shape)
|
|
@@ -117,286 +98,36 @@ print(embeddings.shape)
|
|
| 117 |
# Get the similarity scores for the embeddings
|
| 118 |
similarities = model.similarity(embeddings, embeddings)
|
| 119 |
print(similarities.shape)
|
| 120 |
-
# [3, 3]
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
-
<!--
|
| 124 |
-
### Direct Usage (Transformers)
|
| 125 |
-
|
| 126 |
-
<details><summary>Click to see the direct usage in Transformers</summary>
|
| 127 |
-
|
| 128 |
-
</details>
|
| 129 |
-
-->
|
| 130 |
-
|
| 131 |
-
<!--
|
| 132 |
-
### Downstream Usage (Sentence Transformers)
|
| 133 |
-
|
| 134 |
-
You can finetune this model on your own dataset.
|
| 135 |
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
</details>
|
| 139 |
-
-->
|
| 140 |
-
|
| 141 |
-
<!--
|
| 142 |
-
### Out-of-Scope Use
|
| 143 |
-
|
| 144 |
-
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 145 |
-
-->
|
| 146 |
-
|
| 147 |
-
## Evaluation
|
| 148 |
-
|
| 149 |
-
### Metrics
|
| 150 |
-
|
| 151 |
-
#### My Binary Classification
|
| 152 |
-
|
| 153 |
-
* Evaluated with <code>scache.train.MyBinaryClassificationEvaluator</code>
|
| 154 |
-
|
| 155 |
-
| Metric | Value |
|
| 156 |
-
|:--------------------------|:-----------|
|
| 157 |
-
| cosine_accuracy | 0.916 |
|
| 158 |
-
| cosine_accuracy_threshold | 0.8091 |
|
| 159 |
-
| cosine_f1 | 0.9216 |
|
| 160 |
-
| cosine_f1_threshold | 0.8091 |
|
| 161 |
-
| cosine_precision | 0.9305 |
|
| 162 |
-
| cosine_recall | 0.9129 |
|
| 163 |
-
| **cosine_ap** | **0.9742** |
|
| 164 |
-
| cosine_mcc | 0.8313 |
|
| 165 |
-
|
| 166 |
-
<!--
|
| 167 |
-
## Bias, Risks and Limitations
|
| 168 |
|
| 169 |
-
|
| 170 |
-
-->
|
| 171 |
|
| 172 |
-
<!--
|
| 173 |
-
### Recommendations
|
| 174 |
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
-
## Training Details
|
| 179 |
|
| 180 |
### Training Dataset
|
| 181 |
|
| 182 |
#### csv
|
| 183 |
|
| 184 |
* Dataset: csv
|
| 185 |
-
* Size:
|
| 186 |
* Columns: <code>question_1</code>, <code>question_2</code>, and <code>label</code>
|
| 187 |
-
* Approximate statistics based on the first 1000 samples:
|
| 188 |
-
|
| 189 |
-
* Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
|
| 190 |
-
```json
|
| 191 |
-
{
|
| 192 |
-
"loss": "OnlineContrastiveLoss",
|
| 193 |
-
"matryoshka_dims": [
|
| 194 |
-
768,
|
| 195 |
-
512,
|
| 196 |
-
256,
|
| 197 |
-
128,
|
| 198 |
-
64
|
| 199 |
-
],
|
| 200 |
-
"matryoshka_weights": [
|
| 201 |
-
1,
|
| 202 |
-
1,
|
| 203 |
-
1,
|
| 204 |
-
1,
|
| 205 |
-
1
|
| 206 |
-
],
|
| 207 |
-
"n_dims_per_step": -1
|
| 208 |
-
}
|
| 209 |
-
```
|
| 210 |
|
| 211 |
### Evaluation Dataset
|
| 212 |
|
| 213 |
#### csv
|
| 214 |
|
| 215 |
* Dataset: csv
|
| 216 |
-
* Size:
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
### Training Hyperparameters
|
| 220 |
-
#### Non-Default Hyperparameters
|
| 221 |
-
|
| 222 |
-
- `eval_strategy`: steps
|
| 223 |
-
- `per_device_train_batch_size`: 16
|
| 224 |
-
- `per_device_eval_batch_size`: 256
|
| 225 |
-
- `learning_rate`: 6.5383156211679e-05
|
| 226 |
-
- `max_grad_norm`: 0.5
|
| 227 |
-
- `num_train_epochs`: 1
|
| 228 |
-
- `lr_scheduler_type`: constant
|
| 229 |
-
- `load_best_model_at_end`: True
|
| 230 |
-
- `torch_compile`: True
|
| 231 |
-
- `torch_compile_backend`: inductor
|
| 232 |
-
- `batch_sampler`: no_duplicates
|
| 233 |
-
|
| 234 |
-
#### All Hyperparameters
|
| 235 |
-
<details><summary>Click to expand</summary>
|
| 236 |
-
|
| 237 |
-
- `overwrite_output_dir`: False
|
| 238 |
-
- `do_predict`: False
|
| 239 |
-
- `eval_strategy`: steps
|
| 240 |
-
- `prediction_loss_only`: True
|
| 241 |
-
- `per_device_train_batch_size`: 16
|
| 242 |
-
- `per_device_eval_batch_size`: 256
|
| 243 |
-
- `per_gpu_train_batch_size`: None
|
| 244 |
-
- `per_gpu_eval_batch_size`: None
|
| 245 |
-
- `gradient_accumulation_steps`: 1
|
| 246 |
-
- `eval_accumulation_steps`: None
|
| 247 |
-
- `torch_empty_cache_steps`: None
|
| 248 |
-
- `learning_rate`: 6.5383156211679e-05
|
| 249 |
-
- `weight_decay`: 0.0
|
| 250 |
-
- `adam_beta1`: 0.9
|
| 251 |
-
- `adam_beta2`: 0.999
|
| 252 |
-
- `adam_epsilon`: 1e-08
|
| 253 |
-
- `max_grad_norm`: 0.5
|
| 254 |
-
- `num_train_epochs`: 1
|
| 255 |
-
- `max_steps`: -1
|
| 256 |
-
- `lr_scheduler_type`: constant
|
| 257 |
-
- `lr_scheduler_kwargs`: {}
|
| 258 |
-
- `warmup_ratio`: 0.0
|
| 259 |
-
- `warmup_steps`: 0
|
| 260 |
-
- `log_level`: passive
|
| 261 |
-
- `log_level_replica`: warning
|
| 262 |
-
- `log_on_each_node`: True
|
| 263 |
-
- `logging_nan_inf_filter`: True
|
| 264 |
-
- `save_safetensors`: True
|
| 265 |
-
- `save_on_each_node`: False
|
| 266 |
-
- `save_only_model`: False
|
| 267 |
-
- `restore_callback_states_from_checkpoint`: False
|
| 268 |
-
- `no_cuda`: False
|
| 269 |
-
- `use_cpu`: False
|
| 270 |
-
- `use_mps_device`: False
|
| 271 |
-
- `seed`: 42
|
| 272 |
-
- `data_seed`: None
|
| 273 |
-
- `jit_mode_eval`: False
|
| 274 |
-
- `use_ipex`: False
|
| 275 |
-
- `bf16`: False
|
| 276 |
-
- `fp16`: False
|
| 277 |
-
- `fp16_opt_level`: O1
|
| 278 |
-
- `half_precision_backend`: auto
|
| 279 |
-
- `bf16_full_eval`: False
|
| 280 |
-
- `fp16_full_eval`: False
|
| 281 |
-
- `tf32`: None
|
| 282 |
-
- `local_rank`: 0
|
| 283 |
-
- `ddp_backend`: None
|
| 284 |
-
- `tpu_num_cores`: None
|
| 285 |
-
- `tpu_metrics_debug`: False
|
| 286 |
-
- `debug`: []
|
| 287 |
-
- `dataloader_drop_last`: False
|
| 288 |
-
- `dataloader_num_workers`: 0
|
| 289 |
-
- `dataloader_prefetch_factor`: None
|
| 290 |
-
- `past_index`: -1
|
| 291 |
-
- `disable_tqdm`: False
|
| 292 |
-
- `remove_unused_columns`: True
|
| 293 |
-
- `label_names`: None
|
| 294 |
-
- `load_best_model_at_end`: True
|
| 295 |
-
- `ignore_data_skip`: False
|
| 296 |
-
- `fsdp`: []
|
| 297 |
-
- `fsdp_min_num_params`: 0
|
| 298 |
-
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
| 299 |
-
- `fsdp_transformer_layer_cls_to_wrap`: None
|
| 300 |
-
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
| 301 |
-
- `deepspeed`: None
|
| 302 |
-
- `label_smoothing_factor`: 0.0
|
| 303 |
-
- `optim`: adamw_torch
|
| 304 |
-
- `optim_args`: None
|
| 305 |
-
- `adafactor`: False
|
| 306 |
-
- `group_by_length`: False
|
| 307 |
-
- `length_column_name`: length
|
| 308 |
-
- `ddp_find_unused_parameters`: None
|
| 309 |
-
- `ddp_bucket_cap_mb`: None
|
| 310 |
-
- `ddp_broadcast_buffers`: False
|
| 311 |
-
- `dataloader_pin_memory`: True
|
| 312 |
-
- `dataloader_persistent_workers`: False
|
| 313 |
-
- `skip_memory_metrics`: True
|
| 314 |
-
- `use_legacy_prediction_loop`: False
|
| 315 |
-
- `push_to_hub`: False
|
| 316 |
-
- `resume_from_checkpoint`: None
|
| 317 |
-
- `hub_model_id`: None
|
| 318 |
-
- `hub_strategy`: every_save
|
| 319 |
-
- `hub_private_repo`: None
|
| 320 |
-
- `hub_always_push`: False
|
| 321 |
-
- `gradient_checkpointing`: False
|
| 322 |
-
- `gradient_checkpointing_kwargs`: None
|
| 323 |
-
- `include_inputs_for_metrics`: False
|
| 324 |
-
- `include_for_metrics`: []
|
| 325 |
-
- `eval_do_concat_batches`: True
|
| 326 |
-
- `fp16_backend`: auto
|
| 327 |
-
- `push_to_hub_model_id`: None
|
| 328 |
-
- `push_to_hub_organization`: None
|
| 329 |
-
- `mp_parameters`:
|
| 330 |
-
- `auto_find_batch_size`: False
|
| 331 |
-
- `full_determinism`: False
|
| 332 |
-
- `torchdynamo`: None
|
| 333 |
-
- `ray_scope`: last
|
| 334 |
-
- `ddp_timeout`: 1800
|
| 335 |
-
- `torch_compile`: True
|
| 336 |
-
- `torch_compile_backend`: inductor
|
| 337 |
-
- `torch_compile_mode`: None
|
| 338 |
-
- `dispatch_batches`: None
|
| 339 |
-
- `split_batches`: None
|
| 340 |
-
- `include_tokens_per_second`: False
|
| 341 |
-
- `include_num_input_tokens_seen`: False
|
| 342 |
-
- `neftune_noise_alpha`: None
|
| 343 |
-
- `optim_target_modules`: None
|
| 344 |
-
- `batch_eval_metrics`: False
|
| 345 |
-
- `eval_on_start`: False
|
| 346 |
-
- `use_liger_kernel`: False
|
| 347 |
-
- `eval_use_gather_object`: False
|
| 348 |
-
- `average_tokens_across_devices`: False
|
| 349 |
-
- `prompts`: None
|
| 350 |
-
- `batch_sampler`: no_duplicates
|
| 351 |
-
- `multi_dataset_batch_sampler`: proportional
|
| 352 |
-
|
| 353 |
-
</details>
|
| 354 |
-
|
| 355 |
-
### Training Logs
|
| 356 |
-
| Epoch | Step | Training Loss | Validation Loss | cosine_ap |
|
| 357 |
-
|:----------:|:------:|:-------------:|:---------------:|:----------:|
|
| 358 |
-
| 0.0323 | 1 | 4.4977 | - | - |
|
| 359 |
-
| 0.0645 | 2 | 4.9952 | - | - |
|
| 360 |
-
| 0.0968 | 3 | 2.9984 | - | - |
|
| 361 |
-
| 0.1290 | 4 | 4.8052 | - | - |
|
| 362 |
-
| 0.1613 | 5 | 4.0031 | - | - |
|
| 363 |
-
| 0.1935 | 6 | 3.7682 | - | - |
|
| 364 |
-
| 0.2258 | 7 | 4.0361 | - | - |
|
| 365 |
-
| 0.2581 | 8 | 3.4003 | - | - |
|
| 366 |
-
| 0.2903 | 9 | 1.1674 | - | - |
|
| 367 |
-
| **0.3226** | **10** | **2.3826** | **14.3756** | **0.9742** |
|
| 368 |
-
| 0.3548 | 11 | 3.8777 | - | - |
|
| 369 |
-
| 0.3871 | 12 | 2.6367 | - | - |
|
| 370 |
-
| 0.4194 | 13 | 2.5763 | - | - |
|
| 371 |
-
| 0.4516 | 14 | 3.5591 | - | - |
|
| 372 |
-
| 0.4839 | 15 | 2.3568 | - | - |
|
| 373 |
-
| 0.5161 | 16 | 2.9432 | - | - |
|
| 374 |
-
| 0.5484 | 17 | 2.746 | - | - |
|
| 375 |
-
| 0.5806 | 18 | 3.647 | - | - |
|
| 376 |
-
| 0.6129 | 19 | 3.0907 | - | - |
|
| 377 |
-
| 0.6452 | 20 | 3.9776 | 12.4766 | 0.9771 |
|
| 378 |
-
| 0.6774 | 21 | 3.4131 | - | - |
|
| 379 |
-
| 0.7097 | 22 | 3.0084 | - | - |
|
| 380 |
-
| 0.7419 | 23 | 2.7182 | - | - |
|
| 381 |
-
| 0.7742 | 24 | 1.5211 | - | - |
|
| 382 |
-
| 0.8065 | 25 | 1.8332 | - | - |
|
| 383 |
-
| 0.8387 | 26 | 3.4883 | - | - |
|
| 384 |
-
| 0.8710 | 27 | 2.0585 | - | - |
|
| 385 |
-
| 0.9032 | 28 | 2.775 | - | - |
|
| 386 |
-
| 0.9355 | 29 | 2.9137 | - | - |
|
| 387 |
-
| 0.9677 | 30 | 2.4238 | 12.4805 | 0.9769 |
|
| 388 |
-
| 1.0 | 31 | 1.2115 | 14.3756 | 0.9742 |
|
| 389 |
-
|
| 390 |
-
* The bold row denotes the saved checkpoint.
|
| 391 |
-
|
| 392 |
-
### Framework Versions
|
| 393 |
-
- Python: 3.11.11
|
| 394 |
-
- Sentence Transformers: 3.4.1
|
| 395 |
-
- Transformers: 4.49.0
|
| 396 |
-
- PyTorch: 2.5.1+cu124
|
| 397 |
-
- Accelerate: 1.4.0
|
| 398 |
-
- Datasets: 3.3.2
|
| 399 |
-
- Tokenizers: 0.21.0
|
| 400 |
|
| 401 |
## Citation
|
| 402 |
|
|
@@ -404,33 +135,14 @@ You can finetune this model on your own dataset.
|
|
| 404 |
|
| 405 |
#### Sentence Transformers
|
| 406 |
```bibtex
|
| 407 |
-
@inproceedings{
|
| 408 |
-
title = "
|
| 409 |
-
author = "
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
url = "https://arxiv.org/abs/1908.10084",
|
| 415 |
}
|
| 416 |
```
|
| 417 |
|
| 418 |
-
|
| 419 |
-
|
| 420 |
<!--
|
| 421 |
-
## Glossary
|
| 422 |
-
|
| 423 |
-
*Clearly define terms in order to be accessible across audiences.*
|
| 424 |
-
-->
|
| 425 |
-
|
| 426 |
-
<!--
|
| 427 |
-
## Model Card Authors
|
| 428 |
-
|
| 429 |
-
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
| 430 |
-
-->
|
| 431 |
-
|
| 432 |
-
<!--
|
| 433 |
-
## Model Card Contact
|
| 434 |
-
|
| 435 |
-
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 436 |
-
-->
|
|
|
|
| 2 |
tags:
|
| 3 |
- sentence-transformers
|
| 4 |
- sentence-similarity
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
- loss:OnlineContrastiveLoss
|
| 6 |
base_model: Alibaba-NLP/gte-modernbert-base
|
|
|
|
| 7 |
pipeline_tag: sentence-similarity
|
| 8 |
library_name: sentence-transformers
|
| 9 |
metrics:
|
| 10 |
- cosine_accuracy
|
|
|
|
|
|
|
|
|
|
| 11 |
- cosine_precision
|
| 12 |
- cosine_recall
|
| 13 |
+
- cosine_f1
|
| 14 |
- cosine_ap
|
|
|
|
| 15 |
model-index:
|
| 16 |
- name: SentenceTransformer based on Alibaba-NLP/gte-modernbert-base
|
| 17 |
results:
|
|
|
|
| 19 |
type: my-binary-classification
|
| 20 |
name: My Binary Classification
|
| 21 |
dataset:
|
| 22 |
+
name: Quora
|
| 23 |
type: unknown
|
| 24 |
metrics:
|
| 25 |
- type: cosine_accuracy
|
| 26 |
+
value:
|
| 27 |
name: Cosine Accuracy
|
|
|
|
|
|
|
|
|
|
| 28 |
- type: cosine_f1
|
| 29 |
+
value:
|
| 30 |
name: Cosine F1
|
|
|
|
|
|
|
|
|
|
| 31 |
- type: cosine_precision
|
| 32 |
+
value:
|
| 33 |
name: Cosine Precision
|
| 34 |
- type: cosine_recall
|
| 35 |
+
value:
|
| 36 |
name: Cosine Recall
|
| 37 |
- type: cosine_ap
|
| 38 |
+
value:
|
| 39 |
name: Cosine Ap
|
|
|
|
|
|
|
|
|
|
| 40 |
---
|
| 41 |
|
| 42 |
# SentenceTransformer based on Alibaba-NLP/gte-modernbert-base
|
| 43 |
|
| 44 |
+
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 Quora csv dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity for the purpose of semantic caching.
|
| 45 |
|
| 46 |
## Model Details
|
| 47 |
|
|
|
|
| 52 |
- **Output Dimensionality:** 768 dimensions
|
| 53 |
- **Similarity Function:** Cosine Similarity
|
| 54 |
- **Training Dataset:**
|
| 55 |
+
- Quora csv
|
| 56 |
<!-- - **Language:** Unknown -->
|
| 57 |
<!-- - **License:** Unknown -->
|
| 58 |
|
|
|
|
| 66 |
|
| 67 |
```
|
| 68 |
SentenceTransformer(
|
| 69 |
+
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: ModernBertModel
|
| 70 |
(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})
|
| 71 |
)
|
| 72 |
```
|
| 73 |
|
| 74 |
## Usage
|
| 75 |
|
|
|
|
|
|
|
| 76 |
First install the Sentence Transformers library:
|
| 77 |
|
| 78 |
```bash
|
|
|
|
| 84 |
from sentence_transformers import SentenceTransformer
|
| 85 |
|
| 86 |
# Download from the 🤗 Hub
|
| 87 |
+
model = SentenceTransformer("redis/langcache-embed-v1")
|
| 88 |
# Run inference
|
| 89 |
sentences = [
|
| 90 |
+
'Will the value of Indian rupee increase after the ban of 500 and 1000 rupee notes?',
|
| 91 |
+
'What will be the implications of banning 500 and 1000 rupees currency notes on Indian economy?',
|
| 92 |
+
"Are Danish Sait's prank calls fake?",
|
| 93 |
]
|
| 94 |
embeddings = model.encode(sentences)
|
| 95 |
print(embeddings.shape)
|
|
|
|
| 98 |
# Get the similarity scores for the embeddings
|
| 99 |
similarities = model.similarity(embeddings, embeddings)
|
| 100 |
print(similarities.shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
#### Binary Classification
|
|
|
|
| 105 |
|
|
|
|
|
|
|
| 106 |
|
| 107 |
+
| Metric | Value |
|
| 108 |
+
|:--------------------------|:----------|
|
| 109 |
+
| cosine_accuracy | |
|
| 110 |
+
| cosine_f1 | |
|
| 111 |
+
| cosine_precision | |
|
| 112 |
+
| cosine_recall | |
|
| 113 |
+
| **cosine_ap** | |
|
| 114 |
|
|
|
|
| 115 |
|
| 116 |
### Training Dataset
|
| 117 |
|
| 118 |
#### csv
|
| 119 |
|
| 120 |
* Dataset: csv
|
| 121 |
+
* Size: training samples
|
| 122 |
* Columns: <code>question_1</code>, <code>question_2</code>, and <code>label</code>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
### Evaluation Dataset
|
| 125 |
|
| 126 |
#### csv
|
| 127 |
|
| 128 |
* Dataset: csv
|
| 129 |
+
* Size: evaluation samples
|
| 130 |
+
* Columns: <code>question_1</code>, <code>question_2</code>, and <code>label</code>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
## Citation
|
| 133 |
|
|
|
|
| 135 |
|
| 136 |
#### Sentence Transformers
|
| 137 |
```bibtex
|
| 138 |
+
@inproceedings{redisetal.,
|
| 139 |
+
title = "",
|
| 140 |
+
author = "",
|
| 141 |
+
month = "",
|
| 142 |
+
year = "",
|
| 143 |
+
publisher = "",
|
| 144 |
+
url = "",
|
|
|
|
| 145 |
}
|
| 146 |
```
|
| 147 |
|
|
|
|
|
|
|
| 148 |
<!--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|