SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
This is a sentence-transformers model finetuned from sentence-transformers/all-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 Type: Sentence Transformer
- Base model: sentence-transformers/all-MiniLM-L6-v2
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 384 dimensions
- 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': 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})
)
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("manupande21/all-MiniLM-L6-v2-finetuned-triplets_2M")
# Run inference
sentences = [
'do employer rrsp contributions count as income',
'up vote 0 down vote accepted. Yes, the extra matching contribution your employer puts into your group RRSP plan is considered employment income and so yes it would be included in the income reported on your T4.owever, you should also receive from your RRSP plan administrator a contribution receipt, and the amount on that receipt should include both your contributions and the $500.',
'1 Although, higher tax rates may apply to your taxable contributions if you are a high income earner (ie income over $300,000). 2 Salary sacrifice can lower your taxable income When you salary sacrifice, your employer makes the extra contribution before income tax is taken out.',
]
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
- Dataset:
test-eval - Evaluated with
TripletEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy | 0.9828 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 1,600,000 training samples
- Columns:
sentence_0,sentence_1, andsentence_2 - Approximate statistics based on the first 1000 samples:
sentence_0 sentence_1 sentence_2 type string string string details - min: 4 tokens
- mean: 9.07 tokens
- max: 35 tokens
- min: 18 tokens
- mean: 78.28 tokens
- max: 187 tokens
- min: 19 tokens
- mean: 76.02 tokens
- max: 220 tokens
- Samples:
sentence_0 sentence_1 sentence_2 Factor analysis is a statistical procedure that can be used toFactor analysis is a statistical method used to describe variability among observed, correlated variables in terms of a potentially lower number of unobserved variables called factors.For example, it is possible that variations in four observed variables mainly reflect the variations in two unobserved variables.xploratory factor analysis (EFA) is used to identify complex interrelationships among items and group items that are part of unified concepts. The researcher makes no a priori assumptions about relationships among factors.When it comes to data analysis, some believe that statistical techniques are only applicable for quantitative data. This is not so. There are many statistical techniques that can be applied to qualitative data, such as ratings scales, that has been generated by a quantitative research approach.what county is northridge ca inNorthridge, CA. Northridge is located in south California. Northridge is part of Los Angeles County. On average, the public school district that covers Northridge is worse than the state average in quality. The Northridge area code is 818.Find Rialto, CA clerk, including county, city, and circuit clerk, and clerk of court. Clerks x California x San Bernardino County x Rialto x.where is denso auto parts madeWelcome. One of DENSO's largest international automotive operations is located in Maryville, Tennessee. DENSO Manufacturing Tennessee, Inc. is proud to be part of East Tennessee in one of the state's most historic counties. We are one of the region's largest employers.2006 Honda Element Tensioner Pulley and Serpentine Belt - Duration: 19:37. Auto Parts Direct To You 62,653 views - Loss:
TripletLosswith these parameters:{ "distance_metric": "TripletDistanceMetric.EUCLIDEAN", "triplet_margin": 5 }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepsper_device_train_batch_size: 128per_device_eval_batch_size: 128num_train_epochs: 5fp16: Truemulti_dataset_batch_sampler: round_robin
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 128per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 5max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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: Truefp16_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: Falseeval_on_start: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin
Training Logs
Click to expand
| Epoch | Step | Training Loss | test-eval_cosine_accuracy |
|---|---|---|---|
| 0.04 | 500 | 3.2317 | - |
| 0.08 | 1000 | 1.6755 | 0.9557 |
| 0.12 | 1500 | 1.3688 | - |
| 0.16 | 2000 | 1.236 | 0.9590 |
| 0.2 | 2500 | 1.1464 | - |
| 0.24 | 3000 | 1.1035 | 0.9611 |
| 0.28 | 3500 | 1.0254 | - |
| 0.32 | 4000 | 0.9914 | 0.9624 |
| 0.36 | 4500 | 0.9547 | - |
| 0.4 | 5000 | 0.9156 | 0.9642 |
| 0.44 | 5500 | 0.8922 | - |
| 0.48 | 6000 | 0.8565 | 0.9648 |
| 0.52 | 6500 | 0.8342 | - |
| 0.56 | 7000 | 0.8054 | 0.9667 |
| 0.6 | 7500 | 0.7731 | - |
| 0.64 | 8000 | 0.7567 | 0.9686 |
| 0.68 | 8500 | 0.7461 | - |
| 0.72 | 9000 | 0.7348 | 0.9699 |
| 0.76 | 9500 | 0.7155 | - |
| 0.8 | 10000 | 0.7016 | 0.9699 |
| 0.84 | 10500 | 0.6924 | - |
| 0.88 | 11000 | 0.6659 | 0.9711 |
| 0.92 | 11500 | 0.653 | - |
| 0.96 | 12000 | 0.6517 | 0.9717 |
| 1.0 | 12500 | 0.6402 | 0.9725 |
| 1.04 | 13000 | 0.5768 | 0.9721 |
| 1.08 | 13500 | 0.567 | - |
| 1.12 | 14000 | 0.5682 | 0.9731 |
| 1.16 | 14500 | 0.5554 | - |
| 1.2 | 15000 | 0.5513 | 0.9735 |
| 1.24 | 15500 | 0.55 | - |
| 1.28 | 16000 | 0.5339 | 0.9745 |
| 1.32 | 16500 | 0.532 | - |
| 1.3600 | 17000 | 0.5206 | 0.9749 |
| 1.4 | 17500 | 0.53 | - |
| 1.44 | 18000 | 0.5092 | 0.9754 |
| 1.48 | 18500 | 0.5096 | - |
| 1.52 | 19000 | 0.5061 | 0.9760 |
| 1.56 | 19500 | 0.5025 | - |
| 1.6 | 20000 | 0.4935 | 0.9764 |
| 1.6400 | 20500 | 0.4966 | - |
| 1.6800 | 21000 | 0.4816 | 0.9767 |
| 1.72 | 21500 | 0.4752 | - |
| 1.76 | 22000 | 0.473 | 0.9771 |
| 1.8 | 22500 | 0.4735 | - |
| 1.8400 | 23000 | 0.4548 | 0.9776 |
| 1.88 | 23500 | 0.4541 | - |
| 1.92 | 24000 | 0.4553 | 0.9780 |
| 1.96 | 24500 | 0.4469 | - |
| 2.0 | 25000 | 0.4508 | 0.9782 |
| 2.04 | 25500 | 0.3909 | - |
| 2.08 | 26000 | 0.3887 | 0.9784 |
| 2.12 | 26500 | 0.3885 | - |
| 2.16 | 27000 | 0.385 | 0.9783 |
| 2.2 | 27500 | 0.383 | - |
| 2.24 | 28000 | 0.3847 | 0.9791 |
| 2.2800 | 28500 | 0.3784 | - |
| 2.32 | 29000 | 0.3807 | 0.9791 |
| 2.36 | 29500 | 0.3749 | - |
| 2.4 | 30000 | 0.3746 | 0.9792 |
| 2.44 | 30500 | 0.3747 | - |
| 2.48 | 31000 | 0.3634 | 0.9796 |
| 2.52 | 31500 | 0.3711 | - |
| 2.56 | 32000 | 0.3733 | 0.9797 |
| 2.6 | 32500 | 0.3587 | - |
| 2.64 | 33000 | 0.3595 | 0.9797 |
| 2.68 | 33500 | 0.3609 | - |
| 2.7200 | 34000 | 0.3547 | 0.9802 |
| 2.76 | 34500 | 0.3606 | - |
| 2.8 | 35000 | 0.3503 | 0.9801 |
| 2.84 | 35500 | 0.356 | - |
| 2.88 | 36000 | 0.3431 | 0.9808 |
| 2.92 | 36500 | 0.3579 | - |
| 2.96 | 37000 | 0.352 | 0.9807 |
| 3.0 | 37500 | 0.3538 | 0.9807 |
| 3.04 | 38000 | 0.3072 | 0.9806 |
| 3.08 | 38500 | 0.3089 | - |
| 3.12 | 39000 | 0.3004 | 0.9810 |
| 3.16 | 39500 | 0.3066 | - |
| 3.2 | 40000 | 0.3184 | 0.9812 |
| 3.24 | 40500 | 0.3033 | - |
| 3.2800 | 41000 | 0.3055 | 0.9812 |
| 3.32 | 41500 | 0.2974 | - |
| 3.36 | 42000 | 0.3054 | 0.9814 |
| 3.4 | 42500 | 0.297 | - |
| 3.44 | 43000 | 0.2989 | 0.9816 |
| 3.48 | 43500 | 0.2982 | - |
| 3.52 | 44000 | 0.2911 | 0.9817 |
| 3.56 | 44500 | 0.2927 | - |
| 3.6 | 45000 | 0.3003 | 0.9819 |
| 3.64 | 45500 | 0.2953 | - |
| 3.68 | 46000 | 0.2951 | 0.9819 |
| 3.7200 | 46500 | 0.2875 | - |
| 3.76 | 47000 | 0.2947 | 0.9818 |
| 3.8 | 47500 | 0.2926 | - |
| 3.84 | 48000 | 0.2886 | 0.9821 |
| 3.88 | 48500 | 0.2902 | - |
| 3.92 | 49000 | 0.2881 | 0.9823 |
| 3.96 | 49500 | 0.293 | - |
| 4.0 | 50000 | 0.287 | 0.9823 |
| 4.04 | 50500 | 0.2668 | - |
| 4.08 | 51000 | 0.2612 | 0.9821 |
| 4.12 | 51500 | 0.2594 | - |
| 4.16 | 52000 | 0.2602 | 0.9824 |
| 4.2 | 52500 | 0.2623 | - |
| 4.24 | 53000 | 0.2593 | 0.9824 |
| 4.28 | 53500 | 0.2681 | - |
| 4.32 | 54000 | 0.2642 | 0.9826 |
| 4.36 | 54500 | 0.261 | - |
| 4.4 | 55000 | 0.2666 | 0.9825 |
| 4.44 | 55500 | 0.2628 | - |
| 4.48 | 56000 | 0.2598 | 0.9826 |
| 4.52 | 56500 | 0.2579 | - |
| 4.5600 | 57000 | 0.2622 | 0.9826 |
| 4.6 | 57500 | 0.2588 | - |
| 4.64 | 58000 | 0.2495 | 0.9827 |
| 4.68 | 58500 | 0.2642 | - |
| 4.72 | 59000 | 0.2558 | 0.9827 |
| 4.76 | 59500 | 0.2552 | - |
| 4.8 | 60000 | 0.2588 | 0.9827 |
| 4.84 | 60500 | 0.2658 | - |
| 4.88 | 61000 | 0.2577 | 0.9828 |
Framework Versions
- Python: 3.11.5
- Sentence Transformers: 4.1.0
- Transformers: 4.42.4
- PyTorch: 2.7.0+cu126
- Accelerate: 1.6.0
- Datasets: 3.5.0
- 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
- 3
Model tree for manupande21/all-MiniLM-L6-v2-finetuned-triplets_2M
Base model
sentence-transformers/all-MiniLM-L6-v2Evaluation results
- Cosine Accuracy on test evalself-reported0.983