Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 13
How to use Abdelkareem/Abjd with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Abdelkareem/Abjd")
sentences = [
"التطبيق الثاني، النادر، هو عندما يتم التشكيك في تأكيد عام أو عالمي للغاية، ونحن قادرون على اختباره من خلال فحص حالة واحدة.",
"هناك على الأقل تطبيقان يمكن استخدامهما.",
"كلية الثالوث تأسست كمركز للتعلم البروتستانتي.",
"التطبيق الثاني ليس نادرًا على الإطلاق ويتم استخدامه عادة."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from tomaarsen/Qwen3-Embedding-0.6B-18-layers. It maps sentences & paragraphs to a 1024-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: Qwen3Model
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': True, 'include_prompt': True})
(2): Normalize()
)
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("Abdelkareem/ara-qwen3-18")
# Run inference
sentences = [
'إذا كنت تساوم على سجادة في البازار الكبير سوف تحصل على خلال اثنين أو ثلاثة أكواب من كاي قبل أن يتم الاتفاق على سعر.',
'قبل الموافقة على السعر سوف تتناولين كوبين أو ثلاثة من الخمر',
'لا يمكنك المساومة على سجادة في البازار الكبير',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
all-nli-dev and 1million-qwen-18TripletEvaluator| Metric | all-nli-dev | 1million-qwen-18 |
|---|---|---|
| cosine_accuracy | 0.92 | 0.9178 |
anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| anchor | positive | negative |
|---|---|---|
الناس يقاتلون |
رجلين يضربان بعضهما في الوجه في مباراة ملاكمة |
رجلين يمشون على السقالة |
ما هو الحد الذي يصف المسافة من مركز الدائرة إلى أي نقطة على الدائرة؟ |
مثال على مركز الدائرة. 1 المسافة الثابتة من مركز الدائرة إلى أي نقطة على الدائرة تسمى نصف قطر الدائرة. 2 قطر الدائرة هو قطعة مستقيمة تربط نقطتين على دائرة ويمر بمركز الدائرة. |
قطر الدائرة هو المسافة من نقطة على الدائرة إلى نقطة راديان بعيدة ، وهو أقصى مسافة من نقطة على دائرة إلى أخرى. |
تم تحويل مخزن الحبوب في القرن الثالث عشر ، بجانب طاحونة دقيق أقدم ، إلى متحف رائع لرؤوس الأبراج المنحوتة المعروضة على أعمدة أعيد بناؤها. |
يمكن للزوار أن يروا العواصم المنحوتة في الدير في المتحف الذي كان يوما مخزن الحبوب. |
مخزن الحبوب من القرن الثالث عشر تم التخلي عنه ولم يعد أحد يستخدمه لأي شيء |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| anchor | positive | negative |
|---|---|---|
في تعريف السكان المعرضين للخطر |
في الطبيعة المحددة للسكان المعرضين للخطر ، يشير المصطلح إلى عملية أو سلسلة من الأحداث التي يمكن التنبؤ بها والتي تضع المجموعة المعلنة في مسار بعض الضرر المستقبلي. نظرًا لأن المصطلح قد تم استبعاده من السياق ، فليس لدينا أي طريقة للتعامل مع تفاصيل عملية أو حدث المخاطرة. المجموعات السكانية الخاصة) ، والتي لها عوامل فردية أو مركبة تجعلها عرضة لنتائج سيئة. من الواضح أن العوامل تختلف باختلاف فئة الخطر. |
تعتمد الممارسة الإحصائية الناجحة على تعريف المشكلة المركّز. في أخذ العينات ، يتضمن ذلك تحديد المجتمع الذي يتم أخذ العينة منه. يمكن تعريف المجتمع على أنه يشمل جميع الأشخاص أو العناصر التي لها الصفة المميزة التي يرغب المرء في فهمها. |
ومع ذلك، فإن العديد من الأنشطة باللغة العبرية فقط. |
الكثير من الأنشطة متاحة فقط باللغة العبرية. |
كل شيء كان باللغة الإنجليزية |
هل جاذبية المشتري أقوى من الأرض |
نتيجة لذلك ، تبلغ جاذبية سطح المشتري (التي تُعرَّف على أنها قوة الجاذبية عند قمم السحابة) 24.79 م / ث ، أو 2.528 جم. الجاذبية على زحل: مثل كوكب المشتري ، زحل هو عملاق غازي ضخم أكبر بكثير وأكثر كتلة من الأرض ، ولكنه أقل كثافة بكثير. باختصار ، متوسط نصف قطرها هو 58232 ± 6 كم (9.13 من الأرض) ، وكتلتها 5.6846 × 1026 كجم (95.15 مرة من الكتلة) ، وبكثافة 0.687 جم / سم 3. |
على الأرض: تسارع الجاذبية. . . . . . . . . . . . 9.807 م / ث 2 تسارع مقارنة بكوكب الزهرة. . 111٪ تسارع مقارنة بالمريخ. . . 263.5٪ كتلة الرجل الذي يزن 100 رطل على وجه الأرض. . . . . 45.359 كجم وزن الرجل الذي يزن 100 رطل على كوكب الزهرة. . 110.7 رطل وزن الرجل الذي يزن 100 رطل على المريخ. . . 263.5 رطل على الزهرة: تسارع الجاذبية. . . . . . . . . . 8.858 م / ث 2 تسارع مقارنة بالأرض. . 90.3٪ تسارع مقارنة بـ ... |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepslearning_rate: 2e-05num_train_epochs: 1warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 8per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_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: Falserestore_callback_states_from_checkpoint: 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, 'non_blocking': False, 'gradient_accumulation_kwargs': None}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: Nonehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | Validation Loss | all-nli-dev_cosine_accuracy | 1million-qwen-18_cosine_accuracy |
|---|---|---|---|---|---|
| -1 | -1 | - | - | 0.8039 | - |
| 0.0096 | 100 | 0.7579 | - | - | - |
| 0.0192 | 200 | 0.6067 | - | - | - |
| 0.0288 | 300 | 0.5796 | - | - | - |
| 0.0384 | 400 | 0.53 | - | - | - |
| 0.0480 | 500 | 0.5191 | - | - | - |
| 0.0577 | 600 | 0.5275 | - | - | - |
| 0.0673 | 700 | 0.5512 | - | - | - |
| 0.0769 | 800 | 0.5102 | - | - | - |
| 0.0865 | 900 | 0.5531 | - | - | - |
| 0.0961 | 1000 | 0.5475 | - | - | - |
| 0.1057 | 1100 | 0.5257 | - | - | - |
| 0.1153 | 1200 | 0.5233 | - | - | - |
| 0.1249 | 1300 | 0.5011 | - | - | - |
| 0.1345 | 1400 | 0.5626 | - | - | - |
| 0.1441 | 1500 | 0.527 | - | - | - |
| 0.1537 | 1600 | 0.4856 | - | - | - |
| 0.1634 | 1700 | 0.5102 | - | - | - |
| 0.1730 | 1800 | 0.4915 | - | - | - |
| 0.1826 | 1900 | 0.4725 | - | - | - |
| 0.1922 | 2000 | 0.4936 | - | - | - |
| 0.2018 | 2100 | 0.4771 | - | - | - |
| 0.2114 | 2200 | 0.5027 | - | - | - |
| 0.2210 | 2300 | 0.4802 | - | - | - |
| 0.2306 | 2400 | 0.5123 | - | - | - |
| 0.2402 | 2500 | 0.4633 | - | - | - |
| 0.2498 | 2600 | 0.4413 | - | - | - |
| 0.2594 | 2700 | 0.4486 | - | - | - |
| 0.2690 | 2800 | 0.4743 | - | - | - |
| 0.2787 | 2900 | 0.4082 | - | - | - |
| 0.2883 | 3000 | 0.4879 | - | - | - |
| 0.2979 | 3100 | 0.4499 | - | - | - |
| 0.3075 | 3200 | 0.4273 | - | - | - |
| 0.3171 | 3300 | 0.4311 | - | - | - |
| 0.3267 | 3400 | 0.431 | - | - | - |
| 0.3363 | 3500 | 0.4339 | - | - | - |
| 0.3459 | 3600 | 0.4189 | - | - | - |
| 0.3555 | 3700 | 0.433 | - | - | - |
| 0.3651 | 3800 | 0.434 | - | - | - |
| 0.3747 | 3900 | 0.4416 | - | - | - |
| 0.3844 | 4000 | 0.4024 | - | - | - |
| 0.3940 | 4100 | 0.4052 | - | - | - |
| 0.4036 | 4200 | 0.4153 | - | - | - |
| 0.4132 | 4300 | 0.4024 | - | - | - |
| 0.4228 | 4400 | 0.4244 | - | - | - |
| 0.4324 | 4500 | 0.4543 | - | - | - |
| 0.4420 | 4600 | 0.4018 | - | - | - |
| 0.4516 | 4700 | 0.3622 | - | - | - |
| 0.4612 | 4800 | 0.3914 | - | - | - |
| 0.4708 | 4900 | 0.3855 | - | - | - |
| 0.4804 | 5000 | 0.3716 | - | - | - |
| 0.4901 | 5100 | 0.3798 | - | - | - |
| 0.4997 | 5200 | 0.3822 | - | - | - |
| 0.5093 | 5300 | 0.3467 | - | - | - |
| 0.5189 | 5400 | 0.3647 | - | - | - |
| 0.5285 | 5500 | 0.3563 | - | - | - |
| 0.5381 | 5600 | 0.3583 | - | - | - |
| 0.5477 | 5700 | 0.3159 | - | - | - |
| 0.5573 | 5800 | 0.3817 | - | - | - |
| 0.5669 | 5900 | 0.3892 | - | - | - |
| 0.5765 | 6000 | 0.351 | - | - | - |
| 0.5861 | 6100 | 0.3505 | - | - | - |
| 0.5958 | 6200 | 0.3735 | - | - | - |
| 0.6054 | 6300 | 0.3479 | - | - | - |
| 0.6150 | 6400 | 0.3608 | - | - | - |
| 0.6246 | 6500 | 0.3634 | - | - | - |
| 0.6342 | 6600 | 0.3787 | - | - | - |
| 0.6438 | 6700 | 0.3263 | - | - | - |
| 0.6534 | 6800 | 0.3181 | - | - | - |
| 0.6630 | 6900 | 0.3163 | - | - | - |
| 0.6726 | 7000 | 0.3141 | - | - | - |
| 0.6822 | 7100 | 0.3369 | - | - | - |
| 0.6918 | 7200 | 0.3503 | - | - | - |
| 0.7015 | 7300 | 0.3438 | - | - | - |
| 0.7111 | 7400 | 0.3219 | - | - | - |
| 0.7207 | 7500 | 0.3324 | - | - | - |
| 0.7303 | 7600 | 0.3313 | - | - | - |
| 0.7399 | 7700 | 0.3364 | - | - | - |
| 0.7495 | 7800 | 0.3103 | - | - | - |
| 0.7591 | 7900 | 0.278 | - | - | - |
| 0.7687 | 8000 | 0.2997 | - | - | - |
| 0.7783 | 8100 | 0.3233 | - | - | - |
| 0.7879 | 8200 | 0.3364 | - | - | - |
| 0.7975 | 8300 | 0.3326 | - | - | - |
| 0.8071 | 8400 | 0.3192 | - | - | - |
| 0.8168 | 8500 | 0.3483 | - | - | - |
| 0.8264 | 8600 | 0.2998 | - | - | - |
| 0.8360 | 8700 | 0.3139 | - | - | - |
| 0.8456 | 8800 | 0.2926 | - | - | - |
| 0.8552 | 8900 | 0.3425 | - | - | - |
| 0.8648 | 9000 | 0.2992 | - | - | - |
| 0.8744 | 9100 | 0.3056 | - | - | - |
| 0.8840 | 9200 | 0.3004 | - | - | - |
| 0.8936 | 9300 | 0.3005 | - | - | - |
| 0.9032 | 9400 | 0.3352 | - | - | - |
| 0.9128 | 9500 | 0.2853 | - | - | - |
| 0.9225 | 9600 | 0.3024 | - | - | - |
| 0.9321 | 9700 | 0.3329 | - | - | - |
| 0.9417 | 9800 | 0.2883 | - | - | - |
| 0.9513 | 9900 | 0.2739 | - | - | - |
| 0.9609 | 10000 | 0.3024 | 0.2919 | 0.9200 | - |
| 0.9705 | 10100 | 0.3177 | - | - | - |
| 0.9801 | 10200 | 0.3232 | - | - | - |
| 0.9897 | 10300 | 0.2829 | - | - | - |
| 0.9993 | 10400 | 0.3013 | - | - | - |
| -1 | -1 | - | - | - | 0.9178 |
@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{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}
}
Base model
Qwen/Qwen3-0.6B-Base