CoolFace
Modelpublic

panagoa/LaBSE-kbd-v0.2

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes81downloads
Model Card

SentenceTransformer based on sentence-transformers/LaBSE

This is a sentence-transformers model finetuned from sentence-transformers/LaBSE. It maps sentences & paragraphs to a 768-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/LaBSE <!-- at revision b7f947194ceae0ddf90bafe213722569e274ad28 -->
  • —Maximum Sequence Length: 256 tokens
  • —Output Dimensionality: 768 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}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, '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): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
  (3): 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("panagoa/LaBSE-kbd-v0.2")
# Run inference
sentences = [
    "We've never seen Tom this angry before.",
    "Tom'u daha önce asla bu kadar öfkeli görmedik.",
    'Soyez attentive aux voleurs à la tire.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

<!--

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

Semantic Similarity
MetricValue
pearson_cosine-0.28
spearman_cosine-0.3212

<!--

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: 3,395,988 training samples
  • —Columns: <code>sentence0</code>, <code>sentence1</code>, and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | label | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 5 tokens</li><li>mean: 10.33 tokens</li><li>max: 50 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 13.81 tokens</li><li>max: 46 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.36</li><li>max: 0.98</li></ul> |
  • —Samples: | sentence0 | sentence1 | label | |:---------------------------------------|:--------------------------------------------|:--------------------------------| | <code>Почему вас это удивило?</code> | <code>Сыт ар щIывгъэщIэгъуар?</code> | <code>0.9298050403594972</code> | | <code>Ребёнка кто-нибудь видел?</code> | <code>Quelqu'un a-t-il vu l'enfant ?</code> | <code>0.0</code> | | <code>Marie se couchait.</code> | <code>Мэри гъуэлъырт.</code> | <code>0.9330472946166992</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —num_train_epochs: 2
  • —multi_dataset_batch_sampler: round_robin
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: 5e-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: 2
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.0
  • —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: False
  • —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
  • —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
  • —dispatch_batches: None
  • —split_batches: 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
  • —eval_use_gather_object: False
  • —average_tokens_across_devices: False
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: round_robin

</details>

Training Logs

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

EpochStepTraining Lossvalidation_spearman_cosine
0.0005100--0.7761
0.0009200--0.7598
0.0014300--0.7485
0.0019400--0.7412
0.00245000.2864-0.7354
0.0028600--0.7307
0.0033700--0.7191
0.0038800--0.7206
0.0042900--0.7197
0.004710000.0463-0.7037
0.00521100--0.6866
0.00571200--0.6798
0.00611300--0.6844
0.00661400--0.6716
0.007115000.0184-0.6658
0.00751600--0.6620
0.00801700--0.6532
0.00851800--0.6455
0.00901900--0.6452
0.009420000.011-0.6360
0.00992100--0.6240
0.01042200--0.6220
0.01082300--0.6294
0.01132400--0.6038
0.011825000.0092-0.6116
0.01222600--0.5996
0.01272700--0.6120
0.01322800--0.5940
0.01372900--0.5848
0.014130000.0071-0.5958
0.01463100--0.5840
0.01513200--0.5944
0.01553300--0.5895
0.01603400--0.5849
0.016535000.0056-0.5708
0.0005100--0.5686
0.0009200--0.5608
0.0014300--0.5587
0.00245000.0053-
0.004710000.0081-0.5882
0.007115000.0058-
0.009420000.0064-0.5127
0.011825000.004-
0.014130000.0042-0.4934
0.016535000.0048-
0.018840000.0036-0.4762
0.021245000.0051-
0.023650000.0054-0.4754
0.025955000.0054-
0.028360000.0054-0.4609
0.030665000.0044-
0.033070000.0048-0.4716
0.035375000.0061-
0.037780000.0018-0.4293
0.040085000.0047-
0.042490000.0043-0.4311
0.044895000.0034-
0.0471100000.0041-0.4429
0.0495105000.0028-
0.0518110000.0032-0.4324
0.0542115000.0025-
0.0565120000.0037-0.4374
0.0589125000.003-
0.0612130000.005-0.4522
0.0636135000.0051-
0.0660140000.0048-0.3994
0.0683145000.0034-
0.0707150000.0032-0.4148
0.0730155000.0046-
0.0754160000.0026-0.3848
0.0777165000.0036-
0.0801170000.0051-0.3845
0.0824175000.0031-
0.0848180000.0035-0.3500
0.0872185000.0028-
0.0895190000.0021-0.3634
0.0919195000.0025-
0.0942200000.0023-0.3428
0.0966205000.0042-
0.0989210000.0038-0.3432
0.1013215000.005-
0.1037220000.0024-0.3515
0.1060225000.0029-
0.1084230000.0033-0.3929
0.1107235000.003-
0.1131240000.0029-0.3309
0.1154245000.0038-
0.1178250000.0028-0.3369
0.1201255000.0025-
0.1225260000.002-0.3257
0.1249265000.0025-
0.1272270000.0033-0.3659
0.1296275000.0023-
0.1319280000.0031-0.3208
0.1343285000.0027-
0.1366290000.0031-0.3298
0.1390295000.0047-
0.1413300000.003-0.3460
0.1437305000.004-
0.1461310000.0027-0.3567
0.1484315000.0063-
0.1508320000.003-0.3382
0.1531325000.0022-
0.1555330000.0048-0.3475
0.1578335000.0021-
0.1602340000.0043-0.3323
0.1625345000.0031-
0.1649350000.0024-0.3207
0.1673355000.0029-
0.1696360000.0032-0.3004
0.1720365000.0046-
0.1743370000.0033-0.3085
0.1767375000.002-
0.1790380000.0022-0.3270
0.1814385000.0036-
0.1837390000.0034-0.3042
0.1861395000.0034-
0.1885400000.0016-0.3193
0.1908405000.0026-
0.1932410000.0028-0.2945
0.1955415000.0031-
0.1979420000.0016-0.2942
0.2002425000.0021-
0.2026430000.003-0.2998
0.2049435000.0042-
0.2073440000.0023-0.3245
0.2097445000.0018-
0.2120450000.0021-0.3212

</details>

Framework Versions

  • —Python: 3.11.11
  • —Sentence Transformers: 3.4.1
  • —Transformers: 4.48.3
  • —PyTorch: 2.5.1+cu124
  • —Accelerate: 1.3.0
  • —Datasets: 3.3.2
  • —Tokenizers: 0.21.0

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