Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper
•
1908.10084
•
Published
•
12
This is a sentence-transformers model finetuned from TechWolf/ConTeXT-Skill-Extraction-base. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: MPNetModel
(1): Pooling({'word_embedding_dimension': 768, '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})
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
'Skilled in mixing construction grouts while adhering to strict contamination control measures.',
'mix construction grouts',
'oversee logistics of finished products',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
sentence_0, sentence_1, and label| sentence_0 | sentence_1 | label | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| sentence_0 | sentence_1 | label |
|---|---|---|
Successfully provided stabilisation care in emergency situations, contributing to positive patient outcomes. |
provide stabilisation care in emergency |
1.0 |
This training program covers advanced methods to remove coating from delicate components. |
remove coating |
1.0 |
Utilized statistical modelling to analyse booking patterns and forecast future demand. |
analyse booking patterns |
1.0 |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
per_device_train_batch_size: 16per_device_eval_batch_size: 16fp16: Truemulti_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 3max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters: auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Nonedispatch_batches: Nonesplit_batches: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss |
|---|---|---|
| 0.0112 | 500 | 0.276 |
| 0.0224 | 1000 | 0.2541 |
| 0.0336 | 1500 | 0.2507 |
| 0.0448 | 2000 | 0.2276 |
| 0.0560 | 2500 | 0.2356 |
| 0.0673 | 3000 | 0.2153 |
| 0.0785 | 3500 | 0.2166 |
| 0.0897 | 4000 | 0.2108 |
| 0.1009 | 4500 | 0.2011 |
| 0.1121 | 5000 | 0.2098 |
| 0.1233 | 5500 | 0.2018 |
| 0.1345 | 6000 | 0.1879 |
| 0.1457 | 6500 | 0.1954 |
| 0.1569 | 7000 | 0.1927 |
| 0.1681 | 7500 | 0.1983 |
| 0.1794 | 8000 | 0.1833 |
| 0.1906 | 8500 | 0.1893 |
| 0.2018 | 9000 | 0.1992 |
| 0.2130 | 9500 | 0.1838 |
| 0.2242 | 10000 | 0.1713 |
| 0.2354 | 10500 | 0.1839 |
| 0.2466 | 11000 | 0.1727 |
| 0.2578 | 11500 | 0.1777 |
| 0.2690 | 12000 | 0.1691 |
| 0.2802 | 12500 | 0.1777 |
| 0.2915 | 13000 | 0.1627 |
| 0.3027 | 13500 | 0.1647 |
| 0.3139 | 14000 | 0.1627 |
| 0.3251 | 14500 | 0.1546 |
| 0.3363 | 15000 | 0.1689 |
| 0.3475 | 15500 | 0.1462 |
| 0.3587 | 16000 | 0.1492 |
| 0.3699 | 16500 | 0.158 |
| 0.3811 | 17000 | 0.1537 |
| 0.3923 | 17500 | 0.1597 |
| 0.4036 | 18000 | 0.1567 |
| 0.4148 | 18500 | 0.1607 |
| 0.4260 | 19000 | 0.1629 |
| 0.4372 | 19500 | 0.1418 |
| 0.4484 | 20000 | 0.1606 |
| 0.4596 | 20500 | 0.1537 |
| 0.4708 | 21000 | 0.1463 |
| 0.4820 | 21500 | 0.1372 |
| 0.4932 | 22000 | 0.1466 |
| 0.5044 | 22500 | 0.1349 |
| 0.5156 | 23000 | 0.1586 |
| 0.5269 | 23500 | 0.1365 |
| 0.5381 | 24000 | 0.1321 |
| 0.5493 | 24500 | 0.1549 |
| 0.5605 | 25000 | 0.1399 |
| 0.5717 | 25500 | 0.1283 |
| 0.5829 | 26000 | 0.1423 |
| 0.5941 | 26500 | 0.1355 |
| 0.6053 | 27000 | 0.1443 |
| 0.6165 | 27500 | 0.1417 |
| 0.6277 | 28000 | 0.1452 |
| 0.6390 | 28500 | 0.1395 |
| 0.6502 | 29000 | 0.1422 |
| 0.6614 | 29500 | 0.1262 |
| 0.6726 | 30000 | 0.1289 |
| 0.6838 | 30500 | 0.1363 |
| 0.6950 | 31000 | 0.1372 |
| 0.7062 | 31500 | 0.1272 |
| 0.7174 | 32000 | 0.1309 |
| 0.7286 | 32500 | 0.1291 |
| 0.7398 | 33000 | 0.1297 |
| 0.7511 | 33500 | 0.1226 |
| 0.7623 | 34000 | 0.1311 |
| 0.7735 | 34500 | 0.1201 |
| 0.7847 | 35000 | 0.1363 |
| 0.7959 | 35500 | 0.1306 |
| 0.8071 | 36000 | 0.1223 |
| 0.8183 | 36500 | 0.1173 |
| 0.8295 | 37000 | 0.1242 |
| 0.8407 | 37500 | 0.125 |
| 0.8519 | 38000 | 0.1384 |
| 0.8632 | 38500 | 0.1196 |
| 0.8744 | 39000 | 0.1251 |
| 0.8856 | 39500 | 0.1201 |
| 0.8968 | 40000 | 0.1199 |
| 0.9080 | 40500 | 0.1298 |
| 0.9192 | 41000 | 0.1223 |
| 0.9304 | 41500 | 0.1335 |
| 0.9416 | 42000 | 0.1194 |
| 0.9528 | 42500 | 0.1124 |
| 0.9640 | 43000 | 0.1127 |
| 0.9752 | 43500 | 0.1126 |
| 0.9865 | 44000 | 0.1242 |
| 0.9977 | 44500 | 0.1241 |
| 1.0089 | 45000 | 0.1061 |
| 1.0201 | 45500 | 0.084 |
| 1.0313 | 46000 | 0.1004 |
| 1.0425 | 46500 | 0.0898 |
| 1.0537 | 47000 | 0.0921 |
| 1.0649 | 47500 | 0.097 |
| 1.0761 | 48000 | 0.0877 |
| 1.0873 | 48500 | 0.098 |
| 1.0986 | 49000 | 0.1078 |
| 1.1098 | 49500 | 0.0947 |
| 1.1210 | 50000 | 0.1051 |
| 1.1322 | 50500 | 0.0981 |
| 1.1434 | 51000 | 0.0965 |
| 1.1546 | 51500 | 0.0893 |
| 1.1658 | 52000 | 0.0969 |
| 1.1770 | 52500 | 0.097 |
| 1.1882 | 53000 | 0.1023 |
| 1.1994 | 53500 | 0.1036 |
| 1.2107 | 54000 | 0.0903 |
| 1.2219 | 54500 | 0.1 |
| 1.2331 | 55000 | 0.0949 |
| 1.2443 | 55500 | 0.0893 |
| 1.2555 | 56000 | 0.0966 |
| 1.2667 | 56500 | 0.094 |
| 1.2779 | 57000 | 0.0955 |
| 1.2891 | 57500 | 0.0917 |
| 1.3003 | 58000 | 0.084 |
| 1.3115 | 58500 | 0.0859 |
| 1.3228 | 59000 | 0.0888 |
| 1.3340 | 59500 | 0.0847 |
| 1.3452 | 60000 | 0.0846 |
| 1.3564 | 60500 | 0.0868 |
| 1.3676 | 61000 | 0.0904 |
| 1.3788 | 61500 | 0.0848 |
| 1.3900 | 62000 | 0.0929 |
| 1.4012 | 62500 | 0.0851 |
| 1.4124 | 63000 | 0.0989 |
| 1.4236 | 63500 | 0.0814 |
| 1.4348 | 64000 | 0.0881 |
| 1.4461 | 64500 | 0.0909 |
| 1.4573 | 65000 | 0.0951 |
| 1.4685 | 65500 | 0.0856 |
| 1.4797 | 66000 | 0.0914 |
| 1.4909 | 66500 | 0.0932 |
| 1.5021 | 67000 | 0.0855 |
| 1.5133 | 67500 | 0.09 |
| 1.5245 | 68000 | 0.0801 |
| 1.5357 | 68500 | 0.087 |
| 1.5469 | 69000 | 0.0866 |
| 1.5582 | 69500 | 0.0867 |
| 1.5694 | 70000 | 0.0959 |
| 1.5806 | 70500 | 0.0922 |
| 1.5918 | 71000 | 0.0898 |
| 1.6030 | 71500 | 0.0823 |
| 1.6142 | 72000 | 0.088 |
| 1.6254 | 72500 | 0.0832 |
| 1.6366 | 73000 | 0.0985 |
| 1.6478 | 73500 | 0.0944 |
| 1.6590 | 74000 | 0.0931 |
| 1.6703 | 74500 | 0.0808 |
| 1.6815 | 75000 | 0.0877 |
| 1.6927 | 75500 | 0.0746 |
| 1.7039 | 76000 | 0.0842 |
| 1.7151 | 76500 | 0.088 |
| 1.7263 | 77000 | 0.0792 |
| 1.7375 | 77500 | 0.0718 |
| 1.7487 | 78000 | 0.0941 |
| 1.7599 | 78500 | 0.0843 |
| 1.7711 | 79000 | 0.0835 |
| 1.7824 | 79500 | 0.0878 |
| 1.7936 | 80000 | 0.0771 |
| 1.8048 | 80500 | 0.0829 |
| 1.8160 | 81000 | 0.086 |
| 1.8272 | 81500 | 0.0802 |
| 1.8384 | 82000 | 0.0901 |
| 1.8496 | 82500 | 0.0859 |
| 1.8608 | 83000 | 0.0871 |
| 1.8720 | 83500 | 0.0787 |
| 1.8832 | 84000 | 0.0894 |
| 1.8944 | 84500 | 0.0895 |
| 1.9057 | 85000 | 0.0912 |
| 1.9169 | 85500 | 0.0795 |
| 1.9281 | 86000 | 0.0775 |
| 1.9393 | 86500 | 0.0693 |
| 1.9505 | 87000 | 0.0811 |
| 1.9617 | 87500 | 0.076 |
| 1.9729 | 88000 | 0.085 |
| 1.9841 | 88500 | 0.0904 |
| 1.9953 | 89000 | 0.087 |
| 2.0065 | 89500 | 0.061 |
| 2.0178 | 90000 | 0.0628 |
| 2.0290 | 90500 | 0.0721 |
| 2.0402 | 91000 | 0.0694 |
| 2.0514 | 91500 | 0.0618 |
| 2.0626 | 92000 | 0.0598 |
| 2.0738 | 92500 | 0.0701 |
| 2.0850 | 93000 | 0.0724 |
| 2.0962 | 93500 | 0.0623 |
| 2.1074 | 94000 | 0.0647 |
| 2.1186 | 94500 | 0.0643 |
| 2.1299 | 95000 | 0.066 |
| 2.1411 | 95500 | 0.0653 |
| 2.1523 | 96000 | 0.0648 |
| 2.1635 | 96500 | 0.0616 |
| 2.1747 | 97000 | 0.0661 |
| 2.1859 | 97500 | 0.0678 |
| 2.1971 | 98000 | 0.0621 |
| 2.2083 | 98500 | 0.0699 |
| 2.2195 | 99000 | 0.0631 |
| 2.2307 | 99500 | 0.0701 |
| 2.2420 | 100000 | 0.0663 |
| 2.2532 | 100500 | 0.0559 |
| 2.2644 | 101000 | 0.0667 |
| 2.2756 | 101500 | 0.0695 |
| 2.2868 | 102000 | 0.0655 |
| 2.2980 | 102500 | 0.0668 |
| 2.3092 | 103000 | 0.0661 |
| 2.3204 | 103500 | 0.0638 |
| 2.3316 | 104000 | 0.0686 |
| 2.3428 | 104500 | 0.0628 |
| 2.3540 | 105000 | 0.0649 |
| 2.3653 | 105500 | 0.0603 |
| 2.3765 | 106000 | 0.064 |
| 2.3877 | 106500 | 0.0651 |
| 2.3989 | 107000 | 0.0589 |
| 2.4101 | 107500 | 0.0621 |
| 2.4213 | 108000 | 0.061 |
| 2.4325 | 108500 | 0.068 |
| 2.4437 | 109000 | 0.0545 |
| 2.4549 | 109500 | 0.0691 |
| 2.4661 | 110000 | 0.0614 |
| 2.4774 | 110500 | 0.0661 |
| 2.4886 | 111000 | 0.0701 |
| 2.4998 | 111500 | 0.0549 |
| 2.5110 | 112000 | 0.0676 |
| 2.5222 | 112500 | 0.0599 |
| 2.5334 | 113000 | 0.0605 |
| 2.5446 | 113500 | 0.0671 |
| 2.5558 | 114000 | 0.0681 |
| 2.5670 | 114500 | 0.063 |
| 2.5782 | 115000 | 0.0586 |
| 2.5895 | 115500 | 0.0629 |
| 2.6007 | 116000 | 0.0586 |
| 2.6119 | 116500 | 0.0668 |
| 2.6231 | 117000 | 0.0606 |
| 2.6343 | 117500 | 0.0521 |
| 2.6455 | 118000 | 0.0619 |
| 2.6567 | 118500 | 0.065 |
| 2.6679 | 119000 | 0.052 |
| 2.6791 | 119500 | 0.0628 |
| 2.6903 | 120000 | 0.0642 |
| 2.7016 | 120500 | 0.0614 |
| 2.7128 | 121000 | 0.0663 |
| 2.7240 | 121500 | 0.0569 |
| 2.7352 | 122000 | 0.0648 |
| 2.7464 | 122500 | 0.0616 |
| 2.7576 | 123000 | 0.0536 |
| 2.7688 | 123500 | 0.0669 |
| 2.7800 | 124000 | 0.0612 |
| 2.7912 | 124500 | 0.0555 |
| 2.8024 | 125000 | 0.059 |
| 2.8136 | 125500 | 0.0549 |
| 2.8249 | 126000 | 0.0563 |
| 2.8361 | 126500 | 0.0616 |
| 2.8473 | 127000 | 0.06 |
| 2.8585 | 127500 | 0.0606 |
| 2.8697 | 128000 | 0.063 |
| 2.8809 | 128500 | 0.0572 |
| 2.8921 | 129000 | 0.0697 |
| 2.9033 | 129500 | 0.0561 |
| 2.9145 | 130000 | 0.065 |
| 2.9257 | 130500 | 0.0525 |
| 2.9370 | 131000 | 0.0597 |
| 2.9482 | 131500 | 0.0604 |
| 2.9594 | 132000 | 0.0534 |
| 2.9706 | 132500 | 0.0553 |
| 2.9818 | 133000 | 0.0593 |
| 2.9930 | 133500 | 0.0554 |
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
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},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Base model
sentence-transformers/all-mpnet-base-v2