gabrielegabellone's picture
Add new SentenceTransformer model.
b7394d7 verified
metadata
language:
  - en
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - generated_from_trainer
  - dataset_size:40000
  - loss:MultipleNegativesRankingLoss
base_model: gabrielegabellone/all-mini-gooaq-4-epoch
widget:
  - source_sentence: what are the main differences between interphase and the mitotic phase?
    sentences:
      - >-
        It might surprise you, but you're probably wearing plastic clothes. ...
        Many of our clothes contain plastics like polyester, nylon, acrylic and
        polyamide. In fact most new fabrics are made of plastic – up to 64% of
        them. The thing is, every time we wash these materials they shed
        millions of plastic microfibres.
      - >-
        The cell cycle has two major phases: interphase and the mitotic phase
        (Figure 6.3). During interphase, the cell grows and DNA is replicated.
        During the mitotic phase, the replicated DNA and cytoplasmic contents
        are separated and the cell divides.
      - >-
        2: Chipotle *Whole30 Approved* Chipotle is another awesome option that's
        officially Whole30 Approved. They recently introduced Carne Asada and
        Chicken as compliant options in addition to the carnitas (they've been
        compliant for years!), so it's exciting to have three protein options.
  - source_sentence: how much do brides on say yes to the dress get paid?
    sentences:
      - >-
        Cooking with rice So if you're not going to eat rice straight after
        you've cooked it, you need to store it in the fridge — preferably within
        an hour or so, but definitely within four hours. Refrigeration won't
        kill the bacteria but it will slow down their growth.
      - >-
        Five of the most common determinants of demand are the price of the
        goods or service, the income of the buyers, the price of related goods,
        the preference of the buyer, and the population of the buyers.
      - >-
        Brides aren't compensated for being on the show (unless they're named
        Omarosa, that is). Plus, you need to be prepared to spend big on your
        gown. It's not unusual to see people on the show spend more than $10,000
        on a dress.
  - source_sentence: when was the tornado in jarrell tx?
    sentences:
      - >-
        The Chiefs were overwhelmed by the Bills and lost the game by a score of
        30–13. The Chiefs' victory on January 16, 1994, against the Oilers
        remained the franchise's last post-season victory for 21 years until
        their 30–0 victory over the Houston Texans on January 9, 2016.
      - >-
        On May 27, 1997, one of the most violent tornadoes in modern U.S.
        history produced close-to-unfathomable damage on the outskirts of
        Jarrell, TX, located about 40 miles north-northeast of Austin. There are
        only a few photos and videos of this monster, but it is a disaster well
        worth remembering.
      - >-
        What is open and closed circulation? In the open circulation, the blood
        is not enclosed in the blood vessels and is pumped into a cavity called
        hemocoel. On the contrary, in the closed circulation, the blood is
        pumped through the vessels separate from the interstitial fluid of the
        body.
  - source_sentence: >-
      what is the relationship between photosynthesis cellular respiration and
      the carbon cycle?
    sentences:
      - >-
        Infected people are most contagious up to about 2 weeks after the cough
        begins. Antibiotics may shorten the amount of time someone is
        contagious. While pertussis vaccines are the most effective tool to
        prevent this disease, no vaccine is 100% effective.
      - >-
        ['Download and launch iTunes on your computer.', 'Click iTunes music
        library to choose the song you want to make as a ringtone.',
        'Right-click the song and choose to Get Info.', 'Click Options to set
        the ringtone volume and start & stop time of the ringtone, and click
        OK.']
      - >-
        Cellular respiration and photosynthesis are important parts of the
        carbon cycle. The carbon cycle is the pathways through which carbon is
        recycled in the biosphere. While cellular respiration releases carbon
        dioxide into the environment, photosynthesis pulls carbon dioxide out of
        the atmosphere.
  - source_sentence: what is usb c ss?
    sentences:
      - >-
        Please do not use any air fresheners or fragrances in the same room as
        guinea pigs. They have a rather small and very sensitive respiratory
        system.
      - >-
        “Global warming” refers to the rise in global temperatures due mainly to
        the increasing concentrations of greenhouse gases in the atmosphere.
        “Climate change” refers to the increasing changes in the measures of
        climate over a long period of time – including precipitation,
        temperature, and wind patterns.
      - >-
        The USB Type-C specification is pretty confusing. ... The standard USB
        logo to identify USB 2.0 ports or slower. "SS" markings, which stand for
        SuperSpeed, to identify USB 3.0 ports, otherwise known as USB 3.1 gen 1.
        "10" markings, which stand for 10 Gbps, to identify USB 3.1 gen 2 ports
        with ultra-fast connectivity.
datasets:
  - sentence-transformers/gooaq
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
  - cosine_accuracy
model-index:
  - name: SentenceTransformer based on gabrielegabellone/all-mini-gooaq-4-epoch
    results:
      - task:
          type: triplet
          name: Triplet
        dataset:
          name: gooqa dev
          type: gooqa-dev
        metrics:
          - type: cosine_accuracy
            value: 0.9963600039482117
            name: Cosine Accuracy

SentenceTransformer based on gabrielegabellone/all-mini-gooaq-4-epoch

This is a sentence-transformers model finetuned from gabrielegabellone/all-mini-gooaq-4-epoch on the gooaq dataset. 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 Type: Sentence Transformer
  • Base model: gabrielegabellone/all-mini-gooaq-4-epoch
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:
  • Language: en

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, '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})
  (2): Normalize()
)

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("gabrielegabellone/all-mini-gooaq-60000-4-epoch")
# Run inference
sentences = [
    'what is usb c ss?',
    'The USB Type-C specification is pretty confusing. ... The standard USB logo to identify USB 2.0 ports or slower. "SS" markings, which stand for SuperSpeed, to identify USB 3.0 ports, otherwise known as USB 3.1 gen 1. "10" markings, which stand for 10 Gbps, to identify USB 3.1 gen 2 ports with ultra-fast connectivity.',
    '“Global warming” refers to the rise in global temperatures due mainly to the increasing concentrations of greenhouse gases in the atmosphere. “Climate change” refers to the increasing changes in the measures of climate over a long period of time – including precipitation, temperature, and wind patterns.',
]
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]

