Downloads · 30 days
61
14% of all-time downloads
tomaarsen/distilroberta-base-paraphrases-multi
distilroberta-base-paraphrases-multi is a sentence similarity model from tomaarsen. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model finetuned from distilbert/distilroberta-base on the all-nli, sentence-compression, simple-wiki, altlex, quora-duplicates, coco-captions, flickr30k-captions, yahoo-answers and stac…
Downloads · 30 days
61
14% of all-time downloads
All-time downloads
451
Public
Parameters
82.1M
328 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors328 MB · 99%
From the Hugging Face model README
This is a sentence-transformers model finetuned from distilbert/distilroberta-base on the all-nli, sentence-compression, simple-wiki, altlex, quora-duplicates, coco-captions, flickr30k-captions, yahoo-answers and stack-exchange datasets. 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': 128, 'do_lower_case': False}) with Transformer model: RobertaModel
(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("tomaarsen/distilroberta-base-paraphrases-multi")
# Run inference
sentences = [
'guy on a bike',
'Man riding a bike',
'A man cooks on a grill.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings)
print(similarities.shape)
# [3, 3]
<!--
### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>
-->
<!--
### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
sts-dev| Metric | Value |
|---|---|
| pearson_cosine | 0.8415 |
| spearman_cosine | 0.8452 |
| pearson_manhattan | 0.8502 |
| spearman_manhattan | 0.8517 |
| pearson_euclidean | 0.8535 |
| spearman_euclidean | 0.8555 |
| pearson_dot | 0.6505 |
| spearman_dot | 0.649 |
| pearson_max | 0.8535 |
| spearman_max | 0.8555 |
sts-test| Metric | Value |
|---|---|
| pearson_cosine | 0.8106 |
| spearman_cosine | 0.8145 |
| pearson_manhattan | 0.8225 |
| spearman_manhattan | 0.8131 |
| pearson_euclidean | 0.8255 |
| spearman_euclidean | 0.8165 |
| pearson_dot | 0.5911 |
| spearman_dot | 0.5761 |
| pearson_max | 0.8255 |
| spearman_max | 0.8165 |
| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 7 tokens</li><li>mean: 10.38 tokens</li><li>max: 45 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 12.8 tokens</li><li>max: 39 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 13.4 tokens</li><li>max: 50 tokens</li></ul> |
| anchor | positive | negative |
|---|---|---|
| <code>A person on a horse jumps over a broken down airplane.</code> | <code>A person is outdoors, on a horse.</code> | <code>A person is at a diner, ordering an omelette.</code> |
| <code>Children smiling and waving at camera</code> | <code>There are children present</code> | <code>The kids are frowning</code> |
| <code>A boy is jumping on skateboard in the middle of a red bridge.</code> | <code>The boy does a skateboarding trick.</code> | <code>The boy skates down the sidewalk.</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| text | simplified | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 10 tokens</li><li>mean: 33.13 tokens</li><li>max: 126 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 11.13 tokens</li><li>max: 29 tokens</li></ul> |
| text | simplified |
|---|---|
| <code>The USHL completed an expansion draft on Monday as 10 players who were on the rosters of USHL teams during the 2009-10 season were selected by the League's two newest entries, the Muskegon Lumberjacks and Dubuque Fighting Saints.</code> | <code>USHL completes expansion draft</code> |
| <code>Major League Baseball Commissioner Bud Selig will be speaking at St. Norbert College next month.</code> | <code>Bud Selig to speak at St. Norbert College</code> |
| <code>It's fresh cherry time in Michigan and the best time to enjoy this delicious and nutritious fruit.</code> | <code>It's cherry time</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| text | simplified | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 9 tokens</li><li>mean: 35.19 tokens</li><li>max: 128 tokens</li></ul> | <ul><li>min: 8 tokens</li><li>mean: 29.1 tokens</li><li>max: 128 tokens</li></ul> |
| text | simplified |
|---|---|
| <code>The greatest example has been in his present job ( then , Minister for Foreign Affairs ) , where he has perforce concentrated on Anglo-Irish relations and , in particular the North ( i.e. , Northern Ireland ) .</code> | <code>The greatest example has been in his present job ( then , Minister for Foreign Affairs ) , where he has perforce concentrated on Anglo-Irish relations and , in particular Northern Ireland ( .</code> |
| <code>His reputation rose further when opposition leaders under parliamentary privilege alleged that Taoiseach Charles Haughey , who in January 1982 had been Leader of the Opposition , had not merely rung the President 's Office but threatened to end the career of the army officer who took the call and who , on Hillery 's explicit instructions , had refused to put through the call to the President .</code> | <code>President Hillery refused to speak to any opposition party politicians , but when Charles Haughey , who was Leader of the Opposition , had rang the President 's Office he threatened to end the career of the army officer answered and refused on Hillery 's explicit orders to put the call through to the President .</code> |
| <code>He considered returning to medicine , perhaps moving with his wife , Maeve ( also a doctor ) to Africa .</code> | <code>He thought about returning to medicine , perhaps moving with his wife , Maeve ( also a doctor ) to Africa .</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| text | simplified | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 9 tokens</li><li>mean: 31.8 tokens</li><li>max: 121 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 26.49 tokens</li><li>max: 114 tokens</li></ul> |
| text | simplified |
|---|---|
| <code>A set of 31 guns , cast 1729-1749 by the first master founder at the Royal Foundry , later the Royal Arsenal , Woolwich , were used to fire salutes until 1907 , often for Queen Victoria , who was a frequent visitor .</code> | <code>A set of 31 guns , cast 1729-1749 by the first master founder at the Royal Foundry , later the Royal Arsenal , Woolwich , were used to fire salutes until 1907 , often for Queen Victoria who was a frequent visitor .</code> |
| <code>In 1929 , the building became vacant , and was given to Prince Edward , Prince of Wales , by his father , King George V . This became the Prince 's chief residence and was used extensively by him for entertaining and as a country retreat .</code> | <code>In 1929 , the building became vacant , and was given to Prince Edward , the Prince of Wales by his father , King George V . This became the Prince 's chief residence , and was used extensively by the Prince for entertaining and as a country retreat .</code> |
| <code>Additions included an octagon room in the north-east side , in which the King regularly had dinner .</code> | <code>Additions included an octagon room in the North-East side , where the King regularly had dinner .</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 6 tokens</li><li>mean: 13.72 tokens</li><li>max: 42 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 13.5 tokens</li><li>max: 44 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 14.56 tokens</li><li>max: 62 tokens</li></ul> |
| anchor | positive | negative |
|---|---|---|
| <code>Why in India do we not have one on one political debate as in USA?</code> | <code>Why cant we have a public debate between politicians in India like the one in US?</code> | <code>Can people on Quora stop India Pakistan debate? We are sick and tired seeing this everyday in bulk?</code> |
| <code>What is OnePlus One?</code> | <code>How is oneplus one?</code> | <code>Why is OnePlus One so good?</code> |
| <code>Does our mind control our emotions?</code> | <code>How do smart and successful people control their emotions?</code> | <code>How can I control my positive emotions for the people whom I love but they don't care about me?</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| caption1 | caption2 | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 10 tokens</li><li>mean: 13.65 tokens</li><li>max: 25 tokens</li></ul> | <ul><li>min: 10 tokens</li><li>mean: 13.65 tokens</li><li>max: 25 tokens</li></ul> |
| caption1 | caption2 |
|---|---|
| <code>A clock that blends in with the wall hangs in a bathroom. </code> | <code>A very clean and well decorated empty bathroom</code> |
| <code>A very clean and well decorated empty bathroom</code> | <code>A bathroom with a border of butterflies and blue paint on the walls above it.</code> |
| <code>A bathroom with a border of butterflies and blue paint on the walls above it.</code> | <code>An angled view of a beautifully decorated bathroom.</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| caption1 | caption2 | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 6 tokens</li><li>mean: 16.22 tokens</li><li>max: 60 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 16.22 tokens</li><li>max: 60 tokens</li></ul> |
| caption1 | caption2 |
|---|---|
| <code>Two men in green shirts are standing in a yard.</code> | <code>Two young, White males are outside near many bushes.</code> |
| <code>Two young, White males are outside near many bushes.</code> | <code>Two young guys with shaggy hair look at their hands while hanging out in the yard.</code> |
| <code>Two young guys with shaggy hair look at their hands while hanging out in the yard.</code> | <code>A man in a blue shirt standing in a garden.</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| question | answer | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 12 tokens</li><li>mean: 52.48 tokens</li><li>max: 128 tokens</li></ul> | <ul><li>min: 13 tokens</li><li>mean: 83.5 tokens</li><li>max: 128 tokens</li></ul> |
| question | answer |
|---|---|
| <code>why doesn't an optical mouse work on a glass table? or even on some surfaces?</code> | <code>why doesn't an optical mouse work on a glass table? Optical mice use an LED and a camera to rapidly capture images of the surface beneath the mouse. The infomation from the camera is analyzed by a DSP (Digital Signal Processor) and used to detect imperfections in the underlying surface and determine motion. Some materials, such as glass, mirrors or other very shiny, uniform surfaces interfere with the ability of the DSP to accurately analyze the surface beneath the mouse. \nSince glass is transparent and very uniform, the mouse is unable to pick up enough imperfections in the underlying surface to determine motion. Mirrored surfaces are also a problem, since they constantly reflect back the same image, causing the DSP not to recognize motion properly. When the system is unable to see surface changes associated with movement, the mouse will not work properly.</code> |
| <code>What is the best off-road motorcycle trail ? long-distance trail throughout CA</code> | <code>What is the best off-road motorcycle trail ? i hear that the mojave road is amazing!<br />\nsearch for it online.</code> |
| <code>What is Trans Fat? How to reduce that? I heard that tras fat is bad for the body. Why is that? Where can we find it in our daily food?</code> | <code>What is Trans Fat? How to reduce that? Trans fats occur in manufactured foods during the process of partial hydrogenation, when hydrogen gas is bubbled through vegetable oil to increase shelf life and stabilize the original polyunsatured oil. The resulting fat is similar to saturated fat, which raises "bad" LDL cholesterol and can lead to clogged arteries and heart disease. \nUntil very recently, food labels were not required to list trans fats, and this health risk remained hidden to consumers. In early July, FDA regulations changed, and food labels will soon begin identifying trans fat content in processed foods.</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
| title1 | title2 | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 5 tokens</li><li>mean: 15.04 tokens</li><li>max: 63 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 15.91 tokens</li><li>max: 80 tokens</li></ul> |
| title1 | title2 |
|---|---|
| <code>what is the advantage of using the GPU rendering options in Android?</code> | <code>Can anyone explain all these Developer Options?</code> |
| <code>Blank video when converting uncompressed AVI files with ffmpeg</code> | <code>FFmpeg lossy compression problems</code> |
| <code>URL Rewriting of a query string in php</code> | <code>How to create friendly URL in php?</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 128per_device_eval_batch_size: 128num_train_epochs: 1warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Falseper_device_train_batch_size: 128per_device_eval_batch_size: 128per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: 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: Nonedataloader_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: Falsehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseeval_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_sampler: no_duplicatesmulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss | sts-dev_spearman_cosine | sts-test_spearman_cosine |
|---|---|---|---|---|
| 0.0140 | 100 | 3.739 | - | - |
| 0.0279 | 200 | 1.1317 | - | - |
| 0.0419 | 300 | 0.9645 | - | - |
| 0.0558 | 400 | 0.9053 | - | - |
| 0.0698 | 500 | 0.8889 | - | - |
| 0.0838 | 600 | 0.8741 | - | - |
| 0.0977 | 700 | 0.8329 | - | - |
| 0.1117 | 800 | 0.8331 | - | - |
| 0.1256 | 900 | 0.8241 | - | - |
| 0.1396 | 1000 | 0.7829 | 0.8460 | - |
| 0.1535 | 1100 | 0.7871 | - | - |
| 0.1675 | 1200 | 0.7521 | - | - |
| 0.1815 | 1300 | 0.7905 | - | - |
| 0.1954 | 1400 | 0.7531 | - | - |
| 0.2094 | 1500 | 0.7677 | - | - |
| 0.2233 | 1600 | 0.7745 | - | - |
| 0.2373 | 1700 | 0.7651 | - | - |
| 0.2513 | 1800 | 0.7712 | - | - |
| 0.2652 | 1900 | 0.7476 | - | - |
| 0.2792 | 2000 | 0.7814 | 0.8370 | - |
| 0.2931 | 2100 | 0.7536 | - | - |
| 0.3071 | 2200 | 0.7689 | - | - |
| 0.3210 | 2300 | 0.7656 | - | - |
| 0.3350 | 2400 | 0.7672 | - | - |
| 0.3490 | 2500 | 0.6921 | - | - |
| 0.3629 | 2600 | 0.6778 | - | - |
| 0.3769 | 2700 | 0.6844 | - | - |
| 0.3908 | 2800 | 0.6907 | - | - |
| 0.4048 | 2900 | 0.6881 | - | - |
| 0.4188 | 3000 | 0.6815 | 0.8372 | - |
| 0.4327 | 3100 | 0.6869 | - | - |
| 0.4467 | 3200 | 0.698 | - | - |
| 0.4606 | 3300 | 0.6868 | - | - |
| 0.4746 | 3400 | 0.7174 | - | - |
| 0.4886 | 3500 | 0.6714 | - | - |
| 0.5025 | 3600 | 0.6698 | - | - |
| 0.5165 | 3700 | 0.6838 | - | - |
| 0.5304 | 3800 | 0.6927 | - | - |
| 0.5444 | 3900 | 0.6628 | - | - |
| 0.5583 | 4000 | 0.6647 | 0.8367 | - |
| 0.5723 | 4100 | 0.6766 | - | - |
| 0.5863 | 4200 | 0.6987 | - | - |
| 0.6002 | 4300 | 0.6895 | - | - |
| 0.6142 | 4400 | 0.6571 | - | - |
| 0.6281 | 4500 | 0.66 | - | - |
| 0.6421 | 4600 | 0.6747 | - | - |
| 0.6561 | 4700 | 0.6495 | - | - |
| 0.6700 | 4800 | 0.6746 | - | - |
| 0.6840 | 4900 | 0.6575 | - | - |
| 0.6979 | 5000 | 0.6712 | 0.8454 | - |
| 0.7119 | 5100 | 0.6627 | - | - |
| 0.7259 | 5200 | 0.6538 | - | - |
| 0.7398 | 5300 | 0.6659 | - | - |
| 0.7538 | 5400 | 0.6551 | - | - |
| 0.7677 | 5500 | 0.6548 | - | - |
| 0.7817 | 5600 | 0.673 | - | - |
| 0.7956 | 5700 | 0.6805 | - | - |
| 0.8096 | 5800 | 0.6537 | - | - |
| 0.8236 | 5900 | 0.6826 | - | - |
| 0.8375 | 6000 | 0.7182 | 0.8370 | - |
| 0.8515 | 6100 | 0.7391 | - | - |
| 0.8654 | 6200 | 0.7006 | - | - |
| 0.8794 | 6300 | 0.6774 | - | - |
| 0.8934 | 6400 | 0.7076 | - | - |
| 0.9073 | 6500 | 0.6893 | - | - |
| 0.9213 | 6600 | 0.678 | - | - |
| 0.9352 | 6700 | 0.6703 | - | - |
| 0.9492 | 6800 | 0.675 | - | - |
| 0.9631 | 6900 | 0.6842 | - | - |
| 0.9771 | 7000 | 0.6909 | 0.8452 | - |
| 0.9911 | 7100 | 0.681 | - | - |
| 1.0 | 7164 | - | - | 0.8145 |
Carbon emissions were measured using CodeCarbon.
@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}
}
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->