SentenceTransformer based on google/embeddinggemma-300m

This is a sentence-transformers model finetuned from google/embeddinggemma-300m. 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.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: google/embeddinggemma-300m
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'Gemma3TextModel'})
  (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})
)

Usage

Direct Usage (Sentence Transformers)

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("ahmedHamdi/narrative-similarity-es-en-gemma")
# Run inference
sentences = [
    "Leslie is a manipulative, troubled alcoholic from West Texas who won $190,000 in a local lottery, only to squander the winnings on liquor and drugs. Six years later, Leslie is homeless and lives a nomadic life, drifting between motels and the streets. After being kicked out of a residential motel, she reunites with her estranged 20-year-old son, James, who allows her to live with him on the condition that she doesn't drink. Leslie soon steals money from James's roommate, Darren, and James discovers liquor bottles under his bed, prompting him to call his grandmother and Leslie's friend, Nancy, for help. Nancy and her boyfriend, Dutch, reluctantly allow Leslie to stay with them, but throw her out the night she visits the local bar and is spotted by Pete, one of her friends. Leslie sleeps outside next to a motel, where Sweeney, one of the owners, finds her at dawn. He orders her to leave, and she runs away, leaving her suitcase behind. Pete meets her outside a convenience store that night and buys her food, but Leslie again runs away when he makes sexual advances toward her. Leslie returns to the motel to retrieve her suitcase, and the benevolent Sweeney impulsively offers her a job cleaning rooms in exchange for a small salary and room and board. Royal, who helps manage the motel with Sweeney, is cold toward Leslie, whom he has known since childhood. Leslie is frequently late for her duties and continues to spend her earnings on alcohol, often going to bars. One night, a drunken Leslie heads to the house where she raised James, shocking the family who now lives there. The owners call Sweeney, who returns Leslie to the inn. Disappointed by Leslie's lack of commitment, Sweeney intends to fire her, but he relents when she assures him that she intends to change her ways. With nowhere else to go, Leslie tries to focus on her work and stay sober while suffering through alcohol withdrawal. Leslie and Sweeney develop a friendship, bonding over their shared history of addiction. Leslie accompanies Sweeney to a carnival, where he meets his daughter and granddaughter. At the carnival, Leslie confronts Nancy, who criticizes her in front of Sweeney for abandoning James when he was a child and insults her in front of everyone. Later that day, Leslie quits her job at the motel. She calls James at a laundromat, leaving him a message saying she loves him, then visits a bar, where she talks to a young man. She orders a beer but decides not to drink it. Meanwhile, Sweeney looks for Leslie and arrives at the bar, but she is gone. Leslie squats in an abandoned ice cream parlor across the street from the motel and watches Sweeney return. In the morning, she wakes Sweeney and tells him she wants to renovate the ice cream parlor. Ten months later, Leslie is sober and, with Sweeney and Royal's help, has renovated the ice cream parlor, turning it into a restaurant. On opening day, Leslie has no customers. Nancy arrives that evening at closing time, and Leslie accuses her of sabotaging the opening by telling the locals not to come. Instead of confronting Leslie in anger, Nancy apologizes for not being emotionally present throughout Leslie's life. Nancy also surprises Leslie by revealing that she has brought James with her. Royal and Sweeney prepare a meal for them, and the two embrace.",
    "Leslie is a troubled and manipulative alcoholic from West Texas who won $190,000 in a local lottery, only to squander the winnings on liquor and drugs. Six years later, Leslie is destitute, living a peripatetic life in motels and on the streets. After being kicked out of a residential motel, she reunites with her estranged 19-year-old son James, who allows her to live with him under the provision that she not drink. Leslie soon steals money from James's roommate Darren, and James discovers liquor bottles under her bed, leading him to call his grandmother and Leslie's friend Nancy for help. Nancy and her boyfriend Dutch reluctantly allow Leslie to stay with them, but lock her out in the middle of the night when she visits the local bar and is spotted by Pete, one of their friends. Leslie sleeps outside next to a motel, where she is found at dawn by Sweeney, one of the proprietors. He orders her to leave, and she flees, leaving her suitcase behind. She is met outside a convenience store that night by Pete, who buys her food, but Leslie again flees when he attempts to make sexual advances toward her. Leslie returns to the motel in search of her suitcase, and Sweeney pretends to confuse her for somebody who had called for a job, and offers her the opportunity of cleaning rooms in exchange for a small wage and boarding. Royal, who owns and helps run the motel with Sweeney, is cold toward Leslie, whom he has known since childhood. Leslie is frequently unpunctual to her duties, and she continues to spend her earnings on alcohol, often going to bars. Late one night, Leslie drunkenly wanders to the home where she raised James, startling the family who now lives there. The homeowners phone Sweeney, who returns Leslie to the roadhouse. Disappointed by Leslie's lack of commitment, Sweeney intends to fire her, but he relents when she assures him she intends to change her ways. With nowhere left to turn, Leslie attempts to focus on her job and maintain sobriety as she suffers through alcohol withdrawal. Leslie and Sweeney develop a friendship, bonding over their mutual history of addiction. Leslie accompanies Sweeney to a fair, where she meets his daughter and granddaughter. Leslie gets into a confrontation with Nancy at the fair, who lambasts her in front of Sweeney for having abandoned James when he was a child. Later that day, she argues with Sweeney after he insists on watching a VHS tape containing the TV news piece on her lottery win. On the tape, the teenage James mentions that Leslie has always wanted to open a diner and the younger Leslie, clearly drunk, scoffs. She quits her job at the motel. She phones James from a laundromat, leaving a message telling him she loves him. She then visits her usual bar, where she is hit on by a handsome but roguish younger man. She orders a beer and a shot, but decides not to drink either. Meanwhile, Sweeney searches for Leslie and arrives at the bar, but she has left. He punches and tussles with Pete after he and Nancy insult Leslie. Leslie squats in an abandoned ice cream shop across the street from the motel and watches as Sweeney returns. In the morning, she awakens Sweeney and tells him she wants to renovate the ice cream shop and open a diner. He reluctantly agrees to help and they kiss for the first time. Ten months later, Leslie is sober, and with Sweeney and Royal's help, she has fixed up the building and turned it into a diner. On opening day, Leslie receives no customers. Nancy arrives that evening at closing time, and Leslie accuses her of sabotaging the business's opening by telling the locals not to go. Instead of responding with rage, Nancy apologizes to Leslie for not being emotionally present throughout Leslie's life, while also stating that she won't ever forgive Leslie for abandoning her son due to her addiction. Nancy also surprises Leslie by revealing she has brought James with her. Royal and Sweeney prepare a meal for them, and the two embrace.",
    "After his university graduation ceremony, David (Anastasios Soulis) publicly and awkwardly proposes to his girlfriend, Nadja (Nanna Blondell), which she happily accepts. A year and a half later, however, they are stressed due to work and school and fight frequently in their apartment in Stockholm. The stress is compounded when Nadja learns that she is pregnant, which she is unhappy about as she is studying to be a doctor and she is not sure if she and David should be parents. She decides to keep it a secret from David. Nadja opens up to an older neighbor, Tomas (Thomas Hanzon), and he assures her that she and David will be great parents; he insists that parenthood is life's greatest gift and implies he has lost a child of his own. The next morning, David surprises Nadja with a camping trip to see the northern lights, and the two reconcile and take the trip with their dog, Boris. While stopping for gas, David encounters two locals, brothers Jarmo and Rolle, and is made uncomfortable by their rough mannerisms and their truck bed full of dead game. As he has difficulties taking his car out of park, he accidentally bumps into the brothers' truck, leaving scratches. David chooses to drive off instead of saying something, which annoys Nadja. When they reach their destination at an inn, the woman at the front desk treats them strangely and silently refuses to serve them, leaving her brother Einar to imply that she's not used to seeing an interracial couple. He learns of their itinerary and offers to host them at his cabin in the wilderness. Nadja becomes nervous seeing Jarmo and Rolle in the establishment, and when they leave, they discover that someone has keyed their car and vandalized their bumper sticker with a racial epithet. Angered by this, Nadja spots their pickup truck later on the drive and scratches it with a screwdriver, narrowly avoiding retaliation when the brothers catch her in the act.  The couple camps beneath the northern lights, and Nadja reveals she is pregnant, which makes David nervous and unsure. Their conversation is interrupted when they spot a red dot on the wall of their tent. They first assume that it is a laser pointer prank, but quickly realize that is a laser sight from a rifle and guess that the brothers are attacking them in revenge for the car damage. Boris escapes into the wilderness while they try to hide, and they hear gunshots and the sound of Boris whining. After they are shot at, they flee into the forest and hear their pursuers chase after them. After spending the night hiding in a small shelter, they return to the bloodied campsite and find all their belongings missing, and Boris's decapitated head in the tent. While searching for any remaining possessions, David is injured when his arm gets caught in a hunting trap. Finding nothing to help them, they set off to find help. However, they are soon shot at again, and David, increasingly losing blood, hallucinates a boy in a winter coat staring at them. David is shot in the shoulder while Nadja escapes unhurt, and the two search for each other as a snowstorm sets in. Nadja realizes that she has run atop a frozen lake, and as David searches for her, he falls in and is narrowly rescued by her. The couple finally makes it to an emergency cabin, where they phone rescuers and are told they will have to wait until the storm passes for help. The next morning, they hear a vehicle approach the cabin and realize it is an armed (but unaware) Jarmo, who works as a mountain rescuer. Escaping through a back window, they flee into the woods and seek shelter in what is revealed to be the den of a hibernating bear. Jarmo discovers them, but before he can shoot, Nadja shoots him with a flare found at the cabin. David's condition deteriorates as they progress, and he hallucinates the boy again and begins mumbling about guilt. Spotting Einar's cabin in the distance, Nadja runs ahead to get help for David, but encounters Rolle on the way. Rolle seems confused by her appearance, but before he can act, David knocks him unconscious with a rock, and the two make it to Einar's cabin. Einar appears to call for help, but Nadja realizes that he is contacting someone else, and Einar suddenly becomes aggressive and locks them in a room discovered to be covered in stealth photographs taken of the couple. Finally, Tomas arrives with a rifle, and the truth is revealed: the day of the couple's engagement, Nadja attempted to perform oral sex on David as they drove home, and a distracted David struck and killed a pedestrian -- the boy he had hallucinated earlier, who was also Tomas's son and Einar's nephew. David chose to drive off instead of calling the police as Nadja wanted, which left her wracked with guilt. On that day, Tomas had been playing with a drone with his son, which had caused him to run into the road; however, the drone also captured the couple's license plate, and a grieving Tomas tracked them down and moved into a nearby apartment to surveil them. Tomas is intent on inflicting revenge on the couple for callously driving away and had been behind the earlier murder attempts. He now decides to become more sadistic and tries to get David to use a power drill to torture and kill Nadja's child, and he shoots David in the knee when he does not comply. Tomas prepares to kill them both but is interrupted by the arrival of a furious Jarmo, who has tracked down the couple. In the confusion, Tomas shoots and fatally wounds Jarmo, who accidentally does the same to Einar, and Nadja and David escape while Jarmo and Tomas struggle for a rifle. Nadja and David attempt to flee, but David cannot escape with his injuries. He tells Nadja to run, and when she stumbles upon the unconscious Rolle, she decides to take his rifle and save David. However, when she returns, she hesitates while trying to shoot him and is shot in the head and killed instantly by Mona, Tomas's wife and Einar's sister encountered earlier at the inn. A traumatized David begs to be killed as well, but Thomas refuses, telling him that he can now understand how he felt after his own son had died. Mona and Tomas depart as David is left sobbing in the snow.",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000,  0.9614, -0.0053],