Evaluation

Metrics

Triplet

Metric Value
cosine_accuracy 0.9964

Training Details

Training Dataset

gooaq

  • Dataset: gooaq at b089f72
  • Size: 40,000 training samples
  • Columns: question and answer
  • Approximate statistics based on the first 1000 samples:
    question answer
    type string string
    details
    • min: 8 tokens
    • mean: 11.89 tokens
    • max: 21 tokens
    • min: 15 tokens
    • mean: 60.75 tokens
    • max: 175 tokens
  • Samples:
    question answer
    how to program a universal remote spectrum? ['Turn on your TV.', 'Using the remote control, press TV once and then press and hold SETUP until the TV key blinks twice.', 'Enter 9 9 1. The TV key blinks twice.', 'Press 1 (the device code digit for your TV). The TV key blinks twice. ... ', 'Press and release the CH+ key continuously, then stop when the TV turns off. ... ', 'Press POWER.']
    are plea bargains a violation of due process? The United States Supreme Court ruled that plea bargaining is constitutional and that it is an important aspect of the criminal procedure. ... Plea bargaining is said to have disregarded other aspects of the criminal justice system such as due process of the law which envisages a right to a full trial.
    does jz own the nets? Jay-Z purchased his stake in the Nets in January of 2004, investing a reported $1 million in the team. As of this fall, he held one-fifteenth of one percent of the Nets, according to the New York Times, but owned one fifth of one percent of the $1 billion Barclays Center.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Evaluation Dataset

gooaq

  • Dataset: gooaq at b089f72
  • Size: 5,000 evaluation samples
  • Columns: question and answer
  • Approximate statistics based on the first 1000 samples:
    question answer
    type string string
    details
    • min: 8 tokens
    • mean: 11.8 tokens
    • max: 21 tokens
    • min: 14 tokens
    • mean: 60.68 tokens
    • max: 123 tokens
  • Samples:
    question answer
    how much water should a person drink in 8 hours? Health authorities commonly recommend eight 8-ounce glasses, which equals about 2 liters, or half a gallon. This is called the 8×8 rule and is very easy to remember. However, some health gurus believe that you need to sip on water constantly throughout the day, even when you're not thirsty.
    what does this mean in excel #name? Important: The #NAME? error signifies that something needs to be corrected in the syntax, so when you see the error in your formula, resolve it. Do not use any error-handling functions such as IFERROR to mask the error. To avoid typos in formula names, use the Formula Wizard in Excel.
    are hydroflask good for the environment? Hydro Flasks are a new fad among many students and adults to help minimize plastic waste in the oceans. Hydro Flasks are great because they use a type of metal called TempShield, which keeps your beverage or food either hot for up to six hours or cold for up to twenty-four hours.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: epoch
  • per_device_train_batch_size: 256
  • per_device_eval_batch_size: 256
  • num_train_epochs: 4
  • warmup_ratio: 0.1
  • fp16: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: epoch
  • prediction_loss_only: True
  • per_device_train_batch_size: 256
  • per_device_eval_batch_size: 256
  • 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.0
  • num_train_epochs: 4
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • 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
  • 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: False
  • 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: False
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss Validation Loss gooqa-dev_cosine_accuracy
-1 -1 - - 0.9948
1.0 157 0.073 0.0522 0.9960
2.0 314 0.05 0.0489 0.9964
3.0 471 0.0386 0.0474 0.9962
4.0 628 0.0351 0.0474 0.9964
-1 -1 - - 0.9964

Framework Versions

  • Python: 3.11.13
  • Sentence Transformers: 4.1.0
  • Transformers: 4.54.0
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.9.0
  • Datasets: 4.0.0
  • Tokenizers: 0.21.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}
}