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, 'architecture': '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("sentence_transformers_model_id")
# Run inference
sentences = [
'install new Actuator Switch',
'replace fan switch',
'replace hi limit switch',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.8039, 0.8263],
# [0.8039, 1.0000, 0.7918],
# [0.8263, 0.7918, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 78,106 training samples
- Columns:
sentence1,sentence2, andlabel - Approximate statistics based on the first 1000 samples:
sentence1 sentence2 label type string string int details - min: 4 tokens
- mean: 6.97 tokens
- max: 16 tokens
- min: 4 tokens
- mean: 7.08 tokens
- max: 19 tokens
- 1: 100.00%
- Samples:
sentence1 sentence2 label Solid state relay contacts not making contactSolid state relay not closing1Single pole relay is stuck closedRelay is stuck closed1Relay potentially damaged due to wiring issueRelay faulty1 - Loss:
OnlineContrastiveLoss
Evaluation Dataset
Unnamed Dataset
- Size: 818 evaluation samples
- Columns:
sentence1,sentence2, andlabel - Approximate statistics based on the first 818 samples:
sentence1 sentence2 label type string string int details - min: 3 tokens
- mean: 5.53 tokens
- max: 10 tokens
- min: 3 tokens
- mean: 5.93 tokens
- max: 14 tokens
- 0: ~50.00%
- 1: ~50.00%
- Samples:
sentence1 sentence2 label Power Relay needs replacementrelay needs replacement1Target needs replacementceramic tile needs replacement1install new Infinite Switchinstall new inf switch1 - Loss:
OnlineContrastiveLoss
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: epochper_device_train_batch_size: 256per_device_eval_batch_size: 256learning_rate: 1e-05num_train_epochs: 4warmup_ratio: 0.02bf16: True
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 256per_device_eval_batch_size: 256per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 1e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 4max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.02warmup_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: Truefp16: 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: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 1.0 | 7 | - | 28.7758 |
| 2.0 | 14 | - | 20.5461 |
| 3.0 | 21 | - | 14.5468 |
| 4.0 | 28 | - | 12.2789 |
| 5.0 | 35 | - | 7.4563 |
| 6.0 | 42 | - | 4.7709 |
| 7.0 | 49 | - | 3.7263 |
| 8.0 | 56 | - | 3.2799 |
| 9.0 | 63 | - | 3.4937 |
| 10.0 | 70 | - | 3.3956 |
| 11.0 | 77 | - | 3.2518 |
| 12.0 | 84 | - | 2.4912 |
| 13.0 | 91 | - | 1.7859 |
| 14.0 | 98 | - | 1.4185 |
| 14.2857 | 100 | 9.9923 | - |
| 15.0 | 105 | - | 1.4582 |
| 16.0 | 112 | - | 1.4355 |
| 17.0 | 119 | - | 1.2700 |
| 18.0 | 126 | - | 0.9766 |
| 19.0 | 133 | - | 0.9087 |
| 20.0 | 140 | - | 0.8227 |
| 21.0 | 147 | - | 0.7897 |
| 22.0 | 154 | - | 0.6956 |
| 23.0 | 161 | - | 0.7913 |
| 24.0 | 168 | - | 0.7902 |
| 25.0 | 175 | - | 0.7534 |
| 26.0 | 182 | - | 0.6562 |
| 27.0 | 189 | - | 0.5444 |
| 28.0 | 196 | - | 0.4464 |
| 28.5714 | 200 | 0.2576 | - |
| 29.0 | 203 | - | 0.4410 |
| 30.0 | 210 | - | 0.4314 |
| 31.0 | 217 | - | 0.3471 |
| 32.0 | 224 | - | 0.3472 |
| 33.0 | 231 | - | 0.3445 |
| 34.0 | 238 | - | 0.3404 |
| 35.0 | 245 | - | 0.3378 |
| 36.0 | 252 | - | 0.3370 |
| 37.0 | 259 | - | 0.3355 |
| 38.0 | 266 | - | 0.3339 |
| 39.0 | 273 | - | 0.3326 |
| 40.0 | 280 | - | 0.3328 |
| 41.0 | 287 | - | 0.3308 |
| 42.0 | 294 | - | 0.3308 |
| 42.8571 | 300 | 0.1918 | - |
| 43.0 | 301 | - | 0.3306 |
| 44.0 | 308 | - | 0.3304 |
| 45.0 | 315 | - | 0.3294 |
| 46.0 | 322 | - | 0.3295 |
| 47.0 | 329 | - | 0.3295 |
| 48.0 | 336 | - | 0.3297 |
| 49.0 | 343 | - | 0.3295 |
| 50.0 | 350 | - | 0.3295 |
| 1.0 | 4 | - | 0.1957 |
| 2.0 | 8 | - | 0.1227 |
| 3.0 | 12 | - | 0.1132 |
| 4.0 | 16 | - | 0.0720 |
| 5.0 | 20 | - | 0.0629 |
| 6.0 | 24 | - | 0.0591 |
| 7.0 | 28 | - | 0.0 |
| 8.0 | 32 | - | 0.0 |
| 9.0 | 36 | - | 0.0 |
| 10.0 | 40 | - | 0.0 |
| 11.0 | 44 | - | 0.0 |
| 12.0 | 48 | - | 0.0 |
| 12.5 | 50 | 0.441 | - |
| 13.0 | 52 | - | 0.0 |
| 14.0 | 56 | - | 0.0 |
| 15.0 | 60 | - | 0.0 |
| 16.0 | 64 | - | 0.0 |
| 17.0 | 68 | - | 0.0 |
| 18.0 | 72 | - | 0.0 |
| 19.0 | 76 | - | 0.0 |
| 20.0 | 80 | - | 0.0 |
| 21.0 | 84 | - | 0.0 |
| 22.0 | 88 | - | 0.0 |
| 23.0 | 92 | - | 0.0 |
| 24.0 | 96 | - | 0.0 |
| 25.0 | 100 | 0.3348 | 0.0 |
| 26.0 | 104 | - | 0.0 |
| 27.0 | 108 | - | 0.0 |
| 28.0 | 112 | - | 0.0 |
| 29.0 | 116 | - | 0.0 |
| 30.0 | 120 | - | 0.0 |
| 0.6536 | 200 | 7.707 | - |
| 1.0 | 306 | - | 0.7959 |
| 1.3072 | 400 | 6.7597 | - |
| 1.9608 | 600 | 6.4126 | - |
| 2.0 | 612 | - | 1.0730 |
| 2.6144 | 800 | 6.2623 | - |
| 3.0 | 918 | - | 1.1429 |
| 3.2680 | 1000 | 6.1651 | - |
| 3.9216 | 1200 | 6.12 | - |
| 4.0 | 1224 | - | 1.2153 |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.11.0rc1
- Sentence Transformers: 5.0.0
- Transformers: 4.53.1
- PyTorch: 2.7.1+cu126
- Accelerate: 1.8.1
- Datasets: 3.6.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",
}
- Downloads last month
- 1
Model tree for InstalilyAI/sentence-transformer-synonyms
Base model
sentence-transformers/all-MiniLM-L6-v2