rituraj18's picture
Add new SentenceTransformer model
17fdf2f verified
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - generated_from_trainer
  - dataset_size:1927
  - loss:TripletLoss
base_model: sentence-transformers/paraphrase-MiniLM-L6-v2
widget:
  - source_sentence: >-
      “To be a Christian means to forgive the inexcusable because God has
      forgiven the inexcusable in you.”
    sentences:
      - “Eating and reading are two pleasures that combine admirably.”
      - >-
        “I am an excitable person who only understands life lyrically,
        musically, in whom feelings are much stronger as reason. I am so thirsty
        for the marvelous that only the marvelous has power over me. Anything I
        can not transform into something marvelous, I let go. Reality doesn't
        impress me. I only believe in intoxication, in ecstasy, and when
        ordinary life shackles me, I escape, one way or another. No more walls.”
      - >-
        “Can you surf really well, then?"I looked at Grover, who was trying hard
        not to laugh."Jeez, Nico," I said. "I've never really tried."He went on
        asking questions. Did I fight a lot with Thalia, since she was a
        daughter of Zeus? (I didn't answer that one.) If Annabeth's mother was
        Athena, the goddess of wisdom, then why didn't Annabeth know better than
        to fall off a cliff? (I tried not to strangle Nico for asking that one.)
        Was Annabeth my girlfriend? (At this point, I was ready to stick the kid
        in a meat-flavored sack and throw him to the wolves.)”
  - source_sentence: >-
      “Peeta, how come I never know when you're having a nightmare?â€� I
      say.“I don't know. I don't think I cry out or thrash around or anything.
      I just come to, paralyzed with terror,� he says.“You should wake
      me,� I say, thinking about how I can interrupt his sleep two or three
      times on a bad night. About how long it can take to calm me down.“It's
      not necessary. My nightmares are usually about losing you,� he says.
      “I'm okay once I realize you're here.”
    sentences:
      - >-
        “Every time you smile at someone, it is an action of love, a gift to
        that person, a beautiful thing.”
      - “There are no facts, only interpretations.”
      - >-
        “Really, the combination of the scabs and the ointment looks hideous. I
        can't help enjoying his distress."Poor Finnick. Is this the first time
        in your life you haven't looked pretty?" I say."It must be. The
        sensation's completely new. How have you managed it all these years?" he
        asks."Just avoid mirrors. You'll forget about it," I say."Not if I keep
        looking at you," he says.”
  - source_sentence: >-
      “There are two basic motivating forces: fear and love. When we are afraid,
      we pull back from life. When we are in love, we open to all that life has
      to offer with passion, excitement, and acceptance. We need to learn to
      love ourselves first, in all our glory and our imperfections. If we cannot
      love ourselves, we cannot fully open to our ability to love others or our
      potential to create. Evolution and all hopes for a better world rest in
      the fearlessness and open-hearted vision of people who embrace life.”
    sentences:
      - >-
        “Love conquers all," Aphrodite promised. "Look at Helen and Paris. Did
        they let anything come between them?""Didn't they start the Trojan War
        and get thousands of people killed?""Pfft. That's not the point. Follow
        your heart.”
      - >-
        “Gus: "It tastes like..."Me: "Food."Gus: "Yes, precisely. It tastes like
        food, excellently prepared. But it does not taste, how do I put this
        delicately...?"Me: "It does not taste like God Himself cooked heaven
        into a series of five dishes which were then served to you accompanied
        by several luminous balls of fermented, bubbly plasma while actual and
        literal flower petals floated down around your canal-side dinner
        table."Gus: "Nicely phrased."Gus's father: "Our children are weird."My
        dad: "Nicely phrased.”
      - >-
        “You may say I'm a dreamer, but I'm not the only one. I hope someday
        you'll join us. And the world will live as one.”
  - source_sentence: >-
      “A human being is a part of the whole called by us universe, a part
      limited in time and space. He experiences himself, his thoughts and
      feeling as something separated from the rest, a kind of optical delusion
      of his consciousness. This delusion is a kind of prison for us,
      restricting us to our personal desires and to affection for a few persons
      nearest to us. Our task must be to free ourselves from this prison by
      widening our circle of compassion to embrace all living creatures and the
      whole of nature in its beauty.”
    sentences:
      - “A clever person solves a problem. A wise person avoids it.”
      - “A smile is a curve that sets everything straight.”
      - “Music is ... A higher revelation than all Wisdom & Philosophy”
  - source_sentence: >-
      “The reason I talk to myself is because I’m the only one whose answers I
      accept.”
    sentences:
      - >-
        “The person, be it gentleman or lady, who has not pleasure in a good
        novel, must be intolerably stupid.”
      - >-
        “Follow your heart, listen to your inner voice, stop caring about what
        others think.”
      - “If you try to fail, and succeed, which have you done?”
pipeline_tag: sentence-similarity
library_name: sentence-transformers

SentenceTransformer based on sentence-transformers/paraphrase-MiniLM-L6-v2

This is a sentence-transformers model finetuned from sentence-transformers/paraphrase-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-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 Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 384, '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("rituraj18/quote-embedder-finetuned_ver_8")
# Run inference
sentences = [
    '“The reason I talk to myself is because I’m the only one whose answers I accept.”',
    '“If you try to fail, and succeed, which have you done?”',
    '“Follow your heart, listen to your inner voice, stop caring about what others think.”',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Training Details

Training Dataset

Unnamed Dataset

  • Size: 1,927 training samples
  • Columns: sentence_0, sentence_1, and sentence_2
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1 sentence_2
    type string string string
    details
    • min: 9 tokens
    • mean: 43.08 tokens
    • max: 512 tokens
    • min: 9 tokens
    • mean: 45.83 tokens
    • max: 512 tokens
    • min: 9 tokens
    • mean: 41.51 tokens
    • max: 512 tokens
  • Samples:
    sentence_0 sentence_1 sentence_2
    “We delight in the beauty of the butterfly, but rarely admit the changes it has gone through to achieve that beauty.” “I don't trust people who don't love themselves and tell me, 'I love you.' ... There is an African saying which is: Be careful when a naked person offers you a shirt.” “Whenever you find yourself on the side of the majority, it is time to reform (or pause and reflect).”
    “Fear doesn't shut you down; it wakes you up” “We believe in ordinary acts of bravery, in the courage that drives one person to stand up for another.” “You may say I'm a dreamer, but I'm not the only one. I hope someday you'll join us. And the world will live as one.”
    “The real story of the Fleece: there were these two children of Zeus, Cadmus and Europa, okay? They were about to get offered up as human sacrifices, when they prayed to Zeus to save them. So Zeus sent this magical flying ram with golden wool, which picked them up in Greece and carried them all the way to Colchis in Asia Minor. Well, actually it carried Cadmus. Europa fell off and died along the way, but that's not important.""It was probably important to her.” “God alert!" Blackjack yelled. "It's the wine dude!Mr. D sighed in exasperation. "The next person, or horse, who calls me the 'wine dude' will end up in a bottle of Merlot!” “Life is to be enjoyed, not endured”
  • Loss: TripletLoss with these parameters:
    {
        "distance_metric": "TripletDistanceMetric.EUCLIDEAN",
        "triplet_margin": 0.5
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • fp16: True
  • 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: 8
  • per_device_eval_batch_size: 8
  • 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: {}
  • 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
  • use_ipex: False
  • bf16: False
  • fp16: True
  • 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}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • 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
  • 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
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

Training Logs

Epoch Step Training Loss
2.0747 500 0.3687

Framework Versions

  • Python: 3.11.13
  • Sentence Transformers: 4.1.0
  • Transformers: 4.48.3
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.3.0
  • Datasets: 3.6.0
  • Tokenizers: 0.21.1

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

TripletLoss

@misc{hermans2017defense,
    title={In Defense of the Triplet Loss for Person Re-Identification},
    author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
    year={2017},
    eprint={1703.07737},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}