saikasyap/xlm-roberta-base-multilingual-en-sa
SentenceTransformer based on FacebookAI/xlm-roberta-base
This is a sentence-transformers model finetuned from FacebookAI/xlm-roberta-base on the en-sa dataset. 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: FacebookAI/xlm-roberta-base <!-- at revision e73636d4f797dec63c3081bb6ed5c7b0bb3f2089 -->
- Maximum Sequence Length: 128 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
- en-sa <!-- - Language: Unknown --> <!-- - License: Unknown -->
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': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(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:
pip install -U sentence-transformersThen you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("saikasyap/xlm-roberta-base-multilingual-en-sa")
# Run inference
sentences = [
'Magazines and Periodicals that are published periodically.',
'पत्रिकाणां (Magazines) तथा नियतकालिकानां च (Periodicals) ग्राहकत्वस्य निर्वहणार्थम् उपयुज्यन्ते ।',
'"अस्योपरि नुदामश्चेत्, इदं पेन्-ड्रैव् मध्ये, विद्यमानानि सर्वाणि फैल्स् फोल्डर्स् च दर्शयति ।"',
]
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
Knowledge Distillation
- Dataset:
en-sa - Evaluated with <code>MSEEvaluator</code>
Translation
- Dataset:
en-sa - Evaluated with <code>TranslationEvaluator</code>
<!--
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
en-sa
- Dataset: en-sa
- Size: 257,886 training samples
- Columns: <code>english</code>, <code>non_english</code>, and <code>label</code>
- Approximate statistics based on the first 1000 samples: | | english | non_english | label | |:--------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:-------------------------------------| | type | string | string | list | | details | <ul><li>min: 12 tokens</li><li>mean: 34.23 tokens</li><li>max: 113 tokens</li></ul> | <ul><li>min: 14 tokens</li><li>mean: 49.72 tokens</li><li>max: 128 tokens</li></ul> | <ul><li>size: 768 elements</li></ul> |
- Samples: | english | non_english | label | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------| | <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>[-0.5880301594734192, -0.20026817917823792, 0.372330904006958, -0.9807565808296204, -0.35607191920280457, ...]</code> | | <code>The four sons of Shah Jahan all held governorships during their father's reign.<br></code> | <code>शाह्-जहाँ-नामकस्य चत्वारः पुत्राः, सर्वे पितुः शासनकाले शासकपदम् अधारयन्।<br></code> | <code>[-0.5090229511260986, 0.33517003059387207, 0.27507224678993225, -0.05707915127277374, -0.5126022100448608, ...]</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> | <code>[0.16507332026958466, -0.1722974181175232, 0.02585001103579998, 0.36087149381637573, -0.6401643753051758, ...]</code> |
- Loss: <code>MSELoss</code>
Evaluation Dataset
en-sa
- Dataset: en-sa
- Size: 1,000 evaluation samples
- Columns: <code>english</code>, <code>non_english</code>, and <code>label</code>
- Approximate statistics based on the first 1000 samples: | | english | non_english | label | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:-------------------------------------| | type | string | string | list | | details | <ul><li>min: 4 tokens</li><li>mean: 21.38 tokens</li><li>max: 68 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 27.89 tokens</li><li>max: 91 tokens</li></ul> | <ul><li>size: 768 elements</li></ul> |
- Samples: | english | non_english | label | |:-------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------| | <code>"""So they cast him out of the vineyard, and killed him. What therefore shall the lord of the vineyard do unto them?"""</code> | <code>ततस्ते तं क्षेत्राद् बहि र्निपात्य जघ्नुस्तस्मात् स क्षेत्रपतिस्तान् प्रति किं करिष्यति?</code> | <code>[-0.06878167390823364, -0.5150429606437683, -0.09011576324701309, -0.7458725571632385, 0.050420328974723816, ...]</code> | | <code>Avogadro application window opens.</code> | <code>Avogadro एप्लिकेशन् विण्डो उद्घट्यते ।</code> | <code>[0.9054689407348633, -0.2203768789768219, -0.19827595353126526, 0.23870715498924255, -0.3162331283092499, ...]</code> | | <code>Svangah: One whose limbs are beautiful.</code> | <code>स्वंग:यस्य अङ्गानि सुन्दराणि सन्ति</code> | <code>[0.6443825960159302, 0.4850354492664337, -0.4563218355178833, -0.4771449863910675, 0.6588209867477417, ...]</code> |
- Loss: <code>MSELoss</code>
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepslearning_rate: 2e-05num_train_epochs: 10warmup_ratio: 0.1
All Hyperparameters
<details><summary>Click to expand</summary>
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 8per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 10max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_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: Falsefp16: 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: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: Falsehub_always_push: Falsegradient_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: Nonedispatch_batches: Nonesplit_batches: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportional
</details>
Training Logs
<details><summary>Click to expand</summary>
</details>
Framework Versions
- Python: 3.10.17
- Sentence Transformers: 4.1.0
- Transformers: 4.46.3
- PyTorch: 2.2.0+cu121
- Accelerate: 1.1.1
- Datasets: 2.18.0
- Tokenizers: 0.20.3
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",
}MSELoss
@inproceedings{reimers-2020-multilingual-sentence-bert,
title = "Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2020",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/2004.09813",
}<!--
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. -->
