Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 384, '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})
(2): Normalize()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("sentence_transformers_model_id")
5# Run inference
6sentences = [
7 'A black dog is drinking next to a brown and white dog that is looking at an orange ball in the lake, whilst a horse and rider passes behind.',
8 'There are two people running around a track in lane three and the one wearing a blue shirt with a green thing over the eyes is just barely ahead of the guy wearing an orange shirt and sunglasses.',
9 'the guy is dead',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 768]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities.shape)
18# [3, 3]sts-dev and sts-testEmbeddingSimilarityEvaluator| Metric | sts-dev | sts-test |
|---|---|---|
| pearson_cosine | 0.8659 | 0.8309 |
| spearman_cosine | 0.8685 | 0.8339 |
MSEEvaluator| Metric | Value |
|---|---|
| negative_mse | -0.0158 |
sentence and label| sentence | label | |
|---|---|---|
| type | string | list |
| details |
|
|
| sentence | label |
|---|---|
A person on a horse jumps over a broken down airplane. | [-0.030610017478466034, 0.11742044985294342, 0.031586047261953354, 0.01859636977314949, 0.016319412738084793, ...] |
Children smiling and waving at camera | [-0.006198188289999962, -0.036625951528549194, -0.005352460313588381, -0.006725294981151819, 0.05185901001095772, ...] |
A boy is jumping on skateboard in the middle of a red bridge. | [-0.01783316768705845, -0.05204763263463974, -0.003716366598382592, 0.0009472182719036937, 0.05223219841718674, ...] |
MSELosssentence and label| sentence | label | |
|---|---|---|
| type | string | list |
| details |
|
|
| sentence | label |
|---|---|
Two women are embracing while holding to go packages. | [0.010130808688700199, 0.009573593735694885, -0.00034817546838894486, -0.0040625291876494884, 0.02026110142469406, ...] |
Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink. | [-0.033891696482896805, -0.04130887985229492, -0.006042165216058493, -0.02770376019179821, -0.0017171527724713087, ...] |
A man selling donuts to a customer during a world exhibition event held in the city of Angeles | [0.0013940087519586086, -0.044612932950258255, -0.023834265768527985, 0.11863800883293152, -0.03907289728522301, ...] |
MSELosseval_strategy: stepsper_device_train_batch_size: 64per_device_eval_batch_size: 64learning_rate: 0.0001num_train_epochs: 1warmup_ratio: 0.1fp16: Trueload_best_model_at_end: Trueoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 64per_device_eval_batch_size: 64per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 0.0001weight_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: 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: Trueignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}tp_size: 0fsdp_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: 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: proportional| Epoch | Step | Training Loss | Validation Loss | sts-dev_spearman_cosine | negative_mse | sts-test_spearman_cosine |
|---|---|---|---|---|---|---|
| -1 | -1 | - | - | 0.6786 | -0.2176 | - |
| 0.0071 | 1000 | 0.0016 | - | - | - | - |
| 0.0142 | 2000 | 0.001 | - | - | - | - |
| 0.0213 | 3000 | 0.0008 | - | - | - | - |
| 0.0284 | 4000 | 0.0007 | - | - | - | - |
| 0.0355 | 5000 | 0.0006 | 0.0006 | 0.8511 | -0.0561 | - |
| 0.0426 | 6000 | 0.0006 | - | - | - | - |
| 0.0497 | 7000 | 0.0005 | - | - | - | - |
| 0.0568 | 8000 | 0.0005 | - | - | - | - |
| 0.0639 | 9000 | 0.0005 | - | - | - | - |
| 0.0710 | 10000 | 0.0004 | 0.0004 | 0.8624 | -0.0361 | - |
| 0.0781 | 11000 | 0.0004 | - | - | - | - |
| 0.0852 | 12000 | 0.0004 | - | - | - | - |
| 0.0923 | 13000 | 0.0004 | - | - | - | - |
| 0.0994 | 14000 | 0.0004 | - | - | - | - |
| 0.1065 | 15000 | 0.0003 | 0.0003 | 0.8649 | -0.0288 | - |
| 0.1136 | 16000 | 0.0003 | - | - | - | - |
| 0.1207 | 17000 | 0.0003 | - | - | - | - |
| 0.1278 | 18000 | 0.0003 | - | - | - | - |
| 0.1349 | 19000 | 0.0003 | - | - | - | - |
| 0.1420 | 20000 | 0.0003 | 0.0003 | 0.8663 | -0.0252 | - |
| 0.1491 | 21000 | 0.0003 | - | - | - | - |
| 0.1562 | 22000 | 0.0003 | - | - | - | - |
| 0.1633 | 23000 | 0.0003 | - | - | - | - |
| 0.1704 | 24000 | 0.0003 | - | - | - | - |
| 0.1775 | 25000 | 0.0003 | 0.0002 | 0.8641 | -0.0232 | - |
| 0.1846 | 26000 | 0.0003 | - | - | - | - |
| 0.1917 | 27000 | 0.0003 | - | - | - | - |
| 0.1988 | 28000 | 0.0003 | - | - | - | - |
| 0.2059 | 29000 | 0.0003 | - | - | - | - |
| 0.2130 | 30000 | 0.0003 | 0.0002 | 0.8641 | -0.0219 | - |
| 0.2201 | 31000 | 0.0003 | - | - | - | - |
| 0.2272 | 32000 | 0.0003 | - | - | - | - |
| 0.2343 | 33000 | 0.0003 | - | - | - | - |
| 0.2414 | 34000 | 0.0003 | - | - | - | - |
| 0.2485 | 35000 | 0.0003 | 0.0002 | 0.8649 | -0.0209 | - |
| 0.2556 | 36000 | 0.0003 | - | - | - | - |
| 0.2627 | 37000 | 0.0003 | - | - | - | - |
| 0.2698 | 38000 | 0.0003 | - | - | - | - |
| 0.2769 | 39000 | 0.0003 | - | - | - | - |
| 0.2840 | 40000 | 0.0003 | 0.0002 | 0.8648 | -0.0202 | - |
| 0.2911 | 41000 | 0.0003 | - | - | - | - |
| 0.2982 | 42000 | 0.0002 | - | - | - | - |
| 0.3053 | 43000 | 0.0002 | - | - | - | - |
| 0.3124 | 44000 | 0.0002 | - | - | - | - |
| 0.3195 | 45000 | 0.0002 | 0.0002 | 0.8663 | -0.0196 | - |
| 0.3266 | 46000 | 0.0002 | - | - | - | - |
| 0.3337 | 47000 | 0.0002 | - | - | - | - |
| 0.3408 | 48000 | 0.0002 | - | - | - | - |
| 0.3479 | 49000 | 0.0002 | - | - | - | - |
| 0.3550 | 50000 | 0.0002 | 0.0002 | 0.8665 | -0.0192 | - |
| 0.3621 | 51000 | 0.0002 | - | - | - | - |
| 0.3692 | 52000 | 0.0002 | - | - | - | - |
| 0.3763 | 53000 | 0.0002 | - | - | - | - |
| 0.3834 | 54000 | 0.0002 | - | - | - | - |
| 0.3905 | 55000 | 0.0002 | 0.0002 | 0.8650 | -0.0187 | - |
| 0.3976 | 56000 | 0.0002 | - | - | - | - |
| 0.4047 | 57000 | 0.0002 | - | - | - | - |
| 0.4118 | 58000 | 0.0002 | - | - | - | - |
| 0.4189 | 59000 | 0.0002 | - | - | - | - |
| 0.4260 | 60000 | 0.0002 | 0.0002 | 0.8636 | -0.0184 | - |
| 0.4331 | 61000 | 0.0002 | - | - | - | - |
| 0.4402 | 62000 | 0.0002 | - | - | - | - |
| 0.4473 | 63000 | 0.0002 | - | - | - | - |
| 0.4544 | 64000 | 0.0002 | - | - | - | - |
| 0.4615 | 65000 | 0.0002 | 0.0002 | 0.8673 | -0.0180 | - |
| 0.4686 | 66000 | 0.0002 | - | - | - | - |
| 0.4757 | 67000 | 0.0002 | - | - | - | - |
| 0.4828 | 68000 | 0.0002 | - | - | - | - |
| 0.4899 | 69000 | 0.0002 | - | - | - | - |
| 0.4970 | 70000 | 0.0002 | 0.0002 | 0.8692 | -0.0178 | - |
| 0.5041 | 71000 | 0.0002 | - | - | - | - |
| 0.5112 | 72000 | 0.0002 | - | - | - | - |
| 0.5183 | 73000 | 0.0002 | - | - | - | - |
| 0.5254 | 74000 | 0.0002 | - | - | - | - |
| 0.5325 | 75000 | 0.0002 | 0.0002 | 0.8675 | -0.0175 | - |
| 0.5396 | 76000 | 0.0002 | - | - | - | - |
| 0.5467 | 77000 | 0.0002 | - | - | - | - |
| 0.5538 | 78000 | 0.0002 | - | - | - | - |
| 0.5609 | 79000 | 0.0002 | - | - | - | - |
| 0.5680 | 80000 | 0.0002 | 0.0002 | 0.8657 | -0.0173 | - |
| 0.5751 | 81000 | 0.0002 | - | - | - | - |
| 0.5822 | 82000 | 0.0002 | - | - | - | - |
| 0.5893 | 83000 | 0.0002 | - | - | - | - |
| 0.5964 | 84000 | 0.0002 | - | - | - | - |
| 0.6035 | 85000 | 0.0002 | 0.0002 | 0.8670 | -0.0171 | - |
| 0.6106 | 86000 | 0.0002 | - | - | - | - |
| 0.6177 | 87000 | 0.0002 | - | - | - | - |
| 0.6248 | 88000 | 0.0002 | - | - | - | - |
| 0.6319 | 89000 | 0.0002 | - | - | - | - |
| 0.6390 | 90000 | 0.0002 | 0.0002 | 0.8665 | -0.0169 | - |
| 0.6461 | 91000 | 0.0002 | - | - | - | - |
| 0.6532 | 92000 | 0.0002 | - | - | - | - |
| 0.6603 | 93000 | 0.0002 | - | - | - | - |
| 0.6674 | 94000 | 0.0002 | - | - | - | - |
| 0.6745 | 95000 | 0.0002 | 0.0002 | 0.8672 | -0.0167 | - |
| 0.6816 | 96000 | 0.0002 | - | - | - | - |
| 0.6887 | 97000 | 0.0002 | - | - | - | - |
| 0.6958 | 98000 | 0.0002 | - | - | - | - |
| 0.7029 | 99000 | 0.0002 | - | - | - | - |
| 0.7100 | 100000 | 0.0002 | 0.0002 | 0.8657 | -0.0165 | - |
| 0.7171 | 101000 | 0.0002 | - | - | - | - |
| 0.7242 | 102000 | 0.0002 | - | - | - | - |
| 0.7313 | 103000 | 0.0002 | - | - | - | - |
| 0.7384 | 104000 | 0.0002 | - | - | - | - |
| 0.7455 | 105000 | 0.0002 | 0.0002 | 0.8676 | -0.0165 | - |
| 0.7526 | 106000 | 0.0002 | - | - | - | - |
| 0.7597 | 107000 | 0.0002 | - | - | - | - |
| 0.7668 | 108000 | 0.0002 | - | - | - | - |
| 0.7739 | 109000 | 0.0002 | - | - | - | - |
| 0.7810 | 110000 | 0.0002 | 0.0002 | 0.8672 | -0.0164 | - |
| 0.7881 | 111000 | 0.0002 | - | - | - | - |
| 0.7952 | 112000 | 0.0002 | - | - | - | - |
| 0.8023 | 113000 | 0.0002 | - | - | - | - |
| 0.8094 | 114000 | 0.0002 | - | - | - | - |
| 0.8165 | 115000 | 0.0002 | 0.0002 | 0.8698 | -0.0162 | - |
| 0.8236 | 116000 | 0.0002 | - | - | - | - |
| 0.8307 | 117000 | 0.0002 | - | - | - | - |
| 0.8378 | 118000 | 0.0002 | - | - | - | - |
| 0.8449 | 119000 | 0.0002 | - | - | - | - |
| 0.8520 | 120000 | 0.0002 | 0.0002 | 0.8685 | -0.0161 | - |
| 0.8591 | 121000 | 0.0002 | - | - | - | - |
| 0.8662 | 122000 | 0.0002 | - | - | - | - |
| 0.8733 | 123000 | 0.0002 | - | - | - | - |
| 0.8804 | 124000 | 0.0002 | - | - | - | - |
| 0.8875 | 125000 | 0.0002 | 0.0002 | 0.8676 | -0.0160 | - |
| 0.8946 | 126000 | 0.0002 | - | - | - | - |
| 0.9017 | 127000 | 0.0002 | - | - | - | - |
| 0.9088 | 128000 | 0.0002 | - | - | - | - |
| 0.9159 | 129000 | 0.0002 | - | - | - | - |
| 0.9230 | 130000 | 0.0002 | 0.0002 | 0.8682 | -0.0159 | - |
| 0.9301 | 131000 | 0.0002 | - | - | - | - |
| 0.9372 | 132000 | 0.0002 | - | - | - | - |
| 0.9443 | 133000 | 0.0002 | - | - | - | - |
| 0.9514 | 134000 | 0.0002 | - | - | - | - |
| 0.9585 | 135000 | 0.0002 | 0.0002 | 0.8678 | -0.0158 | - |
| 0.9656 | 136000 | 0.0002 | - | - | - | - |
| 0.9727 | 137000 | 0.0002 | - | - | - | - |
| 0.9798 | 138000 | 0.0002 | - | - | - | - |
| 0.9869 | 139000 | 0.0002 | - | - | - | - |
| 0.9940 | 140000 | 0.0002 | 0.0002 | 0.8685 | -0.0158 | - |
| -1 | -1 | - | - | - | - | 0.8339 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@inproceedings{reimers-2020-multilingual-sentence-bert,
2 title = "Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2020",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/2004.09813",
9}