CoolFace
Modelpublic

vallabh001/xlm-roberta-base-multilingual-en-es

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

SentenceTransformer based on FacebookAI/xlm-roberta-base

This is a sentence-transformers model finetuned from FacebookAI/xlm-roberta-base on the en-es 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-es
  • —Languages: en, multilingual, ar, bg, ca, cs, da, de, el, es, et, fa, fi, fr, gl, gu, he, hi, hr, hu, hy, id, it, ja, ka, ko, ku, lt, lv, mk, mn, mr, ms, my, nb, nl, pl, pt, ro, ru, sk, sl, sq, sr, sv, th, tr, uk, ur, vi, zh <!-- - License: Unknown -->

Model Sources

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:

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("vallabh001/xlm-roberta-base-multilingual-en-es")
# Run inference
sentences = [
    'We need a different machine.',
    'Necesitamos una máquina diferente.',
    'Entonces, ¿dónde nos deja esto?',
]
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
MetricValue
negative_mse-10.1836
Translation
MetricValue
src2trg_accuracy0.9879
trg2src_accuracy0.9909
mean_accuracy0.9894
Semantic Similarity
MetricValue
pearson_cosine0.7671
spearman_cosine0.7903

<!--

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-es
  • —Dataset: en-es at 0c70bc6
  • —Size: 404,981 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: 4 tokens</li><li>mean: 25.77 tokens</li><li>max: 128 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 25.42 tokens</li><li>max: 128 tokens</li></ul> | <ul><li>size: 768 elements</li></ul> |
  • —Samples: | english | non_english | label | |:-------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------| | <code>And then there are certain conceptual things that can also benefit from hand calculating, but I think they're relatively small in number.</code> | <code>Y luego hay ciertas aspectos conceptuales que pueden beneficiarse del cálculo a mano pero creo que son relativamente pocos.</code> | <code>[-0.59398353099823, 0.9714106321334839, 0.6800687313079834, -0.21585586667060852, -0.7509507536888123, ...]</code> | | <code>One thing I often ask about is ancient Greek and how this relates.</code> | <code>Algo que pregunto a menudo es sobre el griego antiguo y cómo se relaciona.</code> | <code>[-0.09777131676673889, 0.07093200832605362, -0.42989036440849304, -0.1457505226135254, 1.4382765293121338, ...]</code> | | <code>See, the thing we're doing right now is we're forcing people to learn mathematics.</code> | <code>Vean, lo que estamos haciendo ahora es forzar a la gente a aprender matemáticas.</code> | <code>[0.39432215690612793, 0.1891053169965744, -0.3788300156593323, 0.438666433095932, 0.2727019190788269, ...]</code> |
  • —Loss: <code>MSELoss</code>

Evaluation Dataset

en-es
  • —Dataset: en-es at 0c70bc6
  • —Size: 990 evaluation samples
  • —Columns: <code>english</code>, <code>non_english</code>, and <code>label</code>
  • —Approximate statistics based on the first 990 samples: | | english | non_english | label | |:--------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:-------------------------------------| | type | string | string | list | | details | <ul><li>min: 4 tokens</li><li>mean: 26.42 tokens</li><li>max: 128 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 26.47 tokens</li><li>max: 128 tokens</li></ul> | <ul><li>size: 768 elements</li></ul> |
  • —Samples: | english | non_english | label | |:-----------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------| | <code>Thank you so much, Chris.</code> | <code>Muchas gracias Chris.</code> | <code>[-0.43312570452690125, 1.0602686405181885, -0.07791059464216232, -0.41704198718070984, 1.676845908164978, ...]</code> | | <code>And it's truly a great honor to have the opportunity to come to this stage twice; I'm extremely grateful.</code> | <code>Y es en verdad un gran honor tener la oportunidad de venir a este escenario por segunda vez. Estoy extremadamente agradecido.</code> | <code>[0.27005693316459656, 0.5391747951507568, -0.2580487132072449, -0.6613675951957703, 0.6738824248313904, ...]</code> | | <code>I have been blown away by this conference, and I want to thank all of you for the many nice comments about what I had to say the other night.</code> | <code>He quedado conmovido por esta conferencia, y deseo agradecer a todos ustedes sus amables comentarios acerca de lo que tenía que decir la otra noche.</code> | <code>[-0.2532017230987549, 0.04791336879134178, -0.1317490190267563, -0.7357572913169861, 0.23663584887981415, ...]</code> |
  • —Loss: <code>MSELoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 64
  • —per_device_eval_batch_size: 64
  • —learning_rate: 2e-05
  • —num_train_epochs: 5
  • —warmup_ratio: 0.1
  • —bf16: True
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: 64
  • —per_device_eval_batch_size: 64
  • —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: 5
  • —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
  • —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: False
  • —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: proportional

