SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'BertModel'})
(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})
)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 'the postseason. after the game, harbaugh said he didn \' t know when smith would be back. " i think not having justin is a huge deal, " whitner said. " just a year ago, he was up for the defensive player of the year, not only for what he does against the run but what he does against the pass also. how he helps aldon out over there also, eating up two guys, allowing him to go one - on - one. he \' s a huge part of this defense. we all know it. " on lynch \' s first - quarter touchdown run, he ran past smith \' s replacement, four - year veteran ricky jean francois, en route to a 26 - carry, 111 - yard performance, his third straight 100 - yard game against the 49ers. " i \' ve had to mentally prepare myself for ( smith ) not coming back, " jean francois said. " he \' s a big part of our defense, but all i can do is be ricky jean francois. we would love justin to come back, but if he doesn \' t, i \' m here to pick up that space. " the defense was a disaster. the loss was a total team effort. on offense, quarterback colin kaep',
8 "In a much-anticipated meeting between NFC West teams, the Seahawks humiliated the 49ers 42-13, handing Jim Harbaugh the worst loss of his 31-game tenure in San Francisco on his 49th birthday. Despite the drubbing, the 49ers (10-4-1) still have a half-game lead on the Seahawks (10-5) for the division title and can clinch the NFC West crown with a win over visiting Arizona (5-10) on Sunday. The 49ers slipped to the No. 3 seed in the NFC behind Green Bay (11-4) and won't have a first-round bye if the Packers win at Minnesota in their regular-season finale. After Sunday night's rout before a typically raucous crowd at CenturyLink Field, the 49ers are surely hoping their postseason calendar doesn't include another date with the Seahawks, who have won their past three games by a combined 150-30. On Sunday, they surrendered a season-high 176 rushing yards, collected one sack and allowed four touchdowns on Seattle's four trips to the red zone. On Lynch's first-quarter touchdown run, he ran past Smith's replacement, four-year veteran Ricky Jean Francois, en route to a 26-carry, 111-yard performance, his third straight 100-yard game against the 49ers. On offense, quarterback Colin Kaepernick, who called two timeouts with the play clock ticking down and was flagged for two delay-of-game penalties in the first half, had the lowest rating (72.0) of his six-start career. With the 49ers trailing 14-0 early in the second quarter, David Akers' 21-yard field-goal attempt was blocked by Seattle's Red Bryant, and the loose ball was returned 90 yards for a touchdown by cornerback Richard Sherman. [...] Sherman, who added a fourth-quarter interception in the end zone, and wide receiver Doug Baldwin, another Harbaugh protege, played key roles in pushing around the 49ers. Baldwin (four catches, 53 yards) scored Seattle's final two touchdowns on passes of 4 and 6 yards from dynamic rookie quarterback Russell Wilson, who has thrown 16 touchdown passes and three interceptions in his past eight starts. 49ers' playoff scenarios The 49ers' 42-13 loss in Seattle on Sunday prevented them from clinching the NFC West title and dimmed their hopes of grabbing the conference's No. 2 seed and a first-round bye in the playoffs.",
9 'Best of the Web: What’s in a name? A huge tax bill.',
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.5620, 0.0516],
19# [ 0.5620, 1.0000, -0.0890],
20# [ 0.0516, -0.0890, 1.0000]])EmbeddingSimilarityEvaluator| Metric | Value |
|---|---|
| pearson_cosine | nan |
| spearman_cosine | nan |
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
fury among passengers. earlier this month, american was forced to cancel 300 flights in one week. but american ’ s $ 25 luggage fee has helped the ailing airline rake in more than $ 288 million so far this year, according to the bureau of transportation, which is part of the u. s. department of transportation. “ the travelers who haven ’ t gotten used to these fees need to get used to them quickly because this is a huge stream of revenue for the airline industry and it is not going anywhere, ” says genevieve shaw brown, abc news ’ travel and lifestyle editor. “ if anything, there will be more fees in the future. ” while most passengers find baggage fees costly, there is one airline that is taking customer concerns to heart. southwest airlines is promoting its “ bags fly free ” policy as a way to gain business. southwest will allow customers to check two bags per passenger for free. jetblue allows one free bag per passenger. u. s. airlines also collected an additional $ 1. 3 billion in ... | Mary Altaffer/AP U.S. airlines rang up more than $1.7 billion in baggage fees in the first six months of the year, the most ever collected in that period. Delta Airlines collected the most in baggage fees with nearly $430 million from January to June, according to a report the Bureau of Transportation released Tuesday. United Airlines came in second with $351 million in baggage fees. From carry-on to oversized items, U.S. airliners are raking in record revenues, a rare bright spot in an industry now suffering turbulence from soaring oil prices and rising labor costs. In 2007, the airlines paid… |
a very important part of the government ' s economic plan. " obviously, for an open trading economy like australia it is critically important that we ' re agile and innovative and always able to be as competitive as we possibly can be internationally, " he told abc television. | Former prime minister Tony Abbott has urged the Turnbull government not to over-react to the Pauline Hanson One Nation factor. |
the rollout of the nbn was one of many issues contested during the election campaign, but it would appear neither side is offering a system to beat the world. australia ' s ranking when it comes to " networked readiness " has slipped from 16th to 18th, according to the world economic forum ' s global information technology report for 2016. australia ranked nine in 2004. australian industry group chief innes willox said despite the efforts from all sides of politics to improve our digital readiness, australia clearly still has some way to go to regain a place inside the world ' s top 10. " the 2016 result is disappointing, especially at a time of economic and political uncertainty when we should be doing all we can to improve our productive performance at all levels and through all means, " mr willox said in a statement on wednesday. he said there is a clear gap between the top seven ranked economies and other advanced economies. singapore, northern europe and the us dominate the rankin... | The latest World Economic Forum's 'networked readiness' index shows Australia has slipped from 16th to 18th. |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}per_device_train_batch_size: 16eval_strategy: stepsper_device_eval_batch_size: 16multi_dataset_batch_sampler: round_robinper_device_train_batch_size: 16num_train_epochs: 3max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torchoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1label_smoothing_factor: 0.0bf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: trackioeval_strategy: stepsper_device_eval_batch_size: 16prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_backend: Noneddp_timeout: 1800fsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}deepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | spearman_cosine |
|---|---|---|---|
| 0.2150 | 500 | 0.6724 | - |
| 0.4299 | 1000 | 0.2990 | - |
| 0.6449 | 1500 | 0.2345 | - |
| 0.8598 | 2000 | 0.2132 | - |
| 1.0 | 2326 | - | nan |
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{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}