Downloads · 30 days
122
2% of all-time downloads
AbderrahmanSkiredj1/Arabic_text_embedding_for_sts
Arabic_text_embedding_for_sts is a sentence similarity model from AbderrahmanSkiredj1. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model trained on the AbderrahmanSkiredj1/arabicquoraduplicatesstsbalueholyquranaranli900kanchorpositivenegative dataset. It maps sentences & paragraphs to a 768-dimensional dense vector…
Downloads · 30 days
122
2% of all-time downloads
All-time downloads
5.3K
Public
Parameters
135M
541 MB on disk
Likes
6
Public
Click a slice to open those files.
.safetensors541 MB · 100%
From the Hugging Face model README
This is a sentence-transformers model trained on the AbderrahmanSkiredj1/arabic_quora_duplicates_stsb_alue_holyquran_aranli_900k_anchor_positive_negative 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.
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
(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})
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("AbderrahmanSkiredj1/Arabic_text_embedding_for_sts")
# Run inference
sentences = [
'يتم إنتاج أمثلة جميلة من المينا، والسيراميك، والفخار في وفرة كبيرة، وغالبا ما تتبع موضوع سلتيكي.',
'يتم إنتاج عدد كبير من العناصر ذات المواضيع السلتية.',
'يتم إنتاج الفخار الصغير الذي له موضوع سلتيكي.',
]
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.*
-->
<!--
## 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.*
-->
| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 4 tokens</li><li>mean: 14.54 tokens</li><li>max: 91 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 10.62 tokens</li><li>max: 43 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 10.32 tokens</li><li>max: 35 tokens</li></ul> |
| anchor | positive | negative |
|---|---|---|
| <code>هل يمكنك أن تأكل نفس الشيء كل يوم وتحصل على كل التغذية التي تحتاجها؟</code> | <code>هل الأكل نفس الشيء كل يوم صحي؟</code> | <code>ما هي القوة الخارقة التي تتمنى أن تملكها؟</code> |
| <code>ثلاثة لاعبي كرة قدم، رقم 16 يرمي الكرة، رقم 71 يمنع الخصم الآخر.</code> | <code>لاعبي كرة القدم يرمون ويمنعون بعضهم البعض</code> | <code>الفريق يأكل البيتزا في مطعم</code> |
| <code>كيف تحسن مهاراتك في الكتابة؟</code> | <code>كيف أستمر في تحسين كتابتي؟</code> | <code>كيف يتم تحديد أرقام الضمان الاجتماعي؟</code> |
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 3 tokens</li><li>mean: 16.03 tokens</li><li>max: 88 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 11.72 tokens</li><li>max: 221 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 10.59 tokens</li><li>max: 42 tokens</li></ul> |
| anchor | positive | negative |
|---|---|---|
| <code>ماذا سيحدث لو توقفت الأرض عن الدوران وتدور في نفس الوقت؟</code> | <code>ماذا سيحدث إذا توقفت الأرض عن الدوران؟</code> | <code>ما هو أفضل هاتف ذكي تحت 15000؟</code> |
| <code>ثلاثة متفرجين بالغين وطفل واحد ينظرون إلى السماء بينما يقفون على الرصيف.</code> | <code>أربعة أشخاص ينظرون إلى السماء.</code> | <code>رجل وثلاثة أطفال يشاهدون بالونات الهيليوم تطفو أعلى في الهواء</code> |
| <code>ماذا تفعل الدول لمنع الحرب؟</code> | <code>كيف يجب على الدول أن تمنع الحرب؟</code> | <code>كيف يمكنني كسب المال من بدء مدونة؟</code> |
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
per_device_train_batch_size: 64per_device_eval_batch_size: 64learning_rate: 1e-06num_train_epochs: 10warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 64per_device_eval_batch_size: 64per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonelearning_rate: 1e-06weight_decay: 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: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Truefp16_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: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True}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: Falsefp16_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_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss |
|---|---|---|
| 0.0120 | 40 | 3.1459 |
| 0.0240 | 80 | 3.2058 |
| 0.0360 | 120 | 3.0837 |
| 0.0480 | 160 | 3.1024 |
| 0.0600 | 200 | 3.015 |
| 0.0719 | 240 | 3.1311 |
| 0.0839 | 280 | 3.1101 |
| 0.0959 | 320 | 3.1288 |
| 0.1079 | 360 | 3.045 |
| 0.1199 | 400 | 3.0488 |
| 0.1319 | 440 | 3.1001 |
| 0.1439 | 480 | 3.2334 |
| 0.1559 | 520 | 3.0581 |
| 0.1679 | 560 | 2.9821 |
| 0.1799 | 600 | 3.1733 |
| 0.1918 | 640 | 3.0658 |
| 0.2038 | 680 | 3.0721 |
| 0.2158 | 720 | 3.1647 |
| 0.2278 | 760 | 3.0326 |
| 0.2398 | 800 | 3.1014 |
| 0.2518 | 840 | 2.9365 |
| 0.2638 | 880 | 3.0642 |
| 0.2758 | 920 | 2.9864 |
| 0.2878 | 960 | 3.0939 |
| 0.2998 | 1000 | 3.0676 |
| 0.3118 | 1040 | 2.9717 |
| 0.3237 | 1080 | 2.9908 |
| 0.3357 | 1120 | 2.9506 |
| 0.3477 | 1160 | 2.907 |
| 0.3597 | 1200 | 3.0451 |
| 0.3717 | 1240 | 3.0002 |
| 0.3837 | 1280 | 2.8842 |
| 0.3957 | 1320 | 3.0697 |
| 0.4077 | 1360 | 2.8967 |
| 0.4197 | 1400 | 3.0008 |
| 0.4317 | 1440 | 3.0027 |
| 0.4436 | 1480 | 2.9229 |
| 0.4556 | 1520 | 2.9539 |
| 0.4676 | 1560 | 2.9415 |
| 0.4796 | 1600 | 2.9401 |
| 0.4916 | 1640 | 2.8498 |
| 0.5036 | 1680 | 2.9646 |
| 0.5156 | 1720 | 2.9231 |
| 0.5276 | 1760 | 2.942 |
| 0.5396 | 1800 | 2.8521 |
| 0.5516 | 1840 | 2.8362 |
| 0.5635 | 1880 | 2.8497 |
| 0.5755 | 1920 | 2.8867 |
| 0.5875 | 1960 | 2.9148 |
| 0.5995 | 2000 | 2.9343 |
| 0.6115 | 2040 | 2.8537 |
| 0.6235 | 2080 | 2.7989 |
| 0.6355 | 2120 | 2.8508 |
| 0.6475 | 2160 | 2.916 |
| 0.6595 | 2200 | 2.926 |
| 0.6715 | 2240 | 2.752 |
| 0.6835 | 2280 | 2.7792 |
| 0.6954 | 2320 | 2.8381 |
| 0.7074 | 2360 | 2.7455 |
| 0.7194 | 2400 | 2.8953 |
| 0.7314 | 2440 | 2.8179 |
| 0.7434 | 2480 | 2.8471 |
| 0.7554 | 2520 | 2.7538 |
| 0.7674 | 2560 | 2.8271 |
| 0.7794 | 2600 | 2.8401 |
| 0.7914 | 2640 | 2.7402 |
| 0.8034 | 2680 | 2.6439 |
@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",
}
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@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.*
-->