CoolFace
Modelpublic

agentlans/multilingual-e5-small-aligned

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

SentenceTransformer based on intfloat/multilingual-e5-small

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

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: intfloat/multilingual-e5-small <!-- at revision fd1525a9fd15316a2d503bf26ab031a61d056e98 -->
  • 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")
# Run inference
sentences = [
    'What do they think it is that prevents the products of human ingenuity from being themselves, fruits of the tree of life, and hence, in some sense, obeying evolutionary rules?',
    'Կարծում եք ի՞նչն է խանգարում, որ մարդկային հնարամտության արդյունքները իրենք էլ լինեն կյանքի ծառի պտուղներ և այդպիսով ինչ-որ իմաստով ենթարկվեն էվոլուցիայի կանոններին:',
    '(Smiech) No dobre, idem do Ameriky.',
]
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: 867,042 training samples
  • Columns: <code>sentence0</code> and <code>sentence1</code>
  • Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | |:--------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 21.83 tokens</li><li>max: 177 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 24.92 tokens</li><li>max: 229 tokens</li></ul> |
  • Samples: | sentence0 | sentence1 | |:------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------| | <code>I like English best of all subjects.</code> | <code>Tykkään englannista eniten kaikista aineista.</code> | | <code>We shall offer negotiations. Quite right.</code> | <code>- Oferecer-nos-emos para negociar.</code> | | <code>It was soon learned that Zelaya had been taken to Costa Rica, where he continued to call himself as the legal head of state.</code> | <code>Al snel werd bekend dat Zelaya naar Costa Rica was overgebracht, waar hij zich nog steeds het officiële staatshoofd noemde.</code> |
  • Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • num_train_epochs: 1
  • 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: 8
  • per_device_eval_batch_size: 8
  • 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: 1
  • 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.00465000.0378
0.009210000.0047
0.013815000.006
0.018520000.0045
0.023125000.0027
0.027730000.005
0.032335000.0045
0.036940000.005
0.041545000.0066
0.046150000.0029
0.050755000.0041
0.055460000.0064
0.060065000.0044
0.064670000.0039
0.069275000.0025
0.073880000.0026
0.078485000.0036
0.083090000.0027
0.087795000.0015
0.0923100000.003
0.0969105000.0013
0.1015110000.002
0.1061115000.0038
0.1107120000.0017
0.1153125000.0029
0.1199130000.0032
0.1246135000.0036
0.1292140000.004
0.1338145000.0036
0.1384150000.0025
0.1430155000.0022
0.1476160000.0017
0.1522165000.0019
0.1569170000.0022
0.1615175000.0028
0.1661180000.0033
0.1707185000.0025
0.1753190000.0014
0.1799195000.0033
0.1845200000.0023
0.1891205000.0023
0.1938210000.0009
0.1984215000.0043
0.2030220000.0021
0.2076225000.0025
0.2122230000.0017
0.2168235000.0024
0.2214240000.0021
0.2261245000.0023
0.2307250000.0014
0.2353255000.0027
0.2399260000.0025
0.2445265000.0022
0.2491270000.0022
0.2537275000.0024
0.2583280000.0035
0.2630285000.0032
0.2676290000.0048
0.2722295000.0008
0.2768300000.0027
0.2814305000.004
0.2860310000.0013
0.2906315000.002
0.2953320000.0016
0.2999325000.0027
0.3045330000.0014
0.3091335000.0022
0.3137340000.0017
0.3183345000.0022
0.3229350000.0026
0.3275355000.003
0.3322360000.0022
0.3368365000.0022
0.3414370000.0018
0.3460375000.0028
0.3506380000.0018
0.3552385000.0037
0.3598390000.003
0.3645395000.002
0.3691400000.001
0.3737405000.0015
0.3783410000.0023
0.3829415000.0017
0.3875420000.0034
0.3921425000.0016
0.3967430000.0019
0.4014435000.0015
0.4060440000.0026
0.4106445000.0012
0.4152450000.0014
0.4198455000.0027
0.4244460000.0016
0.4290465000.0027
0.4337470000.0033
0.4383475000.0023
0.4429480000.0024
0.4475485000.0019
0.4521490000.0017
0.4567495000.004
0.4613500000.0036
0.4659505000.001
0.4706510000.0016
0.4752515000.0024
0.4798520000.0009
0.4844525000.0011
0.4890530000.0018
0.4936535000.0012
0.4982540000.0012
0.5029545000.0014
0.5075550000.0025
0.5121555000.0016
0.5167560000.0015
0.5213565000.002
0.5259570000.0008
0.5305575000.0017
0.5351580000.0015
0.5398585000.0009
0.5444590000.0019
0.5490595000.0014
0.5536600000.0028
0.5582605000.0014
0.5628610000.0032
0.5674615000.0013
0.5721620000.002
0.5767625000.0018
0.5813630000.0015
0.5859635000.0008
0.5905640000.0021
0.5951645000.0008
0.5997650000.002
0.6043655000.0023
0.6090660000.0022
0.6136665000.0013
0.6182670000.0011
0.6228675000.0014
0.6274680000.0027
0.6320685000.002
0.6366690000.0013
0.6413695000.0026
0.6459700000.0014
0.6505705000.0017
0.6551710000.0023
0.6597715000.0025
0.6643720000.0013
0.6689725000.0008
0.6735730000.0017
0.6782735000.0022
0.6828740000.0021
0.6874745000.0008
0.6920750000.0007
0.6966755000.0038
0.7012760000.0011
0.7058765000.0016
0.7105770000.0013
0.7151775000.0042
0.7197780000.0009
0.7243785000.0004
0.7289790000.0006
0.7335795000.0007
0.7381800000.0014
0.7428805000.002
0.7474810000.0017
0.7520815000.0014
0.7566820000.0015
0.7612825000.0013
0.7658830000.001
0.7704835000.0019
0.7750840000.0009
0.7797845000.0021
0.7843850000.0015
0.7889855000.001
0.7935860000.0008
0.7981865000.0039
0.8027870000.0018
0.8073875000.0009
0.8120880000.0018
0.8166885000.0008
0.8212890000.0007
0.8258895000.0009
0.8304900000.002
0.8350905000.001
0.8396910000.0007
0.8442915000.0008
0.8489920000.0021
0.8535925000.0013
0.8581930000.0009
0.8627935000.002
0.8673940000.0012
0.8719945000.0034
0.8765950000.0027
0.8812955000.0006
0.8858960000.002
0.8904965000.0005
0.8950970000.0009
0.8996975000.0007
0.9042980000.0015
0.9088985000.0006
0.9134990000.0004
0.9181995000.0006
0.92271000000.0031
0.92731005000.0013
0.93191010000.0024
0.93651015000.0006
0.94111020000.0017
0.94571025000.0007
0.95041030000.0012
0.95501035000.0011
0.95961040000.0007
0.96421045000.0004
0.96881050000.0021
0.97341055000.0027
0.97801060000.0016
0.98261065000.0022
0.98731070000.0017
0.99191075000.0009
0.99651080000.0008

</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.1.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",
}
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. -->