#         [ 0.9614,  1.0000, -0.0544],
#         [-0.0053, -0.0544,  1.0000]])

Training Details

Training Dataset

Unnamed Dataset

  • Size: 3,644 training samples
  • Columns: sentence_0 and sentence_1
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1
    type string string
    details
    • min: 10 tokens
    • mean: 139.41 tokens
    • max: 256 tokens
    • min: 3 tokens
    • mean: 229.97 tokens
    • max: 256 tokens
  • Samples:
    sentence_0 sentence_1
    Norm of the North revolves around a polar bear who finds refuge in an abandoned scientific station after being forced to leave his Arctic home due to climate change. Norm is accompanied by three small lemmings. Norm, a polar bear, is the son of the King of the Arctic. In his youth, he realizes his ability to speak to humans, a trait shared only by his grandfather. Because of this, he is made an outcast from the other animals, only being accepted by Socrates, a wise seagull, and Elizabeth, a female polar bear whom Norm is in love with. Years later, Norm's grandfather has become the world's most famous polar bear and human tourists are filling the Arctic. Socrates shows Norm and three Arctic lemmings a luxury condo that has been installed on the ice. Inside this condo is Vera, a representative for wealthy developer Mr. Greene. After Norm saves Vera from an avalanche, she tells him to find an actor to play a polar bear for their campaign. Norm denies this, but soon falls in love with Vera much to the jealousy of the lemmings. When his grandfather embarrasses him in front of the sea lions, Norm chases a boy named Pedro who then discovers Norm. But just before Pedro and Norm could get together, No...
    This movie is about a boy named Ben who finds a Honus Wagner baseball card on a wall in his house, which his friend Griffin decides to sell to Paul Swindell for $350. The next morning, Griffin and Ben realize Paul Swindell has scammed them, as the baseball card is worth $1.2 million. So, Griffin and Ben convince some of their classmates to form a team to recover the card. This team consists of: Savannah Westcott "The Actress" (Jennette McCurdy), Griffin Bing "The Brain" (Noah Crawford), Ben Dupree "The Best Friend" (Chris O'Neal), Amanda Benson "The Gymnast" (Ariana Grande), and Darren Vader "The Force" (Noah Munck). Melissa (Ciara Bravo), Griffin's younger sister, tries to join the group, but her brother refuses. The team then enters Swindell's Shop to steal the baseball card. Griffin finds the card but returns it because he wants to get it the right way. Melissa interferes with the alarm system and saves the team, thus becoming "The Hacker." Later, Anton Lefevre, a millionaire busine... Walter Krunk is a 35-year-old orphan who has lived in an orphanage since childhood. He has a friendship with a fellow orphan named Henry. During a play at the orphanage, Walter ruins the set by crashing into the set when his harness malfunctions. Meanwhile, retired MMA fighter Eddie Sullivan is training a fellow fighter for a tournament in New Orleans with a $100,000 prize. Fellow rival Memphis Earl has also trained a bigger, scarier fighter named Redrum for the tournament. Both of their trainees have a short match, but Eddie's fighter is easily knocked out with one punch. Earl threatens Eddie saying that if he doesn't find a new fighter they'll beat him down. One day Walter is cooking with Henry when Walter suddenly goes to the bathroom and tells Henry to watch the food. Henry is distracted by a game and doesn't see that the food has started a fire. The fire department manages to put the fire out but it leaves the kitchen destroyed. Local law enforcement states that without a working...
    Yuri Orlov and his brother Vitaly Orlov are Ukrainian-born American arms dealers. Traveling through some of the world's most dangerous war zones, Yuri struggles to escape the relentless Interpol agent Jack Valentine, his rivals in the business, and even some of his clients, who include many powerful dictators. Ultimately, Yuri must also confront his own conscience. In the end, Vitaly Orlov is killed, and Yuri loses his remaining family because of his actions. Valentine even manages to arrest him for his activities. However, he doesn't go to prison for his crime and is even released to continue the business, as the U.S. government needs him to supply weapons to dangerous leaders. The government needs his assistance in fighting other dangerous leaders who are enemies of the United States without revealing the fact that they are supplying these leaders, as it would damage its image if this were known. Valentine, with a heavy heart, has to learn this truth from Yuri before it comes to ligh... Yuri Orlov, the eldest son of a family of Jewish Ukrainian refugees, is visiting a restaurant on Brighton Beach, Brooklyn, New York where he witnesses a Russian mobster kill two assassins holding Kalashnikov rifles. The incident inspires him to go into the arms trade. After meeting a contact at his temple and completing his first sale of an Uzi sub-machine gun to a local mobster, Yuri convinces his younger brother Vitaly to become his partner. The two brothers get their first break during the 1982 Lebanon War, where they sell weapons to both Israeli and Lebanese troops despite seeing the weapons be used to commit atrocities. As Yuri prospers, he eventually catches the attention of Interpol agent Jack Valentine. Valentine represents a unique threat to Yuri because he is after recognition, not money, and cannot be bribed. Vitaly becomes addicted to cocaine after a Colombian drug lord forces the brothers to accept several kilo of cocaine as payment for a sale of several Glock 17 pistols. ...
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "gather_across_devices": false
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 4
  • per_device_eval_batch_size: 4
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 4
  • per_device_eval_batch_size: 4
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 3
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_ratio: 0.0
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • bf16: False
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch_fused
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • project: huggingface
  • trackio_space_id: trackio
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • hub_revision: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: no
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: True
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss
0.5488 500 0.5529
1.0977 1000 0.5756
1.6465 1500 0.2972
2.1954 2000 0.2053
2.7442 2500 0.0279

Framework Versions

  • Python: 3.9.18
  • Sentence Transformers: 5.1.2
  • Transformers: 4.57.6
  • PyTorch: 2.8.0+cu128
  • Accelerate: 1.10.1
  • Datasets: 4.5.0
  • Tokenizers: 0.22.2

Citation

BibTeX

Sentence Transformers

@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",
}

MultipleNegativesRankingLoss

@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}
}
Downloads last month
2
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ahmedHamdi/narrative-similarity-es-en-gemma

Finetuned
(223)
this model

Papers for ahmedHamdi/narrative-similarity-es-en-gemma