CoolFace
Modelpublic

Bheri/ithasa-mmbert-mnrl-symmetric-ranking-loss

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes19downloads
Model Card

SentenceTransformer based on jhu-clsp/mmBERT-base

This is a sentence-transformers model finetuned from jhu-clsp/mmBERT-base. 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: jhu-clsp/mmBERT-base <!-- at revision c5955035435e2bf121cde7f3c8863ef52ff35d82 -->
  • —Maximum Sequence Length: 128 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': 128, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
  (1): Pooling({'word_embedding_dimension': 768, '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:

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 = [
    'attenuated vaccines:',
    'कम संवेदनशील टीकेः',
    '६.५% दसादशे',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.4339, 0.1781],
#         [0.4339, 1.0000, 0.2461],
#         [0.1781, 0.2461, 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

Translation
MetricValue
src2trg_accuracy0.636
trg2src_accuracy0.621
mean_accuracy0.6285

<!--

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,749,530 training samples
  • —Columns: <code>sentence1</code> and <code>sentence2</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | |:--------|:-----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 12 tokens</li><li>mean: 31.26 tokens</li><li>max: 88 tokens</li></ul> | <ul><li>min: 19 tokens</li><li>mean: 67.93 tokens</li><li>max: 128 tokens</li></ul> |
  • —Samples: | sentence1 | sentence2 | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>There was no Mughal tradition of primogeniture, the systematic passing of rule, upon an emperor's death, to his eldest son.<br></code> | <code>चक्रवर्तिनः मृत्योः अनन्तरं तस्य शासनस्य व्यवस्थितरूपेण सङ्क्रमणस्य, मुघलपरम्परायाः ज्येष्ठपुत्राधिकारपद्धतिः नासीत्।<br></code> | | <code>The four sons of Shah Jahan all held governorships during their father's reign.<br></code> | <code>शाह्-जहाँ-नामकस्य चत्वारः पुत्राः, सर्वे पितुः शासनकाले शासकपदम् अधारयन्।<br></code> | | <code>In this regard he discusses the correlation between social opportunities of education and health and how both of these complement economic and political freedoms as a healthy and well-educated person is better suited to make informed economic decisions and be involved in fruitful political demonstrations etc.<br></code> | <code>अस्मिन् विषये सः शिक्षणस्य स्वास्थ्यस्य च सामाजिकावकाशानाम् अन्योन्य-सम्बन्धस्य, तथा च एतद्द्वयम् अपि आर्थिक-राजनैतिक-स्वातन्त्र्ययोः कथं पूरकं भवतः इति च चर्चां करोति, यतोहि स्वस्था सुशिक्षिता च व्यक्तिः ज्ञानपूर्वम् आर्थिकविषयान् निर्णेतुं तथा फलप्रदेषु राजनैतिकेषु प्रतिपादनादिषु संलग्नः भवितुं च अधिकारी भवति इति।<br></code> |
  • —Loss: <code>MultipleNegativesSymmetricRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false,
      "directions": [
          "query_to_doc",
          "doc_to_query"
      ],
      "partition_mode": "per_direction",
      "hardness_mode": null,
      "hardness_strength": 0.0
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 1,000 evaluation samples
  • —Columns: <code>sentence1</code> and <code>sentence2</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | |:--------|:---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 5 tokens</li><li>mean: 11.9 tokens</li><li>max: 67 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 23.13 tokens</li><li>max: 128 tokens</li></ul> |
  • —Samples: | sentence1 | sentence2 | |:------------------------------------------------------------------------------------------|:------------------------------------------------------------| | <code>plus 2 tempered glass screen protectors:</code> | <code>6 पश्चात तापाभिसंतप्तॊ विदुर समार कर्शितः</code> | | <code>"Take sadaqah (alms) from their wealth in order to purify them with it." (p.</code> | <code>अप्येकाङ्गेऽप्यधोवस्तुमिच्छामि च सुकुत्सिते" ॥</code> | | <code>"Who could it possibly be?"</code> | <code>कश्च तासेः सम्भवति ?</code> |
  • —Loss: <code>MultipleNegativesSymmetricRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false,
      "directions": [
          "query_to_doc",
          "doc_to_query"
      ],
      "partition_mode": "per_direction",
      "hardness_mode": null,
      "hardness_strength": 0.0
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —per_device_train_batch_size: 32
  • —num_train_epochs: 5
  • —max_steps: 14000
  • —learning_rate: 2e-05
  • —warmup_steps: 500
  • —gradient_accumulation_steps: 4
  • —bf16: True
  • —eval_strategy: steps
  • —load_best_model_at_end: True
All Hyperparameters

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

  • —per_device_train_batch_size: 32
  • —num_train_epochs: 5
  • —max_steps: 14000
  • —learning_rate: 2e-05
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: None
  • —warmup_steps: 500
  • —optim: adamwtorchfused
  • —optim_args: None
  • —weight_decay: 0.0
  • —adam_beta1: 0.9
  • —adam_beta2: 0.999
  • —adam_epsilon: 1e-08
  • —optim_target_modules: None
  • —gradient_accumulation_steps: 4
  • —average_tokens_across_devices: True
  • —max_grad_norm: 1.0
  • —label_smoothing_factor: 0.0
  • —bf16: True
  • —fp16: False
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: None
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —torch_compile: False
  • —torch_compile_backend: None
  • —torch_compile_mode: None
  • —use_liger_kernel: False
  • —liger_kernel_config: None
  • —use_cache: False
  • —neftune_noise_alpha: None
  • —torch_empty_cache_steps: None
  • —auto_find_batch_size: False
  • —log_on_each_node: True
  • —logging_nan_inf_filter: True
  • —include_num_input_tokens_seen: no
  • —log_level: passive
  • —log_level_replica: warning
  • —disable_tqdm: False
  • —project: huggingface
  • —trackio_space_id: trackio
  • —eval_strategy: steps
  • —per_device_eval_batch_size: 8
  • —prediction_loss_only: True
  • —eval_on_start: False
  • —eval_do_concat_batches: True
  • —eval_use_gather_object: False
  • —eval_accumulation_steps: None
  • —include_for_metrics: []
  • —batch_eval_metrics: False
  • —save_only_model: False
  • —save_on_each_node: False
  • —enable_jit_checkpoint: False
  • —push_to_hub: False
  • —hub_private_repo: None
  • —hub_model_id: None
  • —hub_strategy: every_save
  • —hub_always_push: False
  • —hub_revision: None
  • —load_best_model_at_end: True
  • —ignore_data_skip: False
  • —restore_callback_states_from_checkpoint: False
  • —full_determinism: False
  • —seed: 42
  • —data_seed: None
  • —use_cpu: False
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —parallelism_config: None
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_pin_memory: True
  • —dataloader_persistent_workers: False
  • —dataloader_prefetch_factor: None
  • —remove_unused_columns: True
  • —label_names: None
  • —train_sampling_strategy: random
  • —length_column_name: length
  • —ddp_find_unused_parameters: None
  • —ddp_bucket_cap_mb: None
  • —ddp_broadcast_buffers: False
  • —ddp_backend: None
  • —ddp_timeout: 1800
  • —fsdp: []
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —deepspeed: None
  • —debug: []
  • —skip_memory_metrics: True
  • —do_predict: False
  • —resume_from_checkpoint: None
  • —warmup_ratio: None
  • —local_rank: -1
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

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

EpochStepTraining LossValidation Losseval-en-sa_mean_accuracy
0.00341003.1428--
0.00682002.8384--
0.01023001.9127--
0.01374001.2328--
0.01715000.9235--
0.02056000.7525--
0.02397000.6383--
0.02738000.5781--
0.03079000.5431--
0.034110000.50990.21680.5045
0.037611000.4946--
0.041012000.4831--
0.044413000.4315--
0.047814000.4351--
0.051215000.4243--
0.054616000.4082--
0.058017000.4048--
0.061418000.3915--
0.064919000.3954--
0.068320000.37460.15100.5775
0.071721000.3646--
0.075122000.3614--
0.078523000.3688--
0.081924000.3562--
0.085325000.3579--
0.088826000.3584--
0.092227000.3545--
0.095628000.3494--
0.099029000.3455--
0.102430000.33650.12960.5935
0.105831000.3327--
0.109232000.3241--
0.112733000.3335--
0.116134000.3271--
0.119535000.3167--
0.122936000.3158--
0.126337000.3241--
0.129738000.3354--
0.133139000.3311--
0.136640000.31940.11740.6125
0.140041000.3264--
0.143442000.3195--
0.146843000.3173--
0.150244000.3113--
0.153645000.3104--
0.157046000.3103--
0.160447000.3106--
0.163948000.3083--
0.167349000.3036--
0.170750000.30930.11360.618
0.174151000.3187--
0.177552000.3128--
0.180953000.3087--
0.184354000.3058--
0.187855000.3087--
0.191256000.3190--
0.194657000.3061--
0.198058000.3097--
0.201459000.3041--
0.204860000.30970.11100.6215
0.208261000.2996--
0.211762000.3103--
0.215163000.3004--
0.218564000.2992--
0.221965000.3086--
0.225366000.3137--
0.228767000.2971--
0.232168000.2835--
0.235569000.2971--
0.239070000.31330.10930.627
0.242471000.2988--
0.245872000.3024--
0.249273000.2983--
0.252674000.2950--
0.256075000.2948--
0.259476000.3031--
0.262977000.2890--
0.266378000.2983--
0.269779000.2960--
0.273180000.28990.10780.6245
0.276581000.3005--
0.279982000.2934--
0.283383000.2879--
0.286884000.3032--
0.290285000.2983--
0.293686000.3084--
0.297087000.2914--
0.300488000.3111--
0.303889000.2910--
0.307290000.29680.10730.629
0.310791000.2945--
0.314192000.2909--
0.317593000.2959--
0.320994000.3045--
0.324395000.2976--
0.327796000.2922--
0.331197000.2942--
0.334598000.3023--
0.338099000.2941--
0.3414100000.30550.1070.628
0.3448101000.2905--
0.3482102000.2926--
0.3516103000.2900--
0.3550104000.3027--
0.3584105000.3051--
0.3619106000.2956--
0.3653107000.2982--
0.3687108000.2877--
0.3721109000.2978--
0.3755110000.29560.10770.628
0.3789111000.2920--
0.3823112000.2927--
0.3858113000.2847--
0.3892114000.2914--
0.3926115000.2908--
0.3960116000.2908--
0.3994117000.2947--
0.4028118000.2996--
0.4062119000.3025--
0.4097120000.29750.10710.6285
0.4131121000.2832--
0.4165122000.2969--
0.4199123000.2964--
0.4233124000.2990--
0.4267125000.2950--
0.4301126000.2986--
0.4335127000.2961--
0.4370128000.2970--
0.4404129000.2966--
0.4438130000.30460.10720.628
0.4472131000.2903--
0.4506132000.2924--
0.4540133000.3010--
0.4574134000.3025--
0.4609135000.2831--
0.4643136000.2852--
0.4677137000.2863--
0.4711138000.3107--
0.4745139000.2935--
0.4779140000.29470.10710.6285
  • —The bold row denotes the saved checkpoint. </details>

Framework Versions

  • —Python: 3.10.18
  • —Sentence Transformers: 5.3.0
  • —Transformers: 5.3.0
  • —PyTorch: 2.8.0+cu128
  • —Accelerate: 1.12.0
  • —Datasets: 3.3.2
  • —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",
}
MultipleNegativesSymmetricRankingLoss
bibtex
@misc{günther2024jinaembeddings28192token,
      title={Jina Embeddings 2: 8192-Token General-Purpose Text Embeddings for Long Documents},
      author={Michael Günther and Jackmin Ong and Isabelle Mohr and Alaeddine Abdessalem and Tanguy Abel and Mohammad Kalim Akram and Susana Guzman and Georgios Mastrapas and Saba Sturua and Bo Wang and Maximilian Werk and Nan Wang and Han Xiao},
      year={2024},
      eprint={2310.19923},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2310.19923},
}

<!--

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