CoolFace
Modelpublic

InstalilyAI/sentence-transformer-synonyms

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes71downloads
Model Card

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 <!-- at revision c9745ed1d9f207416be6d2e6f8de32d1f16199bf -->
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

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:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
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]])

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

Unnamed Dataset
  • Size: 78,106 training samples
  • Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>label</code>
  • Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | label | |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:-----------------------------| | type | string | string | int | | details | <ul><li>min: 4 tokens</li><li>mean: 6.97 tokens</li><li>max: 16 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 7.08 tokens</li><li>max: 19 tokens</li></ul> | <ul><li>1: 100.00%</li></ul> |
  • Samples: | sentence1 | sentence2 | label | |:-----------------------------------------------------------|:-------------------------------------------|:---------------| | <code>Solid state relay contacts not making contact</code> | <code>Solid state relay not closing</code> | <code>1</code> | | <code>Single pole relay is stuck closed</code> | <code>Relay is stuck closed</code> | <code>1</code> | | <code>Relay potentially damaged due to wiring issue</code> | <code>Relay faulty</code> | <code>1</code> |
  • Loss: <code>OnlineContrastiveLoss</code>

Evaluation Dataset

Unnamed Dataset
  • Size: 818 evaluation samples
  • Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>label</code>
  • Approximate statistics based on the first 818 samples: | | sentence1 | sentence2 | label | |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 3 tokens</li><li>mean: 5.53 tokens</li><li>max: 10 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 5.93 tokens</li><li>max: 14 tokens</li></ul> | <ul><li>0: ~50.00%</li><li>1: ~50.00%</li></ul> |
  • Samples: | sentence1 | sentence2 | label | |:-------------------------------------------|:--------------------------------------------|:---------------| | <code>Power Relay needs replacement</code> | <code>relay needs replacement</code> | <code>1</code> | | <code>Target needs replacement</code> | <code>ceramic tile needs replacement</code> | <code>1</code> | | <code>install new Infinite Switch</code> | <code>install new inf switch</code> | <code>1</code> |
  • Loss: <code>OnlineContrastiveLoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • eval_strategy: epoch
  • per_device_train_batch_size: 256
  • per_device_eval_batch_size: 256
  • learning_rate: 1e-05
  • num_train_epochs: 4
  • warmup_ratio: 0.02
  • bf16: True
All Hyperparameters

<details><summary>Click to expand</summary>

  • 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: 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: 4
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.02
  • 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: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining LossValidation Loss
1.07-28.7758
2.014-20.5461
3.021-14.5468
4.028-12.2789
5.035-7.4563
6.042-4.7709
7.049-3.7263
8.056-3.2799
9.063-3.4937
10.070-3.3956
11.077-3.2518
12.084-2.4912
13.091-1.7859
14.098-1.4185
14.28571009.9923-
15.0105-1.4582
16.0112-1.4355
17.0119-1.2700
18.0126-0.9766
19.0133-0.9087
20.0140-0.8227
21.0147-0.7897
22.0154-0.6956
23.0161-0.7913
24.0168-0.7902
25.0175-0.7534
26.0182-0.6562
27.0189-0.5444
28.0196-0.4464
28.57142000.2576-
29.0203-0.4410
30.0210-0.4314
31.0217-0.3471
32.0224-0.3472
33.0231-0.3445
34.0238-0.3404
35.0245-0.3378
36.0252-0.3370
37.0259-0.3355
38.0266-0.3339
39.0273-0.3326
40.0280-0.3328
41.0287-0.3308
42.0294-0.3308
42.85713000.1918-
43.0301-0.3306
44.0308-0.3304
45.0315-0.3294
46.0322-0.3295
47.0329-0.3295
48.0336-0.3297
49.0343-0.3295
50.0350-0.3295
1.04-0.1957
2.08-0.1227
3.012-0.1132
4.016-0.0720
5.020-0.0629
6.024-0.0591
7.028-0.0
8.032-0.0
9.036-0.0
10.040-0.0
11.044-0.0
12.048-0.0
12.5500.441-
13.052-0.0
14.056-0.0
15.060-0.0
16.064-0.0
17.068-0.0
18.072-0.0
19.076-0.0
20.080-0.0
21.084-0.0
22.088-0.0
23.092-0.0
24.096-0.0
25.01000.33480.0
26.0104-0.0
27.0108-0.0
28.0112-0.0
29.0116-0.0
30.0120-0.0
0.65362007.707-
1.0306-0.7959
1.30724006.7597-
1.96086006.4126-
2.0612-1.0730
2.61448006.2623-
3.0918-1.1429
3.268010006.1651-
3.921612006.12-
4.01224-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
bibtex
@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",
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->