CoolFace
Modelpublic

agentlans/multilingual-e5-small-aligned-v2

sourceHugging Facemitupdated 2y agoView on Hugging Face
0likes105downloads
Model Card

SentenceTransformer based on agentlans/multilingual-e5-small-aligned

This is a sentence-transformers model finetuned from agentlans/multilingual-e5-small-aligned. 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.

  • One of the smallest multilingual embedding models on Huggingface
  • This model is aligned which means translations have similar embeddings compared to unrelated sentences
  • Finetuned on 1,000,000 randomly selected sentence pairs downloaded from Tatoeba 2024-09-26
  • Includes pairs where one or both sentences are non-English
  • For each pair, two negative examples were generated

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: agentlans/multilingual-e5-small-aligned <!-- at revision 2876d21d801703ad25135704219f92d970e48971 -->
  • Maximum Sequence Length: 512 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': 512, 'do_lower_case': False}) with Transformer model: 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("agentlans/multilingual-e5-small-aligned-v2")
# Run inference
sentences = [
    'Esta es mi amiga Rachel, fuimos al instituto juntos.',
    "Je n'ai pas encore pris ma décision.",
    'When applying to American universities, your TOEFL score is only one factor.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

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

<!--

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,000,000 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: 11.16 tokens</li><li>max: 55 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 12.27 tokens</li><li>max: 76 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.33</li><li>max: 1.0</li></ul> |
  • Samples: | sentence0 | sentence1 | label | |:------------------------------------------|:-----------------------------------------|:-----------------| | <code>Bring your friends with you.</code> | <code>Traga seus amigos com você.</code> | <code>1.0</code> | | <code>I've been there already.</code> | <code>Você tem algo mais barato?</code> | <code>0.0</code> | | <code>All my homework is done.</code> | <code>माझा सगळा होमवर्क झाला आहे.</code> | <code>1.0</code> |
  • Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • multi_dataset_batch_sampler: round_robin
All Hyperparameters

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

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • 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
  • num_train_epochs: 3
  • 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: 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: round_robin

</details>

Training Logs

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

EpochStepTraining Loss
0.00535000.835
0.010710000.7012
0.01615000.6765
0.021320000.4654
0.026725000.7546
0.03230000.6098
0.037335000.644
0.042740000.5318
0.04845000.5638
0.053350000.5556
0.058755000.5165
0.06460000.4083
0.069365000.4683
0.074770000.5414
0.0875000.4678
0.085380000.4225
0.090785000.4552
0.09690000.4551
0.101395000.4347
0.1067100000.292
0.112105000.4677
0.1173110000.3567
0.1227115000.4663
0.128120000.4333
0.1333125000.375
0.1387130000.4183
0.144135000.5745
0.1493140000.4569
0.1547145000.426
0.16150000.4903
0.1653155000.4287
0.1707160000.4375
0.176165000.377
0.1813170000.3848
0.1867175000.3366
0.192180000.3784
0.1973185000.399
0.2027190000.3798
0.208195000.3275
0.2133200000.3594
0.2187205000.3555
0.224210000.3565
0.2293215000.4264
0.2347220000.4138
0.24225000.3149
0.2453230000.3397
0.2507235000.359
0.256240000.3311
0.2613245000.3632
0.2667250000.366
0.272255000.2899
0.2773260000.2611
0.2827265000.3497
0.288270000.3534
0.2933275000.273
0.2987280000.3199
0.304285000.2527
0.3093290000.2755
0.3147295000.3684
0.32300000.347
0.3253305000.2537
0.3307310000.3665
0.336315000.2512
0.3413320000.2913
0.3467325000.2619
0.352330000.2573
0.3573335000.3036
0.3627340000.3388
0.368345000.2384
0.3733350000.31
0.3787355000.3461
0.384360000.378
0.3893365000.2409
0.3947370000.2969
0.4375000.2881
0.4053380000.3612
0.4107385000.2662
0.416390000.2796
0.4213395000.3298
0.4267400000.2828
0.432405000.2367
0.4373410000.2661
0.4427415000.393
0.448420000.2875
0.4533425000.203
0.4587430000.3211
0.464435000.3404
0.4693440000.315
0.4747445000.3018
0.48450000.2491
0.4853455000.2584
0.4907460000.2583
0.496465000.3447
0.5013470000.4332
0.5067475000.297
0.512480000.2697
0.5173485000.2349
0.5227490000.2176
0.528495000.2775
0.5333500000.2508
0.5387505000.291
0.544510000.2672
0.5493515000.2638
0.5547520000.2877
0.56525000.2758
0.5653530000.264
0.5707535000.2372
0.576540000.3384
0.5813545000.2459
0.5867550000.3047
0.592555000.1926
0.5973560000.2573
0.6027565000.2816
0.608570000.285
0.6133575000.2397
0.6187580000.1935
0.624585000.3281
0.6293590000.3306
0.6347595000.2067
0.64600000.2483
0.6453605000.2719
0.6507610000.2585
0.656615000.2385
0.6613620000.2229
0.6667625000.2311
0.672630000.2664
0.6773635000.209
0.6827640000.2643
0.688645000.2108
0.6933650000.3063
0.6987655000.1802
0.704660000.2285
0.7093665000.2065
0.7147670000.2467
0.72675000.2178
0.7253680000.2217
0.7307685000.2549
0.736690000.2026
0.7413695000.2609
0.7467700000.2393
0.752705000.1958
0.7573710000.2214
0.7627715000.2079
0.768720000.1574
0.7733725000.2356
0.7787730000.1864
0.784735000.257
0.7893740000.2149
0.7947745000.2519
0.8750000.2746
0.8053755000.2145
0.8107760000.2732
0.816765000.2456
0.8213770000.1841
0.8267775000.1876
0.832780000.2661
0.8373785000.1293
0.8427790000.2018
0.848795000.1854
0.8533800000.1644
0.8587805000.1844
0.864810000.1937
0.8693815000.1486
0.8747820000.244
0.88825000.131
0.8853830000.215
0.8907835000.2398
0.896840000.2014
0.9013845000.1703
0.9067850000.2009
0.912855000.1712
0.9173860000.2649
0.9227865000.2149
0.928870000.1912
0.9333875000.1902
0.9387880000.2609
0.944885000.1846
0.9493890000.1485
0.9547895000.2076
0.96900000.2449
0.9653905000.2025
0.9707910000.2635
0.976915000.2596
0.9813920000.2221
0.9867925000.2168
0.992930000.192
0.9973935000.1966
1.0027940000.2112
1.008945000.1628
1.0133950000.1059
1.0187955000.1403
1.024960000.1726
1.0293965000.1973
1.0347970000.1682
1.04975000.1319
1.0453980000.1427
1.0507985000.1448
1.056990000.1215
1.0613995000.1064
1.06671000000.0856
1.0721005000.1046
1.07731010000.1127
1.08271015000.0988
1.0881020000.1598
1.09331025000.1592
1.09871030000.1122
1.1041035000.0771
1.10931040000.1355
1.11471045000.1265
1.121050000.1464
1.12531055000.1578
1.13071060000.1017
1.13601065000.1047
1.14131070000.1865
1.14671075000.1721
1.1521080000.1096
1.15731085000.181
1.16271090000.1261
1.1681095000.1111
1.17331100000.1286
1.17871105000.1014
1.1841110000.1033
1.18931115000.1124
1.19471120000.1316
1.21125000.1147
1.20531130000.095
1.21071135000.1074
1.2161140000.1183
1.22131145000.1219
1.22671150000.1264
1.2321155000.1339
1.23731160000.0903
1.24271165000.0923
1.2481170000.1028
1.25331175000.093
1.25871180000.1024
1.2641185000.1107
1.26931190000.1078
1.27471195000.0469
1.281200000.107
1.28531205000.1578
1.29071210000.1012
1.2961215000.064
1.30131220000.0816
1.30671225000.0656
1.3121230000.1314
1.31731235000.1345
1.32271240000.1057
1.3281245000.1051
1.33331250000.1246
1.33871255000.0827
1.34401260000.0763
1.34931265000.0887
1.35471270000.1332
1.36001275000.0939
1.36531280000.087
1.37071285000.0671
1.3761290000.1377
1.38131295000.1066
1.38671300000.1224
1.3921305000.0797
1.39731310000.0712
1.40271315000.1141
1.4081320000.1045
1.41331325000.0894
1.41871330000.0897
1.4241335000.0779
1.42931340000.0944
1.43471345000.0674
1.441350000.1532
1.44531355000.0771
1.45071360000.1154
1.4561365000.1159
1.46131370000.147
1.46671375000.0925
1.4721380000.0985
1.47731385000.1023
1.48271390000.082
1.4881395000.0947
1.49331400000.0901
1.49871405000.127
1.5041410000.1584
1.50931415000.0734
1.51471420000.1065
1.521425000.0568
1.52531430000.1081
1.53071435000.0727
1.5361440000.1346
1.54131445000.0894
1.54671450000.0739
1.5521455000.0926
1.55731460000.0984
1.56271465000.0975
1.5681470000.0839
1.57331475000.1053
1.57871480000.1369
1.5841485000.093
1.58931490000.1008
1.59471495000.0981
1.61500000.1071
1.60531505000.0955
1.61071510000.0901
1.6161515000.0803
1.62131520000.1119
1.62671525000.0679
1.63201530000.1135
1.63731535000.0768
1.64271540000.0837
1.64801545000.0857
1.65331550000.0928
1.65871555000.0808
1.66401560000.0823
1.66931565000.0713
1.67471570000.0892
1.68001575000.0914
1.68531580000.0735
1.69071585000.0827
1.6961590000.1006
1.70131595000.0837
1.70671600000.0812
1.7121605000.1056
1.71731610000.0878
1.72271615000.0625
1.7281620000.0965
1.73331625000.1121
1.73871630000.0794
1.7441635000.0969
1.74931640000.0696
1.75471645000.083
1.761650000.0702
1.76531655000.0768
1.77071660000.0632
1.7761665000.0714
1.78131670000.1
1.78671675000.0665
1.7921680000.1139
1.79731685000.1032
1.80271690000.0983
1.8081695000.0812
1.81331700000.0996
1.81871705000.0872
1.82401710000.0612
1.82931715000.1038
1.83471720000.0558
1.84001725000.0595
1.84531730000.0558
1.85071735000.0717
1.85601740000.058
1.86131745000.0745
1.86671750000.0749
1.87201755000.074
1.87731760000.0792
1.88271765000.0574
1.8881770000.0968
1.89331775000.0755
1.89871780000.0852
1.9041785000.0502
1.90931790000.0699
1.91471795000.0793
1.921800000.113
1.92531805000.0708
1.93071810000.0815
1.9361815000.0962
1.94131820000.083
1.94671825000.0761
1.9521830000.0776
1.95731835000.0811
1.96271840000.1159
1.9681845000.081
1.97331850000.146
1.97871855000.0715
1.9841860000.12
1.98931865000.0692
1.99471870000.07
2.01875000.0935
2.00531880000.0848
2.01071885000.0474
2.0161890000.0417
2.02131895000.04
2.02671900000.1139
2.0321905000.0553
2.03731910000.0495
2.04271915000.0613
2.0481920000.0379
2.05331925000.0487
2.05871930000.0417
2.0641935000.0249
2.06931940000.0418
2.07471945000.043
2.081950000.051
2.08531955000.0339
2.09071960000.0519
2.0961965000.0878
2.10131970000.0432
2.10671975000.0185
2.1121980000.085
2.11731985000.0601
2.12271990000.0935
2.1281995000.0538
2.13332000000.0445
2.13872005000.0499
2.1442010000.1029
2.14932015000.0758
2.15472020000.0648
2.162025000.0612
2.16532030000.0618
2.17072035000.0566
2.1762040000.0179
2.18132045000.0557
2.18672050000.0321
2.1922055000.0562
2.19732060000.0673
2.20272065000.0286
2.2082070000.0284
2.21332075000.0595
2.21872080000.0693
2.2242085000.065
2.22932090000.0546
2.23472095000.0467
2.242100000.0353
2.24532105000.0475
2.25072110000.0451
2.25602115000.0348
2.26132120000.031
2.26672125000.0294
2.27202130000.0462
2.27732135000.0376
2.28272140000.0607
2.2882145000.041
2.29332150000.0462
2.29872155000.0285
2.3042160000.0177
2.30932165000.0577
2.31472170000.0368
2.322175000.041
2.32532180000.0469
2.33072185000.0669
2.3362190000.0288
2.34132195000.0283
2.34672200000.0293
2.3522205000.0364
2.35732210000.0431
2.36272215000.0478
2.3682220000.0223
2.37332225000.0464
2.37872230000.0598
2.3842235000.0716
2.38932240000.0445
2.39472245000.0356
2.42250000.0344
2.40532255000.0729
2.41072260000.0256
2.4162265000.0383
2.42132270000.0445
2.42672275000.0286
2.4322280000.0216
2.43732285000.0299
2.44272290000.0674
2.4482295000.0353
2.45332300000.0403
2.45872305000.0693
2.4642310000.0701
2.46932315000.0506
2.47472320000.0374
2.482325000.0511
2.48532330000.047
2.49072335000.0231
2.4962340000.0513
2.50132345000.0955
2.50672350000.049
2.5122355000.048
2.51732360000.0302
2.52272365000.0207
2.5282370000.0357
2.53332375000.0297
2.53872380000.0554
2.5442385000.0386
2.54932390000.0249
2.55472395000.0432
2.562400000.0539
2.56532405000.0348
2.57072410000.0233
2.5762415000.0702
2.58132420000.0393
2.58672425000.0625
2.5922430000.0197
2.59732435000.0399
2.60272440000.0495
2.6082445000.0407
2.61332450000.0412
2.61872455000.0234
2.6242460000.0559
2.62932465000.0555
2.63472470000.0328
2.642475000.0375
2.64532480000.0257
2.65072485000.0212
2.6562490000.0633
2.66132495000.0268
2.66672500000.0354
2.6722505000.0341
2.67732510000.0337
2.68272515000.0519
2.68802520000.0386
2.69332525000.0603
2.69872530000.0358
2.70402535000.0352
2.70932540000.0448
2.71472545000.037
2.72002550000.0375
2.72532555000.04
2.73072560000.0729
2.73602565000.0246
2.74132570000.045
2.74672575000.0333
2.7522580000.0212
2.75732585000.0458
2.76272590000.048
2.7682595000.0287
2.77332600000.0345
2.77872605000.0459
2.7842610000.0449
2.78932615000.0518
2.79472620000.0433
2.82625000.0572
2.80532630000.0357
2.81072635000.0394
2.8162640000.0531
2.82132645000.0294
2.82672650000.039
2.8322655000.0505
2.83732660000.0167
2.84272665000.031
2.8482670000.0362
2.85332675000.0246
2.85872680000.0317
2.8642685000.0296
2.86932690000.0297
2.87472695000.0517
2.882700000.019
2.88532705000.0358
2.89072710000.0589
2.8962715000.031
2.90132720000.0421
2.90672725000.0422
2.9122730000.016
2.91732735000.0645
2.92272740000.0514
2.9282745000.0173
2.93332750000.0432
2.93872755000.0594
2.9442760000.0228
2.94932765000.0152
2.95472770000.0579
2.962775000.0578
2.96532780000.0246
2.97072785000.0609
2.9762790000.0613
2.98132795000.0589
2.98672800000.047
2.9922805000.0264
2.99732810000.0464

</details>

Framework Versions

  • Python: 3.10.12
  • Sentence Transformers: 3.3.0
  • Transformers: 4.46.3
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.1.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",
}
CoSENTLoss
bibtex
@online{kexuefm-8847,
    title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
    author={Su Jianlin},
    year={2022},
    month={Jan},
    url={https://kexue.fm/archives/8847},
}

<!--

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