|
--- |
|
language: [] |
|
library_name: sentence-transformers |
|
tags: |
|
- sentence-transformers |
|
- sentence-similarity |
|
- feature-extraction |
|
- generated_from_trainer |
|
- dataset_size:853827 |
|
- loss:MatryoshkaLoss |
|
- loss:MultipleNegativesRankingLoss |
|
datasets: [] |
|
widget: |
|
- source_sentence: كيف يمكنني أن أخسر الوزن من خلال النظام الغذائي وتناول الطعام الصحي؟ |
|
sentences: |
|
- هل يمكن أن نحصل على (آركتشيب) في (بيغ فور) بعد إزالة كلتا المجموعتين بشكل منفصل؟ |
|
- ما هي سلسلة المطاعم الأمريكية الموجودة في النرويج؟ ما هو رأي النرويجيين عنها؟ |
|
- كيف لي أن أخسر الوزن من خلال النظام الغذائي فقط؟ |
|
- source_sentence: هل من المقبول أن تجيب على سؤالك؟ |
|
sentences: |
|
- ما هو أفضل كتاب على الإطلاق؟ |
|
- أي مسحوق بروتيني بدون آثار جانبية؟ |
|
- إذا أجبت على سؤالك الخاص على Quora، هل تصنيف إجابتك ينخفض؟ |
|
- source_sentence: كيف تحدد ما إذا كان البريد الإلكتروني قد تم فتحه من قبل المستلم؟ |
|
sentences: |
|
- لقد حصلت على 160 علامة في الامتحان الرئيسي ما هي فرص CSE في LNMIIT Jaipur؟ |
|
- امرأة تعزف على آلة موسيقية |
|
- كيف يمكن للمرء أن يتتبع ما إذا تم قراءة البريد الإلكتروني المرسل؟ |
|
- source_sentence: رجل وامرأة يتنزهان مع كلابهما |
|
sentences: |
|
- الزوجان يتنزهان مع كلابهما. |
|
- رجل وامرأة يتنزهون مع خنازيرهم |
|
- هل يمكنك الحصول على جسد مثالي بدون جهد؟ |
|
- source_sentence: يتم إنتاج أمثلة جميلة من المينا، والسيراميك، والفخار في وفرة كبيرة، |
|
وغالبا ما تتبع موضوع سلتيكي. |
|
sentences: |
|
- عملائنا بالكاد يستطيعون تحمل تكاليف مساعدتنا القانونية |
|
- يتم إنتاج الفخار الصغير الذي له موضوع سلتيكي. |
|
- يتم إنتاج عدد كبير من العناصر ذات المواضيع السلتية. |
|
pipeline_tag: sentence-similarity |
|
--- |
|
|
|
# SentenceTransformer |
|
|
|
This is a [sentence-transformers](https://www.SBERT.net) 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. |
|
|
|
## Model Details |
|
|
|
### Model Description |
|
- **Model Type:** Sentence Transformer |
|
<!-- - **Base model:** [Unknown](https://huggingface.co./unknown) --> |
|
- **Maximum Sequence Length:** 512 tokens |
|
- **Output Dimensionality:** 768 tokens |
|
- **Similarity Function:** Cosine Similarity |
|
- **Training Dataset:** |
|
- AbderrahmanSkiredj1/arabic_quora_duplicates_stsb_alue_holyquran_aranli_900k_anchor_positive_negative |
|
<!-- - **Language:** Unknown --> |
|
<!-- - **License:** Unknown --> |
|
|
|
### Model Sources |
|
|
|
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net) |
|
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers) |
|
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co./models?library=sentence-transformers) |
|
|
|
### Full Model Architecture |
|
|
|
``` |
|
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}) |
|
) |
|
``` |
|
|
|
## 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("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.* |
|
--> |
|
|
|
## Training Details |
|
|
|
### Training Dataset |
|
|
|
#### AbderrahmanSkiredj1/arabic_quora_duplicates_stsb_alue_holyquran_aranli_900k_anchor_positive_negative |
|
|
|
* Dataset: AbderrahmanSkiredj1/arabic_quora_duplicates_stsb_alue_holyquran_aranli_900k_anchor_positive_negative |
|
* Size: 853,827 training samples |
|
* Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code> |
|
* Approximate statistics based on the first 1000 samples: |
|
| | 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> | |
|
* Samples: |
|
| anchor | positive | negative | |
|
|:----------------------------------------------------------------------------------|:-------------------------------------------------------|:-------------------------------------------------------| |
|
| <code>هل يمكنك أن تأكل نفس الشيء كل يوم وتحصل على كل التغذية التي تحتاجها؟</code> | <code>هل الأكل نفس الشيء كل يوم صحي؟</code> | <code>ما هي القوة الخارقة التي تتمنى أن تملكها؟</code> | |
|
| <code>ثلاثة لاعبي كرة قدم، رقم 16 يرمي الكرة، رقم 71 يمنع الخصم الآخر.</code> | <code>لاعبي كرة القدم يرمون ويمنعون بعضهم البعض</code> | <code>الفريق يأكل البيتزا في مطعم</code> | |
|
| <code>كيف تحسن مهاراتك في الكتابة؟</code> | <code>كيف أستمر في تحسين كتابتي؟</code> | <code>كيف يتم تحديد أرقام الضمان الاجتماعي؟</code> | |
|
* Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters: |
|
```json |
|
{ |
|
"loss": "MultipleNegativesRankingLoss", |
|
"matryoshka_dims": [ |
|
768, |
|
512, |
|
256, |
|
128, |
|
64 |
|
], |
|
"matryoshka_weights": [ |
|
1, |
|
1, |
|
1, |
|
1, |
|
1 |
|
], |
|
"n_dims_per_step": -1 |
|
} |
|
``` |
|
|
|
### Evaluation Dataset |
|
|
|
#### AbderrahmanSkiredj1/arabic_quora_duplicates_stsb_alue_holyquran_aranli_900k_anchor_positive_negative |
|
|
|
* Dataset: AbderrahmanSkiredj1/arabic_quora_duplicates_stsb_alue_holyquran_aranli_900k_anchor_positive_negative |
|
* Size: 11,584 evaluation samples |
|
* Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code> |
|
* Approximate statistics based on the first 1000 samples: |
|
| | 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> | |
|
* Samples: |
|
| anchor | positive | negative | |
|
|:--------------------------------------------------------------------------------------|:----------------------------------------------------|:---------------------------------------------------------------------------| |
|
| <code>ماذا سيحدث لو توقفت الأرض عن الدوران وتدور في نفس الوقت؟</code> | <code>ماذا سيحدث إذا توقفت الأرض عن الدوران؟</code> | <code>ما هو أفضل هاتف ذكي تحت 15000؟</code> | |
|
| <code>ثلاثة متفرجين بالغين وطفل واحد ينظرون إلى السماء بينما يقفون على الرصيف.</code> | <code>أربعة أشخاص ينظرون إلى السماء.</code> | <code>رجل وثلاثة أطفال يشاهدون بالونات الهيليوم تطفو أعلى في الهواء</code> | |
|
| <code>ماذا تفعل الدول لمنع الحرب؟</code> | <code>كيف يجب على الدول أن تمنع الحرب؟</code> | <code>كيف يمكنني كسب المال من بدء مدونة؟</code> | |
|
* Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters: |
|
```json |
|
{ |
|
"loss": "MultipleNegativesRankingLoss", |
|
"matryoshka_dims": [ |
|
768, |
|
512, |
|
256, |
|
128, |
|
64 |
|
], |
|
"matryoshka_weights": [ |
|
1, |
|
1, |
|
1, |
|
1, |
|
1 |
|
], |
|
"n_dims_per_step": -1 |
|
} |
|
``` |
|
|
|
### Training Hyperparameters |
|
#### Non-Default Hyperparameters |
|
|
|
- `per_device_train_batch_size`: 64 |
|
- `per_device_eval_batch_size`: 64 |
|
- `learning_rate`: 1e-06 |
|
- `num_train_epochs`: 10 |
|
- `warmup_ratio`: 0.1 |
|
- `fp16`: True |
|
- `batch_sampler`: no_duplicates |
|
|
|
#### All Hyperparameters |
|
<details><summary>Click to expand</summary> |
|
|
|
- `overwrite_output_dir`: False |
|
- `do_predict`: False |
|
- `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 |
|
- `learning_rate`: 1e-06 |
|
- `weight_decay`: 0 |
|
- `adam_beta1`: 0.9 |
|
- `adam_beta2`: 0.999 |
|
- `adam_epsilon`: 1e-08 |
|
- `max_grad_norm`: 1.0 |
|
- `num_train_epochs`: 10 |
|
- `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 |
|
- `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`: True |
|
- `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`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False} |
|
- `fsdp_transformer_layer_cls_to_wrap`: None |
|
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True} |
|
- `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 |
|
- `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_sampler`: no_duplicates |
|
- `multi_dataset_batch_sampler`: proportional |
|
|
|
</details> |
|
|
|
### Training Logs |
|
| 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 | |
|
|
|
|
|
### Framework Versions |
|
- Python: 3.10.14 |
|
- Sentence Transformers: 3.0.1 |
|
- Transformers: 4.39.3 |
|
- PyTorch: 2.2.2+cu121 |
|
- Accelerate: 0.29.1 |
|
- Datasets: 2.18.0 |
|
- Tokenizers: 0.15.2 |
|
|
|
## 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", |
|
} |
|
``` |
|
|
|
#### MatryoshkaLoss |
|
```bibtex |
|
@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} |
|
} |
|
``` |
|
|
|
#### 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.* |
|
--> |