SentenceTransformer(
(0): Transformer({'max_seq_length': 384, 'do_lower_case': False, 'architecture': '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("zoharzaig/emoji-prediction-model")
5# Run inference
6sentences = [
7 'Inspired by the history behind Norfolk Island’s flag.',
8 "The flag of Norfolk Island emoji represents the unique flag of Norfolk Island, which is an external territory of Australia. It is used to symbolize the island's culture and identity.",
9 'The gear emoji is commonly used to represent machinery, equipment, tools, or mechanics. It can also symbolize maintenance, repair, or work involving gears and mechanical parts.',
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)
18# tensor([[ 1.0000, 0.7065, -0.0235],
19# [ 0.7065, 1.0000, -0.0110],
20# [-0.0235, -0.0110, 1.0000]])sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
Lunch is scheduled for eleven today | The eleven o’clock emoji is used to indicate the time of 11:00 on a clock. It can be used to show that it is late morning, or to signify that an event is happening at this specific time. It can also be used in a more figurative sense to represent the idea of being right on time for something. |
Just finished reading an inspiring article on trans rights. | The transgender symbol emoji is often used to represent individuals who identify as transgender or non-binary |
I'm curious about the history behind Lesotho’s flag. | The flag of Lesotho represents the country of Lesotho in southern Africa. It is a tricolor flag of horizontal stripes with a blue triangle on the left side. The colors symbolize different aspects of the country's history and culture. |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}per_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 5multi_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: 5max_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: Falsefp16_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: Falsehub_revision: Nonegradient_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: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.0572 | 500 | 1.2611 |
| 0.1144 | 1000 | 1.0953 |
| 0.1715 | 1500 | 0.9964 |
| 0.2287 | 2000 | 0.9722 |
| 0.2859 | 2500 | 0.9712 |
| 0.3431 | 3000 | 0.918 |
| 0.4003 | 3500 | 0.9296 |
| 0.4575 | 4000 | 0.9069 |
| 0.5146 | 4500 | 0.9062 |
| 0.5718 | 5000 | 0.8788 |
| 0.6290 | 5500 | 0.895 |
| 0.6862 | 6000 | 0.8601 |
| 0.7434 | 6500 | 0.8461 |
| 0.8005 | 7000 | 0.8379 |
| 0.8577 | 7500 | 0.8209 |
| 0.9149 | 8000 | 0.8015 |
| 0.9721 | 8500 | 0.8103 |
| 1.0293 | 9000 | 0.7828 |
| 1.0865 | 9500 | 0.7064 |
| 1.1436 | 10000 | 0.6881 |
| 1.2008 | 10500 | 0.7004 |
| 1.2580 | 11000 | 0.7121 |
| 1.3152 | 11500 | 0.7222 |
| 1.3724 | 12000 | 0.7183 |
| 1.4296 | 12500 | 0.7024 |
| 1.4867 | 13000 | 0.7114 |
| 1.5439 | 13500 | 0.7115 |
| 1.6011 | 14000 | 0.6858 |
| 1.6583 | 14500 | 0.6944 |
| 1.7155 | 15000 | 0.6867 |
| 1.7726 | 15500 | 0.6776 |
| 1.8298 | 16000 | 0.7172 |
| 1.8870 | 16500 | 0.7086 |
| 1.9442 | 17000 | 0.6882 |
| 2.0014 | 17500 | 0.6788 |
| 2.0586 | 18000 | 0.5488 |
| 2.1157 | 18500 | 0.5428 |
| 2.1729 | 19000 | 0.5628 |
| 2.2301 | 19500 | 0.5524 |
| 2.2873 | 20000 | 0.5695 |
| 2.3445 | 20500 | 0.5708 |
| 2.4016 | 21000 | 0.5703 |
| 2.4588 | 21500 | 0.5512 |
| 2.5160 | 22000 | 0.5646 |
| 2.5732 | 22500 | 0.5753 |
| 2.6304 | 23000 | 0.5739 |
| 2.6876 | 23500 | 0.554 |
| 2.7447 | 24000 | 0.5744 |
| 2.8019 | 24500 | 0.5236 |
| 2.8591 | 25000 | 0.5471 |
| 2.9163 | 25500 | 0.5576 |
| 2.9735 | 26000 | 0.5601 |
| 3.0306 | 26500 | 0.5004 |
| 3.0878 | 27000 | 0.4471 |
| 3.1450 | 27500 | 0.4588 |
| 3.2022 | 28000 | 0.4439 |
| 3.2594 | 28500 | 0.4283 |
| 3.3166 | 29000 | 0.4452 |
| 3.3737 | 29500 | 0.4446 |
| 3.4309 | 30000 | 0.4413 |
| 3.4881 | 30500 | 0.4377 |
| 3.5453 | 31000 | 0.4504 |
| 3.6025 | 31500 | 0.4312 |
| 3.6597 | 32000 | 0.4397 |
| 3.7168 | 32500 | 0.4376 |
| 3.7740 | 33000 | 0.4596 |
| 3.8312 | 33500 | 0.4501 |
| 3.8884 | 34000 | 0.4338 |
| 3.9456 | 34500 | 0.4609 |
| 4.0027 | 35000 | 0.4476 |
| 4.0599 | 35500 | 0.3652 |
| 4.1171 | 36000 | 0.3506 |
| 4.1743 | 36500 | 0.3481 |
| 4.2315 | 37000 | 0.3805 |
| 4.2887 | 37500 | 0.3574 |
| 4.3458 | 38000 | 0.3622 |
| 4.4030 | 38500 | 0.3686 |
| 4.4602 | 39000 | 0.3572 |
| 4.5174 | 39500 | 0.3791 |
| 4.5746 | 40000 | 0.3736 |
| 4.6317 | 40500 | 0.3514 |
| 4.6889 | 41000 | 0.3682 |
| 4.7461 | 41500 | 0.3625 |
| 4.8033 | 42000 | 0.3601 |
| 4.8605 | 42500 | 0.3703 |
| 4.9177 | 43000 | 0.3783 |
| 4.9748 | 43500 | 0.3583 |
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@misc{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 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},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}