SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'XLMRobertaModel'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'cls', 'include_prompt': True})
(2): Normalize({})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("expri34/beyan-quran-bge-m3")
5# Run inference
6sentences = [
7 "De ki, Allah'a ve Peygamber'e itaat edin! Eğer aksine giderlerse, şüphe yok ki Allah kâfirleri sevmez.",
8 "De ki, Allah'a ve Peygamber'e itaat edin! Eğer aksine giderlerse, şüphe yok ki Allah kâfirleri sevmez. 31- De ki: “Eğer Allah’ı seviyorsanız Bana uyun ki Allah da sizi sevsin ve günahlarınızı bağışlasın. Allah Ğafurdur, Rahimdir.” 32- De ki: “Allah’a ve Rasûl’e itaat edin.” Eğer yüz çevirirlerse bilsinler ki Allah kâfirleri sevmez. 31. Bu âyet Allah’ı gerçek anlamı ile sevenler ile bunu mücerred bir iddia olarak ileri sürenlerin kendisi vasıtası ile bilinip ayırt edildiği bir ölçüdür. Zira Allah’ı sevmenin alâmeti Muhammed sallallahu aleyhi ve sellem’e tabi olmaktır. Yüce Allah O’na ve O’nun dave",
9 'فَبَدَّلَ الَّذِينَ ظَلَمُوا قَوْلًا غَيْرَ الَّذِي قِيلَ لَهُمْ فَأَنْزَلْنَا عَلَى الَّذِينَ ظَلَمُوا رِجْزًا مِنَ السَّمَاءِ بِمَا كَانُوا يَفْسُقُونَ',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 1024]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.7001, 0.1396],
19# [0.7001, 1.0000, 0.0754],
20# [0.1396, 0.0754, 1.0000]])anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
Nereden (yola) çıkarsan, yüzünü Mescid-i Haram'a doğru çevir. Siz de nerede olursanız, yüzünüzü o yana döndürün, Ta ki, zalim olanlardan başka insanların aleyhinizde bir delili bulunmasın. Artık onlar | zulüm |
إِنْ يَنْصُرْكُمُ اللَّهُ فَلَا غَالِبَ لَكُمْ ۖ وَإِنْ يَخْذُلْكُمْ فَمَنْ ذَا الَّذِي يَنْصُرُكُمْ مِنْ بَعْدِهِ ۗ وَعَلَى اللَّهِ فَلْيَتَوَكَّلِ الْمُؤْمِنُونَ | Allah size yardım ederse, sizi yenecek yoktur. Eğer sizi yardımsız bırakırsa, artık ondan sonra size kim yardım edebilir? Müminler ancak Allah'a güvenip dayansınlar. |
وَيْلٌ يَوْمَئِذٍ لِلْمُكَذِّبِينَ | O gün yalanlayanların vay haline! |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
ibrahim ile ilgili Kuran ne diyor | Bir de dedi ki: "Ben Rabbime gidiyorum, o bana yolunu gösterir." |
(Onlar mı hayırlı) yoksa, kendine yalvardığı zaman bunalmışa karşılık veren ve başındaki sıkıntıyı gideren, sizi yeryüzünün hakimleri yapan mı? Allah'ın yanında başka bir ilâh mı var? Ne kıt düşünüyorsunuz! | أَمَّنْ يُجِيبُ الْمُضْطَرَّ إِذَا دَعَاهُ وَيَكْشِفُ السُّوءَ وَيَجْعَلُكُمْ خُلَفَاءَ الْأَرْضِ ۗ أَإِلَٰهٌ مَعَ اللَّهِ ۚ قَلِيلًا مَا تَذَكَّرُونَ |
Çünkü gündüz senin için uzun bir meşguliyet vardır. | Çünkü gündüz senin için uzun bir meşguliyet vardır. 1- Ey elbisesine sarınıp bürünen! 2- Kalk ve birazı müstesnâ geceyi namazla geçir; 3- Yarısını veya ondan biraz azını. 4- Yahut da ondan biraz fazlasını. Kur’ân’ı da tertil üzere (ağır ağır ve tane tane) oku. 5- Şüphesiz Biz sana ağır bir söz vahyedeceğiz. 6- Çünkü gece kalkışı hem daha etkilidir hem de ondaki okuyuş daha düzgün ve sağlamdır. 7- Gündüz vakti ise senin uzun uğraşların vardır. 8- Rabbinin ismini an ve her şeyden yüz çevirip tamamiyle O’na yönel! 9- O, doğunun da batının da Rabbidi |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}per_device_train_batch_size: 4num_train_epochs: 1learning_rate: 2e-06warmup_steps: 0.1gradient_accumulation_steps: 8fp16: Trueeval_strategy: stepsper_device_eval_batch_size: 4per_device_train_batch_size: 4num_train_epochs: 1max_steps: -1learning_rate: 2e-06lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0.1optim: adamw_torchoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 8average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Falsefp16: Truebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: trackioeval_strategy: stepsper_device_eval_batch_size: 4prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_backend: Noneddp_timeout: 1800fsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}deepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0267 | 25 | 0.6327 | - |
| 0.0535 | 50 | 0.6013 | - |
| 0.0802 | 75 | 0.5523 | - |
| 0.1069 | 100 | 0.4702 | - |
| 0.1337 | 125 | 0.4084 | - |
| 0.1604 | 150 | 0.3759 | - |
| 0.1871 | 175 | 0.3413 | - |
| 0.2139 | 200 | 0.3640 | 0.2953 |
| 0.2406 | 225 | 0.3196 | - |
| 0.2673 | 250 | 0.3098 | - |
| 0.2941 | 275 | 0.3359 | - |
| 0.3208 | 300 | 0.2916 | - |
| 0.3475 | 325 | 0.2713 | - |
| 0.3743 | 350 | 0.2880 | - |
| 0.4010 | 375 | 0.2857 | - |
| 0.4278 | 400 | 0.2396 | 0.2214 |
| 0.4545 | 425 | 0.2703 | - |
| 0.4812 | 450 | 0.2682 | - |
| 0.5080 | 475 | 0.2667 | - |
| 0.5347 | 500 | 0.2973 | - |
| 0.5614 | 525 | 0.2358 | - |
| 0.5882 | 550 | 0.2250 | - |
| 0.6149 | 575 | 0.2793 | - |
| 0.6416 | 600 | 0.2027 | 0.1898 |
| 0.6684 | 625 | 0.2154 | - |
| 0.6951 | 650 | 0.2038 | - |
| 0.7218 | 675 | 0.2249 | - |
| 0.7486 | 700 | 0.2530 | - |
| 0.7753 | 725 | 0.2012 | - |
| 0.8020 | 750 | 0.1971 | - |
| 0.8288 | 775 | 0.2232 | - |
| 0.8555 | 800 | 0.2477 | 0.1758 |
| 0.8822 | 825 | 0.2183 | - |
| 0.9090 | 850 | 0.2151 | - |
| 0.9357 | 875 | 0.1801 | - |
| 0.9624 | 900 | 0.1969 | - |
| 0.9892 | 925 | 0.1977 | - |
| 1.0 | 936 | - | 0.1730 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}