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
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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-triplets-10q")
# Run inference
sentences = [
'What is the distance that players from the Defending Team must retire to at a Rollball?',
' \nan Attacking Team is permitted to Rollball on the seven (7) metre line at a point \ndirectly in line with where the Touch was made.\nFIT Playing Rules - 5th Edition\n12\nCOPYRIGHT © Touch Football Australia 2020\n14\u2002 Scoring \n14.1\tA Try is worth one (1) point. \n14.2\tA Try is awarded when a player, other than the Half, places the ball on or over \nthe Try Line without being Touched.\n14.3\tIn attempting to score a Try, a player must have control of the ball prior to \nplacing it on or over the Try Line.\n14.4\tIf a Player places the ball on the ground and releases it short of the Try Line \nwhile attempting to Score a Try, the Player is required to perform a Rollball to \nrestart play and a Touch is counted. If a Player does not release the Ball from \ntheir hands, the match continues and no Touch is counted. \n14.5\tAt the End of Play the team that has scored the most Tries is declared the \nWinner. In the event of neither team scoring, or in the event of both teams \nscoring the same number of Tries, a draw is declared.\n15\u2002 Offside \n15.1\tAt a Rollball, all players from the Defending Team must retire a distance of \nseven (7) metres or to the Defending Try Line as indicated by the Referee.\nRuling = A Penalty to the Attacking Team at the point of the Infringement or on the seven (7) \nmetre line directly Forward of the Infringement.\n15.2\tAt a Tap, all players from the Defending Team must retire a distance of ten (10) \nmetres from the Mark or to the Defending Try Line as indicated by the Referee.\nRuling = A Penalty to the Attacking Team at the point of the Infringement or on the ten (10) \nmetre line directly Forward of the Infringement.\n15.3\tAt a Rollball or Tap, players from the Defending Team must not retire an \nunreasonable distance beyond the Defending Try Line.\nRuling = A Penalty to the Attacking Team at the point of the Infringement or on the seven (7) \nmetre line directly Forward of the Infringement.\n15.4',
' 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',
]
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
: stepsper_device_train_batch_size
: 4per_device_eval_batch_size
: 4learning_rate
: 1e-05num_train_epochs
: 1lr_scheduler_type
: cosinewarmup_ratio
: 0.3
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 4per_device_eval_batch_size
: 4per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonelearning_rate
: 1e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 1max_steps
: -1lr_scheduler_type
: cosinelr_scheduler_kwargs
: {}warmup_ratio
: 0.3warmup_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
: Falseuse_ipex
: 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}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_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
: Falsehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseeval_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
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falsebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | loss |
---|---|---|---|
0.0417 | 2 | 4.9264 | - |
0.0833 | 4 | 4.8257 | - |
0.125 | 6 | 4.9006 | 4.8771 |
0.1667 | 8 | 4.8759 | - |
0.2083 | 10 | 4.9937 | - |
0.25 | 12 | 4.8677 | 4.8693 |
0.2917 | 14 | 4.8867 | - |
0.3333 | 16 | 4.8766 | - |
0.375 | 18 | 4.8604 | 4.8569 |
0.4167 | 20 | 4.8747 | - |
0.4583 | 22 | 4.7916 | - |
0.5 | 24 | 4.9293 | 4.8437 |
0.5417 | 26 | 4.8256 | - |
0.5833 | 28 | 4.7996 | - |
0.625 | 30 | 4.929 | 4.8354 |
0.6667 | 32 | 4.8513 | - |
0.7083 | 34 | 4.8432 | - |
0.75 | 36 | 4.7557 | 4.8297 |
0.7917 | 38 | 4.876 | - |
0.8333 | 40 | 4.8902 | - |
0.875 | 42 | 4.8303 | 4.8269 |
0.9167 | 44 | 4.8368 | - |
0.9583 | 46 | 4.9358 | - |
1.0 | 48 | 4.9286 | 4.8264 |
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.0.1
- Transformers: 4.41.2
- PyTorch: 2.3.1
- 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",
}
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}
}
- Downloads last month
- 14
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for Trelis/all-MiniLM-L12-v2-ft-triplets-10q
Base model
sentence-transformers/all-MiniLM-L12-v2