Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False, 'architecture': 'T5EncoderModel'})
(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': False})
(2): Dense({'in_features': 1024, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
(3): Normalize()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("ahmedHamdi/narrative-similarity-es-en-masked-instructor-xl")
5# Run inference
6sentences = [
7 "Represent the plot: The story is set in GPE (now the capital of Pakistani Punjab) in the period immediately preceding and during the partition of GPE in 1947, at the time of GPE's independence. A young girl with polio, PERSON (PERSON), narrates the story through the voice of her adult self (PERSON). The girl belongs to a wealthy Parsi family that hopes to remain neutral amidst the rising tensions between Hindus, Sikhs, and Muslims in the region. She is adored and protected by her parents, Bunty (Kitu Gidwani) and PERSON (PERSON), and cared for by her ayah, a beautiful Hindu woman named Shanta (Nandita Das). Both ORG, the ice cream vendor (PERSON), and PERSON, the masseur (PERSON), are Muslim and deeply in love with GPE. Shanta, Dil, and PERSON are part of a small group of friends from different faiths (some of whom work for PERSON's family) who spend their days together in the park. However, this once close-knit group of friends falls apart, leading to a series of tragedies.",
8 "Represent the plot: The story is set in GPE (now the capital of Pakistani Punjab) in the time period directly before and during the partition of GPE in 1947 at the time of Indian independence. A young girl with polio, PERSON (PERSON), narrates the story through the voice of her adult self (PERSON). She is from a wealthy Parsi family who hope to remain neutral to the rising tensions between Hindus, Sikhs, and Muslims in the area. She is adored and protected by her parents, Bunty (Kitu Gidwani) and PERSON (PERSON), and cared for by her Ayah, named Shanta (Nandita Das). Both ORG, ORG (PERSON), and PERSON, the Masseur (PERSON) are in love with GPE. Shanta, Dil, and PERSON are part of a small group of friends from different faiths (some of whom work for PERSON's family) who spend their days together in the park. With partition, however, this once unified group of friends becomes divided and tragedy ensues.",
9 'Represent the plot: ORG is a housewife who lives in a bizarre, unnamed suburban town, where all the adults wear dental braces and drive golf carts instead of cars. She is married to GPE, with a seven year old son named PERSON and an infant daughter named PERSON. She is friends and rivals with PERSON, placing PERSON and PERSON son, PERSON, in competition with each other. Throughout the movie, PERSON is stalked by a mysterious giggling person. PERSON chats with PERSON on the sideline of their children’s soccer game. They briefly discuss the recent murder of a local yoga teacher before PERSON compliments PERSON. On a whim, PERSON asks if PERSON would like to have PERSON as her own daughter; PERSON accepts. PERSON and GPE are frustrated by PERSON, an eccentric young boy who is bad at sports and frequently urinates himself. After PERSON and Julian argue at ORG birthday party, Julian sings “Happy Birthday to You” to his father before abruptly falling face-first into the swimming pool. When he re-emerges, he has turned into a golden retriever. PERSON and PERSON continue sending PERSON to school dressed in human clothing. GPE delights in playing with his newly athletic “son,” but PERSON misses PERSON as he used to be, and their marriage begins to fray. In the parking lot after school, PERSON asks PERSON if she could have PERSON (now named PERSON) back. PERSON, hurt, refuses to let her go. Later at a soccer game, PERSON picks up the soccer ball and places it under her dress, mimicking a baby bump. She is congratulated by her friends for her pregnancy, and eventually “gives birth” to the soccer ball, naming it “PERSON” and treating it as a third child. After encouragement from her friends while bowling, PERSON tells GPE that she wants a divorce, casting him out of the house. Upon returning one day, he finds Julian alone in the backyard without clothes on while PERSON is out getting a haircut. Aghast, PERSON takes Julian from PERSON, devastating her. She rings PERSON doorbell and begs for her daughter back, but PERSON angrily refuses, telling PERSON that it’s her fault she has no children anymore. PERSON returns home, only to run into her stalker, a delusional middle-aged woman who screams at PERSON to get out of her house. Manic and distraught, PERSON rides her golf cart out of town and onto the highway, stopping near a cow pasture to remove her braces with wire cutters. She arrives at the house where she grew up, currently occupied by a single woman with three children. After asking if she can have one of the woman’s children, PERSON kidnaps one and takes her to a diner. There, she sees on the news that her stalker (who also murdered the yoga teacher) was arrested after being discovered by PERSON. Returning to town the next day, PERSON watches her kidnapped “daughter” play soccer with the other children. She learns that PERSON had moved her family into ORG house, with ORG serving as a pool boy. After realizing that the children are playing soccer over graves, PERSON stands up from the bleachers and declares that she needs to get out. The referee admonishes her for being “out of bounds,” and PERSON immediately sits back down.',
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.9562, 0.1597],
19# [0.9562, 1.0000, 0.1556],
20# [0.1597, 0.1556, 1.0000]])sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
Represent the plot: Val is 28 years old, an attractive woman with a university degree and a comfortable financial situation. Her defining characteristic is her intense sexual curiosity, which makes her a liberated woman constantly seeking new experiences to satisfy this addiction. This leads her to sleep with whomever she wants, whenever she wants. This has both positive and negative aspects, as after all these experiences, PERSON makes sex her way of life; it's like a drug for her. Through it, she finds a tortuous love and eventually works as a prostitute, in both cases suffering extreme situations that cause her pain and force her to re-evaluate her life. | Represent the plot: Val is a 28-year-old hypersexual woman who has many sexual partners, including PERSON who has a girlfriend. PERSON tires of PERSON's excessive sexual needs and angrily breaks up with her. Val later goes to an empty train station, where she meets a stranger and has sex with him. PERSON is disturbed by her behavior and sexual needs. She discusses her sex life openly with her grandmother, who encourages her to do as she pleases. The grandmother also suggests PERSON keep a diary as it can help provide clarity. When an old friend, PERSON, visits GPE, she leaves work early in order to have sex with him. The following day, PERSON shows up late for work, which eventually leads to her dismissal from the job. Val attends two job interviews. The second interviewer, ORG, is attracted to her and asks her out; she immediately accepts. Against her usual self, PERSON decides not to have sex with him after their first date. Jaime quickly buys an expensive home for both of them, thou... |
Represent the plot: Discontent with the new prospect of family life, teenager PERSON runs away from home and ends up at LOC, where a mischievous elf plots to cancel Christmas. | Represent the plot: Two years after the events of the first film, PERSON is now a cynical 13-year-old who is unhappy about spending Christmas in GPE, GPE with her mother PERSON, her brother PERSON, PERSON's new boyfriend PERSON, and PERSON's son PERSON. She wants to be back home, where it is snowing. PERSON decides to run away and get an early flight back home to GPE. She catches a shuttle that PERSON sneaks on to. They are unexpectedly transported, through a wormhole, to LOC by the driver, PERSON, a nefarious Christmas elf. PERSON and PERSON are discovered and saved by PERSON, who brings them back to his house and Mrs. PERSON. The ORG give the kids a grand tour of their village and all it has to offer. The four of them go back to the house for dinner. PERSON and PERSON go to bed as PERSON and his follower PERSON begin an attempt to destroy the village. Mrs. PERSON tells the kids the origin story of GPE in GPE and how he saved the elves from extinction, and received the Star of ORG, a ... |
Represent the plot: A young philosophy professor is invited to spend a weekend in the countryside by a friend, who also brings her father, who in turn is accompanied by his young lover, whom his daughter can't stand. Due to certain circumstances, the young woman and her friend's father end up alone: a brief romantic encounter develops between them, but it ultimately comes to nothing. | Represent the plot: PERSON, a young philosophy teacher, cannot go home to her flat in GPE because her cousin ORG is having a rendezvous with her boyfriend PERSON, who is in the military. It is not any better at her own boyfriend's apartment which was left in poor condition (apart from some fresh flowers in a vase) and she decides to leave and go to a housewarming party where she meets PERSON, a younger student who studies music. They become friends quickly, whereupon PERSON invites PERSON to her home to stay with her. She lets PERSON use the father's bedroom as he is always at his young girlfriend's home. However, the father, Igor, stops by the next morning to pick up some clothes, and is surprised by PERSON, who has just returned from a shower in an awkward moment. When the father leaves, the two new friends discuss a trip to PERSON's family's country house in GPE. PERSON, who dislikes her father's girlfriend Ève, probes PERSON about her perceptions of her father thinking there could ... |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false
5}multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 8per_device_eval_batch_size: 8per_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: Nonewarmup_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: 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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: noneftune_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: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 1.0989 | 500 | 0.7389 |
| 2.1978 | 1000 | 0.5039 |
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}