</details>

Training Logs

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

EpochStepTraining Lossen-es lossen-es_negative_mseen-es_mean_accuracysts17-es-en-test_spearman_cosine
0.01581000.6528----
0.03162000.5634----
0.04743000.4418----
0.06324000.3009----
0.07905000.2744----
0.09486000.2677----
0.11067000.2661----
0.12648000.2614----
0.14229000.2583----
0.158010000.2582----
0.173811000.2579----
0.189612000.256----
0.205413000.2511----
0.221214000.2467----
0.237015000.2423----
0.252816000.2364----
0.268617000.2305----
0.284518000.2248----
0.300319000.2184----
0.316120000.2143----
0.331921000.2098----
0.347722000.2055----
0.363523000.1999----
0.379324000.1965----
0.395125000.1919----
0.410926000.1889----
0.426727000.1858----
0.442528000.1826----
0.458329000.18----
0.474130000.1774----
0.489931000.1758----
0.505732000.1738----
0.521533000.1706----
0.537334000.1678----
0.553135000.1664----
0.568936000.1647----
0.584737000.163----
0.600538000.1605----
0.616339000.1594----
0.632140000.1576----
0.647941000.1561----
0.663742000.1541----
0.679543000.1545----
0.695344000.1535----
0.711145000.1523----
0.726946000.1502----
0.742747000.1487----
0.758548000.1486----
0.774349000.1477----
0.790150000.14650.1390-14.6819060.98030.6371
0.805951000.1469----
0.821752000.1449----
0.837553000.1437----
0.853454000.142----
0.869255000.1423----
0.885056000.1424----
0.900857000.1415----
0.916658000.1407----
0.932459000.1396----
0.948260000.1388----
0.964061000.1391----
0.979862000.1368----
0.995663000.1366----
1.011464000.1367----
1.027265000.1343----
1.043066000.1341----
1.058867000.1349----
1.074668000.1327----
1.090469000.1334----
1.106270000.133----
1.122071000.1316----
1.137872000.1308----
1.153673000.1316----
1.169474000.1298----
1.185275000.1294----
1.201076000.1295----
1.216877000.13----
1.232678000.1285----
1.248479000.1278----
1.264280000.1272----
1.280081000.1262----
1.295882000.1275----
1.311683000.1266----
1.327484000.1252----
1.343285000.1256----
1.359086000.1246----
1.374887000.1254----
1.390688000.1242----
1.406489000.1249----
1.422390000.1233----
1.438191000.1238----
1.453992000.1231----
1.469793000.122----
1.485594000.1217----
1.501395000.1225----
1.517196000.1213----
1.532997000.1208----
1.548798000.1214----
1.564599000.1205----
1.5803100000.120.1120-12.200760.98430.7137
1.5961101000.1205----
1.6119102000.12----
1.6277103000.1187----
1.6435104000.1184----
1.6593105000.1178----
1.6751106000.1188----
1.6909107000.1184----
1.7067108000.1168----
1.7225109000.1175----
1.7383110000.1158----
1.7541111000.1159----
1.7699112000.1178----
1.7857113000.1158----
1.8015114000.1161----
1.8173115000.1151----
1.8331116000.1147----
1.8489117000.1152----
1.8647118000.1144----
1.8805119000.1145----
1.8963120000.1144----
1.9121121000.1139----
1.9279122000.1144----
1.9437123000.1144----
1.9595124000.1124----
1.9753125000.1134----
1.9912126000.1133----
2.0070127000.1125----
2.0228128000.1108----
2.0386129000.1112----
2.0544130000.1109----
2.0702131000.1105----
2.0860132000.1112----
2.1018133000.1105----
2.1176134000.1105----
2.1334135000.11----
2.1492136000.1096----
2.1650137000.1098----
2.1808138000.1093----
2.1966139000.1089----
2.2124140000.1091----
2.2282141000.1091----
2.2440142000.1086----
2.2598143000.1089----
2.2756144000.1087----
2.2914145000.1083----
2.3072146000.1091----
2.3230147000.1083----
2.3388148000.1088----
2.3546149000.1071----
2.3704150000.10850.1015-11.2433250.98430.7625
2.3862151000.1077----
2.4020152000.1076----
2.4178153000.108----
2.4336154000.1066----
2.4494155000.1062----
2.4652156000.1065----
2.4810157000.1058----
2.4968158000.1071----
2.5126159000.1071----
2.5284160000.1066----
2.5442161000.1067----
2.5601162000.1057----
2.5759163000.106----
2.5917164000.1061----
2.6075165000.1047----
2.6233166000.1057----
2.6391167000.106----
2.6549168000.1055----
2.6707169000.105----
2.6865170000.1047----
2.7023171000.1042----
2.7181172000.1057----
2.7339173000.1051----
2.7497174000.1055----
2.7655175000.1047----
2.7813176000.1043----
2.7971177000.1034----
2.8129178000.1039----
2.8287179000.1038----
2.8445180000.1032----
2.8603181000.103----
2.8761182000.1035----
2.8919183000.1024----
2.9077184000.1032----
2.9235185000.1031----
2.9393186000.1034----
2.9551187000.1033----
2.9709188000.1036----
2.9867189000.1029----
3.0025190000.1024----
3.0183191000.1017----
3.0341192000.1012----
3.0499193000.1016----
3.0657194000.1012----
3.0815195000.1009----
3.0973196000.1015----
3.1131197000.1014----
3.1290198000.1004----
3.1448199000.1011----
3.1606200000.10060.0952-10.6624920.98790.7811
3.1764201000.1007----
3.1922202000.1015----
3.2080203000.1005----
3.2238204000.1017----
3.2396205000.1012----
3.2554206000.0998----
3.2712207000.0997----
3.2870208000.1001----
3.3028209000.1009----
3.3186210000.1----
3.3344211000.1001----
3.3502212000.1008----
3.3660213000.0996----
3.3818214000.0993----
3.3976215000.1004----
3.4134216000.0996----
3.4292217000.0993----
3.4450218000.0997----
3.4608219000.0997----
3.4766220000.0997----
3.4924221000.0984----
3.5082222000.0999----
3.5240223000.099----
3.5398224000.0992----
3.5556225000.0988----
3.5714226000.0989----
3.5872227000.0989----
3.6030228000.0978----
3.6188229000.0987----
3.6346230000.0997----
3.6504231000.0994----
3.6662232000.0984----
3.6820233000.0985----
3.6979234000.0983----
3.7137235000.0992----
3.7295236000.0983----
3.7453237000.0987----
3.7611238000.0983----
3.7769239000.0969----
3.7927240000.0984----
3.8085241000.0976----
3.8243242000.0984----
3.8401243000.0974----
3.8559244000.0982----
3.8717245000.0983----
3.8875246000.0986----
3.9033247000.0977----
3.9191248000.0974----
3.9349249000.0979----
3.9507250000.09740.0916-10.3304410.99040.7840
3.9665251000.0974----
3.9823252000.097----
3.9981253000.0978----
4.0139254000.0969----
4.0297255000.0966----
4.0455256000.0965----
4.0613257000.0974----
4.0771258000.0966----
4.0929259000.0964----
4.1087260000.0961----
4.1245261000.0958----
4.1403262000.0964----
4.1561263000.097----
4.1719264000.0967----
4.1877265000.0968----
4.2035266000.0965----
4.2193267000.0956----
4.2351268000.0963----
4.2509269000.0958----
4.2668270000.0969----
4.2826271000.0951----
4.2984272000.0958----
4.3142273000.0956----
4.3300274000.0965----
4.3458275000.0952----
4.3616276000.0956----
4.3774277000.0956----
4.3932278000.0966----
4.4090279000.0972----
4.4248280000.0954----
4.4406281000.0961----
4.4564282000.0963----
4.4722283000.0958----
4.4880284000.0961----
4.5038285000.0961----
4.5196286000.0956----
4.5354287000.0955----
4.5512288000.0957----
4.5670289000.0953----
4.5828290000.0952----
4.5986291000.0964----
4.6144292000.0955----
4.6302293000.0948----
4.6460294000.0946----
4.6618295000.0953----
4.6776296000.0954----
4.6934297000.0956----
4.7092298000.0958----
4.7250299000.0956----
4.7408300000.09620.0900-10.1836190.98940.7903
4.7566301000.0953----
4.7724302000.0959----
4.7882303000.0949----
4.8040304000.0958----
4.8198305000.0952----
4.8357306000.0952----
4.8515307000.095----
4.8673308000.0949----
4.8831309000.0949----
4.8989310000.0953----
4.9147311000.0955----
4.9305312000.0964----
4.9463313000.0955----
4.9621314000.0955----
4.9779315000.0954----
4.9937316000.0959----

</details>

Framework Versions

  • —Python: 3.10.12
  • —Sentence Transformers: 3.3.1
  • —Transformers: 4.46.3
  • —PyTorch: 2.5.1+cu124
  • —Accelerate: 1.2.1
  • —Datasets: 3.2.0
  • —Tokenizers: 0.20.3

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",
}
MSELoss
bibtex
@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. -->