CoolFace
Modelpublic

AryehRotberg/ToS-Sentence-Transformers-V4

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes14downloads
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("AryehRotberg/ToS-Sentence-Transformers-V4")
# Run inference
sentences = [
    'The Services may contain links or connections to third party websites or services that are not owned or controlled by Guilded. When you access third party websites or use third party services, you accept that there are risks in doing so, and that Guilded is not responsible for such risks.',
    'This service assumes no responsibility and liability for the contents of links to other websites',
    'Copyright license limited for the purposes of that same service but transferable and sublicenseable',
]
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.6397, -0.0500],
#         [ 0.6397,  1.0000,  0.0874],
#         [-0.0500,  0.0874,  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. -->

Evaluation

Metrics

Triplet
MetricValue
cosine_accuracy0.9993

<!--

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: 122,856 training samples
  • —Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | anchor | positive | negative | |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 48.49 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 15.21 tokens</li><li>max: 29 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 14.34 tokens</li><li>max: 29 tokens</li></ul> |
  • —Samples: | anchor | positive | negative | |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------| | <code>If you ever decide to stop using Snapchat, you can just ask us to delete your account.</code> | <code>You have the right to leave this service at any time</code> | <code>Your personal information is used for many different purposes</code> | | <code>you forever waive and agree not to claim or assert any entitlement to any and all moral rights of an author in any of the User Content.</code> | <code>You waive your moral rights</code> | <code>You aren’t allowed to remove or edit user-generated content</code> | | <code>You agree and shall indemnify and hold Dailymotion- harmless from and against any liability, loss, damages (including punitive damages), claim, settlement payment, cost and expense, interest, award, judgment, diminution in value, fine, fee (including reasonable attorneys’ fees), and penalty, or other charge (including reasonable attorneys’ fees and all other cost of investigating, defending or asserting any claim for indemnification under these Terms) arising from or relating to (i) Your Content, (ii) Your violation of the Terms or any other policy of Dailymotion. (iii) Your use of the Dailymotion Service. and (iv) Your violation of any third party rights, including without limitation any copyright, property, publicity or privacy rights.</code> | <code>You agree to defend, indemnify, and hold the service harmless in case of a claim related to your use of the service</code> | <code>User-generated content can be blocked or censored for any reason</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 30,714 evaluation samples
  • —Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | anchor | positive | negative | |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 4 tokens</li><li>mean: 49.34 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 15.13 tokens</li><li>max: 29 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 14.28 tokens</li><li>max: 29 tokens</li></ul> |
  • —Samples: | anchor | positive | negative | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------| | <code>YOU AGREE THAT USE OF THE WEB SITE AND THE SERVICES IS AT YOUR SOLE RISK.</code> | <code>The service is provided 'as is' and to be used at your sole risk</code> | <code>The court of law governing the terms is in a jurisdiction that is friendlier to user privacy protection.</code> | | <code>If you continue to use our services after the changes have taken effect, it means that you agree to the changes.</code> | <code>Terms may be changed at any time</code> | <code>The service is only available in some countries approved by its government</code> | | <code>We may revise these Terms of Use or any of the other Terms from time to time. You are ,expected to check this page and our Terms from time to time to take notice of any changes</code> | <code>Terms may be changed at any time</code> | <code>Voice data is collected and shared with third-parties</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —learning_rate: 2e-05
  • —num_train_epochs: 1
  • —warmup_ratio: 0.1
  • —fp16: True
  • —batch_sampler: no_duplicates
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: steps
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —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: 2e-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: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.1
  • —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
  • —bf16: False
  • —fp16: True
  • —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}
  • —parallelism_config: None
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamwtorchfused
  • —optim_args: None
  • —adafactor: False
  • —group_by_length: False
  • —length_column_name: length
  • —project: huggingface
  • —trackio_space_id: trackio
  • —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: no
  • —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: True
  • —prompts: None
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining LossValidation Lossall-nli-dev_cosine_accuracy
-1-1--0.9426
0.01301001.42271.17090.9595
0.02602001.11780.91040.9727
0.03913000.94730.75460.9799
0.05214000.75590.64710.9853
0.06515000.66170.56840.9880
0.07816000.58570.50470.9899
0.09127000.57680.45780.9910
0.10428000.4930.42810.9921
0.11729000.48770.38990.9931
0.130210000.43150.35930.9939
0.143211000.38940.34580.9940
0.156312000.36810.32150.9945
0.169313000.35330.31510.9951
0.182314000.32420.30930.9949
0.195315000.3460.28200.9955
0.208416000.32120.26370.9960
0.221417000.28890.26010.9960
0.234418000.28550.24230.9960
0.247419000.26210.23960.9964
0.260520000.2650.22990.9968
0.273521000.24010.21910.9969
0.286522000.2540.21660.9966
0.299523000.25430.20360.9971
0.312524000.26670.19580.9973
0.325625000.22360.19370.9972
0.338626000.2320.18750.9974
0.351627000.20210.18060.9977
0.364628000.21470.17870.9974
0.377729000.19290.17270.9975
0.390730000.17780.17210.9977
0.403731000.20310.16780.9974
0.416732000.17840.16450.9978
0.429733000.1830.15930.9977
0.442834000.18780.15080.9979
0.455835000.19150.14780.9980
0.468836000.16110.14480.9983
0.481837000.16060.13850.9983
0.494938000.16040.14080.9984
0.507939000.17330.13270.9983
0.520940000.1590.12770.9986
0.533941000.15540.12550.9987
0.546942000.15460.12250.9985
0.560043000.15360.12220.9984
0.573044000.12530.11740.9987
0.586045000.1510.11370.9986
0.599046000.12930.11160.9988
0.612147000.12720.10930.9986
0.625148000.13260.10740.9985
0.638149000.1350.10440.9987
0.651150000.12530.10130.9989
0.664151000.14660.09950.9989
0.677252000.13780.09930.9991
0.690253000.12450.09590.9989
0.703254000.11240.09460.9989
0.716255000.09370.09260.9988
0.729356000.13780.09070.9990
0.742357000.12340.08890.9991
0.755358000.11530.08760.9991
0.768359000.11720.08650.9990
0.781460000.11350.08550.9992
0.794461000.11780.08340.9991
0.807462000.11950.08120.9991
0.820463000.10680.07950.9991
0.833464000.08240.07910.9992
0.846565000.11730.07680.9992
0.859566000.11660.07570.9992
0.872567000.11190.07550.9992
0.885568000.10170.07500.9993
0.898669000.11480.07450.9993
0.911670000.09760.07360.9993
0.924671000.09730.07280.9993
0.937672000.09840.07260.9993
0.950673000.09430.07230.9993
0.963774000.08250.07190.9993
0.976775000.09610.07160.9993
0.989776000.08930.07150.9993

Framework Versions

  • —Python: 3.12.11
  • —Sentence Transformers: 5.1.1
  • —Transformers: 4.57.0
  • —PyTorch: 2.8.0+cu126
  • —Accelerate: 1.10.1
  • —Datasets: 4.0.0
  • —Tokenizers: 0.22.1

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",
}
MultipleNegativesRankingLoss
bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

<!--

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. -->