Edit model card

SentenceTransformer based on sentence-transformers/all-MiniLM-L12-v2

This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L12-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 Type: Sentence Transformer
  • Base model: sentence-transformers/all-MiniLM-L12-v2
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 384 tokens
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 128, '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("Trelis/all-MiniLM-L12-v2-ft-pairs")
# Run inference
sentences = [
    'Can an attacking player pass the ball into a defending player intentionally seeking a rebound or a restart of the Touch count?',
    ' a player enters the Field of Play but does not impede the scoring of a Try the \noffending player will be sent to the Sin Bin.\n17.8\tFollowing a Try, players may Interchange at will, without having to wait for the \nplayer to enter the Interchange Area, but must do so prior to the Tap being taken \nto recommence play.\n18\u2002 Penalty  \n18.1\tThe Tap must be performed in accordance with the Definitions.\nRuling = The Referee will instruct the offending Team to return to the Mark and perform the \nTap again.\n18.2\tFor Infringements that occur between seven (7) metre lines, the Mark for the \nPenalty Tap is at the point of Infringement unless otherwise indicated by the \nReferee. \n18.3\tFor Infringements that occur within the Seven Metre Zone the Tap must be \ntaken at the nearest seven (7) metre line.\n18.4\tFor Infringements that occur beyond the Field of Play or in the In-Goal Area \nthe Mark is seven (7) metres infield from the Sideline, or directly Forward of \nthe Infringement on the seven (7) metre line nearest the Infringement or at a \nposition indicated by the Referee.\n18.5\tThe Mark must be indicated by the Referee before a Penalty Tap is taken.\n18.6\tThe Penalty Tap must be performed without delay after the Referee indicates \nthe Mark.\nRuling = A Penalty to the non-offending team at the point of Infringement.\n18.7\tA player may perform a Rollball instead of a Penalty Tap and the player who \nreceives the ball does not become the Half.\n18.8\tIf the Defending Team is penalised three (3) times upon entering their Seven \nMetre Zone during a single Possession, the last offending player will be given an \nExclusion until the end of that Possession.\n18.9\tA Penalty Try is awarded if any action by a player, Team official or spectator, \ndeemed by the Referee to be contrary to the Rules or spirit of the game clearly \nprevents the Attacking Team from scoring a Try.\nFIT Playing Rules - 5th Edition\nCOPYRIGHT © Touch Football Australia 2020\n15\n19\u2002 Advantage  \n19.1\tWhere a Defending Team player is Offside at a Tap or',
    ' without delay.\nRuling = A Penalty to the non-offending team at the centre of the Halfway line.\n8\u2002 Match Duration  \n  \n8.1\tA match is 40 minutes in duration, consisting of two (2) x 20 minute halves with \na Half Time break.\n8.1.1\tThere is no time off for injury during a match.\n8.2\tLocal competition and tournament conditions may vary the duration of a match.\n8.3\tWhen time expires, play is to continue until the next Touch or Dead Ball and End \nof Play is signaled by the Referee. \n8.3.1\tShould a Penalty be awarded during this period, the Penalty is to be taken.\n8.4\tIf a match is abandoned in any circumstances other than those referred to in \nclause 24.1.6 the NTA or NTA competition provider in its sole discretion shall \ndetermine the result of the match.\n9\u2002 Possession  \n  \n9.1\tThe Team with the ball is entitled to six (6) Touches prior to a Change of \nPossession. \n9.2\tOn the Change of Possession due to an intercept, the first Touch will be zero (0) \nTouch. \n9.3\tFollowing the sixth Touch or a loss of Possession due to any other means, the \nball must be returned to the Mark without delay.\nRuling = A deliberate delay in the changeover procedure will result in a Penalty awarded to \nthe non-offending Team ten (10) metres Forward of the Mark for the Change of Possession.\n9.4\tIf the ball is dropped or passed and goes to ground during play, a Change of \nPossession results.\nRuling = The Mark for the Change of Possession is where the ball makes initial contact  with \nthe ground.\n9.5\tIf the ball, while still under the control of the Half, contacts the ground in the In-\nGoal Area, Possession is lost.\nRuling = Play will restart with a Rollball at the nearest point on the seven (7) metre line.\nFIT Playing Rules - 5th Edition\n8\nCOPYRIGHT © Touch Football Australia 2020\n9.6\tIf a player mishandles the ball and even if in an effort to gain control, the ball \nis accidentally knocked Forward into any other Player, a Change of Possession \nresults.\n10\u2002 The Touch  \n10.1\tA Touch may be made',
]
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 Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • learning_rate: 1e-05
  • num_train_epochs: 1
  • lr_scheduler_type: cosine
  • warmup_ratio: 0.3
  • bf16: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • learning_rate: 1e-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: 1
  • max_steps: -1
  • lr_scheduler_type: cosine
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.3
  • 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: True
  • 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}
  • 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: False
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • 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
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss loss
0.1364 6 7.9127 6.9307
0.2727 12 7.5286 6.2160
0.4091 18 6.479 5.4784
0.5455 24 5.9214 5.0664
0.6818 30 5.5053 4.9428
0.8182 36 5.7077 4.8511
0.9545 42 5.3669 4.8320

Framework Versions

  • Python: 3.10.12
  • Sentence Transformers: 3.0.1
  • Transformers: 4.41.2
  • PyTorch: 2.1.1+cu121
  • Accelerate: 0.31.0
  • Datasets: 2.17.1
  • Tokenizers: 0.19.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",
}

CoSENTLoss

@online{kexuefm-8847,
    title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
    author={Su Jianlin},
    year={2022},
    month={Jan},
    url={https://kexue.fm/archives/8847},
}
Downloads last month
9
Safetensors
Model size
33.4M params
Tensor type
F32
·

Finetuned from