Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 192, 'do_lower_case': False, 'architecture': '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()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("sentence_transformers_model_id")
5# Run inference
6queries = [
7 "\u0645\u0627 \u0647\u064a \u0627\u0644\u0623\u0645\u0627\u0643\u0646 \u0627\u0644\u0623\u062e\u0631\u0649 \u0627\u0644\u0645\u0647\u0645\u0629 \u062f\u0627\u062e\u0644 \u062d\u062f\u0648\u062f \u0627\u0644\u062d\u0631\u0645 \u0627\u0644\u0645\u0643\u064a \u0627\u0644\u0634\u0631\u064a\u0641\u061f",
8]
9documents = [
10 'نظيفا»() وذكر القاضي في حديث ابن عباس في «غسل النبي قال فجففوه بثوب»(). \\n\\nوللتفصيل ينظر (ر: تكفين). \\n\\nالتنعيم \\n\\nالتعريف: \\n\\n1 - التنعيم موضع في الحل في شمال مكة الغربي، وهو حد الحرم من جهة المدينة المنورة. \\n\\nقال الفاسي: المسافة بين باب العمرة وبين أعلام الحرم في هذه الجهة التي في الأرض لا التي على الجبل اثنا عشر ألف ذراع وأربعمائة ذراع وعشرون ذراعا بذراع اليد(). \\n\\nوإنما سمي التنعيم بهذا الاسم لأن الجبل الذي عن يمين الداخل يقال له ناعم والذي عن اليسار يقال له منعم أو نعيم والوادي نعمان(). \\n\\nالأحكام المتعلقة بالتنعيم: \\n\\n2 - أجمع الفقهاء على أن المعتمر المكي لا بد له من',
11 'الملك. \\n\\nونقل القاضي زكريا عن النووي في الروضة قوله: المختار أن كون الإبراء تمليكا أو إسقاطا من المسائل التي لا يطلق فيها ترجيح، بل يختلف الراجح بحسب المسائل، لقوة الدليل وضعفه؛ لأن الإبراء إنما يكون تمليكا باعتبار أن الدين مال، وهو إنما يكون مالا في حق من له الدين، فإن أحكام المالية إنما تظهر في حقه. \\n\\nومما غلب فيه معنى التمليك عند المالكية ترجيحهم اشتراط القبول في الإبراء، كما سيأتي(). \\n\\nعلى أن هناك ما يصلح بالاعتبارين (الإسقاط والتمليك بالتساوي). ومنه ما نص عليه الحنفية أنه لو أبرأ الوارث مدين مورثه غير عالم بموته، ثم بان ميتا، فبالنظر إلى أنه إسقاط يصح، وكذا بالنظر',
12 'كفارا، ولم ينكر النبي ذلك عليه(). \\n\\nأخذ الأجرة على التعاويذ والرقى: \\n\\n28 - ذهب جمهور الفقهاء إلى جواز أخذ الأجرة على التعاويذ والرقى، وإليه ذهب عطاء، وأبو قلابة، وأبو ثور، وإسحاق، واستدلوا بحديث أبي سعيد الخدري الذي سبق ذكره (ف - 14) واستدل الطحاوي للجواز وقال: يجوز أخذ الأجر على الرقى، لأنه ليس على الناس أن يرقي بعضهم بعضا؛ لأن في ذلك تبليغا عن الله تعالى. وكره الزهري أخذ الأجرة على القرآن مطلقا، سواء أكان للتعليم أو للرقية(). \\n\\n\\n\\nتعويض \\n\\nالتعريف: \\n\\n1 - أصل التعويض لغة: العوض، وهو البدل تقول: عوضته تعويضا إذا أعطيته بدل ما ذهب منه. وتعوض منه واعتاض: أخذ العوض()',
13]
14query_embeddings = model.encode_query(queries)
15document_embeddings = model.encode_document(documents)
16print(query_embeddings.shape, document_embeddings.shape)
17# [1, 1024] [3, 1024]
18
19# Get the similarity scores for the embeddings
20similarities = model.similarity(query_embeddings, document_embeddings)
21print(similarities)
22# tensor([[ 0.3507, -0.0306, -0.0986]])dim_1024InformationRetrievalEvaluator with these parameters:
1{
2 "truncate_dim": 1024
3}| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.3421 |
| cosine_accuracy@3 | 0.4979 |
| cosine_accuracy@5 | 0.562 |
| cosine_accuracy@10 | 0.6452 |
| cosine_precision@1 | 0.3421 |
| cosine_precision@3 | 0.166 |
| cosine_precision@5 | 0.1124 |
| cosine_precision@10 | 0.0645 |
| cosine_recall@1 | 0.3421 |
| cosine_recall@3 | 0.4979 |
| cosine_recall@5 | 0.562 |
| cosine_recall@10 | 0.6452 |
| cosine_ndcg@10 | 0.4867 |
| cosine_mrr@10 | 0.4367 |
| cosine_map@100 | 0.4445 |
dim_256InformationRetrievalEvaluator with these parameters:
1{
2 "truncate_dim": 256
3}| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.2872 |
| cosine_accuracy@3 | 0.4339 |
| cosine_accuracy@5 | 0.5003 |
| cosine_accuracy@10 | 0.5771 |
| cosine_precision@1 | 0.2872 |
| cosine_precision@3 | 0.1446 |
| cosine_precision@5 | 0.1001 |
| cosine_precision@10 | 0.0577 |
| cosine_recall@1 | 0.2872 |
| cosine_recall@3 | 0.4339 |
| cosine_recall@5 | 0.5003 |
| cosine_recall@10 | 0.5771 |
| cosine_ndcg@10 | 0.4253 |
| cosine_mrr@10 | 0.3774 |
| cosine_map@100 | 0.3862 |
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
What specific practices did this group of followers engage in according to the given text? | هذا الصنف من المتبعين قد كثر في العصور الأخيرة، فهم يعكفون على عبارات الكتب، لا يتجهون إلا إلى الالتقاط منها، من غير قصد لتعرف دليل ما \n\nيلتقطون، ويبنون عليه، بل يكتمون بأن يقولوا: هناك قول بهذا، وإن لم يكن له دليل قوي(). \n\nولقد كان لهذا الفريق أثران مختلفان: أحدهما خير، وهو ما يتعلق بالقضاء، فإنه إذا كان القضاء لا يصح إلا بالراجح من المذهب، فإن هؤلاء عملهم الاتباع لهذا الراجح، وفي ذلك ضبط للقضاء من غير أن يكون الأمر فرطا. وتقييد القضاء في الأزمان التي تنحرف فيها الأفكار واجب، بل إن الاتباع لا يكون حسنا إلا في الأحكام القضائية. \n\nالأثر الثاني: أن هذا فيه تقديس لأقوال |
How does this group's approach to understanding religious texts impact legal rulings, particularly in matters related to judicial decisions? | هذا الصنف من المتبعين قد كثر في العصور الأخيرة، فهم يعكفون على عبارات الكتب، لا يتجهون إلا إلى الالتقاط منها، من غير قصد لتعرف دليل ما \n\nيلتقطون، ويبنون عليه، بل يكتمون بأن يقولوا: هناك قول بهذا، وإن لم يكن له دليل قوي(). \n\nولقد كان لهذا الفريق أثران مختلفان: أحدهما خير، وهو ما يتعلق بالقضاء، فإنه إذا كان القضاء لا يصح إلا بالراجح من المذهب، فإن هؤلاء عملهم الاتباع لهذا الراجح، وفي ذلك ضبط للقضاء من غير أن يكون الأمر فرطا. وتقييد القضاء في الأزمان التي تنحرف فيها الأفكار واجب، بل إن الاتباع لا يكون حسنا إلا في الأحكام القضائية. \n\nالأثر الثاني: أن هذا فيه تقديس لأقوال |
Can you explain the two contrasting effects mentioned for this group's methodology? | هذا الصنف من المتبعين قد كثر في العصور الأخيرة، فهم يعكفون على عبارات الكتب، لا يتجهون إلا إلى الالتقاط منها، من غير قصد لتعرف دليل ما \n\nيلتقطون، ويبنون عليه، بل يكتمون بأن يقولوا: هناك قول بهذا، وإن لم يكن له دليل قوي(). \n\nولقد كان لهذا الفريق أثران مختلفان: أحدهما خير، وهو ما يتعلق بالقضاء، فإنه إذا كان القضاء لا يصح إلا بالراجح من المذهب، فإن هؤلاء عملهم الاتباع لهذا الراجح، وفي ذلك ضبط للقضاء من غير أن يكون الأمر فرطا. وتقييد القضاء في الأزمان التي تنحرف فيها الأفكار واجب، بل إن الاتباع لا يكون حسنا إلا في الأحكام القضائية. \n\nالأثر الثاني: أن هذا فيه تقديس لأقوال |
MatryoshkaLoss with these parameters:
1{
2 "loss": "MultipleNegativesRankingLoss",
3 "matryoshka_dims": [
4 1024,
5 256
6 ],
7 "matryoshka_weights": [
8 1,
9 1
10 ],
11 "n_dims_per_step": -1
12}eval_strategy: stepsper_device_train_batch_size: 128per_device_eval_batch_size: 64gradient_accumulation_steps: 2learning_rate: 2e-05num_train_epochs: 2lr_scheduler_type: cosinewarmup_ratio: 0.1bf16: Truetf32: Trueload_best_model_at_end: Truegradient_checkpointing: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 64per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 2eval_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: 2max_steps: -1lr_scheduler_type: cosinelr_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: Falsebf16: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Truelocal_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: Trueignore_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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: Falsehub_revision: Nonegradient_checkpointing: Truegradient_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: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | dim_1024_cosine_ndcg@10 | dim_256_cosine_ndcg@10 |
|---|---|---|---|---|
| -1 | -1 | - | 0.3765 | 0.3060 |
| 0.0345 | 10 | 3.2088 | - | - |
| 0.0691 | 20 | 2.879 | - | - |
| 0.1036 | 30 | 2.4085 | - | - |
| 0.1382 | 40 | 2.0405 | - | - |
| 0.1727 | 50 | 1.8785 | 0.4311 | 0.3651 |
| 0.2073 | 60 | 1.7366 | - | - |
| 0.2418 | 70 | 1.6183 | - | - |
| 0.2763 | 80 | 1.5751 | - | - |
| 0.3109 | 90 | 1.3818 | - | - |
| 0.3454 | 100 | 1.4648 | 0.4636 | 0.3970 |
| 0.3800 | 110 | 1.4749 | - | - |
| 0.4145 | 120 | 1.4677 | - | - |
| 0.4491 | 130 | 1.3521 | - | - |
| 0.4836 | 140 | 1.302 | - | - |
| 0.5181 | 150 | 1.3315 | 0.4675 | 0.4084 |
| 0.5527 | 160 | 1.3341 | - | - |
| 0.5872 | 170 | 1.3045 | - | - |
| 0.6218 | 180 | 1.3123 | - | - |
| 0.6563 | 190 | 1.2239 | - | - |
| 0.6908 | 200 | 1.2158 | 0.4755 | 0.4160 |
| 0.7254 | 210 | 1.286 | - | - |
| 0.7599 | 220 | 1.207 | - | - |
| 0.7945 | 230 | 1.1968 | - | - |
| 0.8290 | 240 | 1.2546 | - | - |
| 0.8636 | 250 | 1.1038 | 0.4827 | 0.4226 |
| 0.8981 | 260 | 1.1658 | - | - |
| 0.9326 | 270 | 1.1338 | - | - |
| 0.9672 | 280 | 1.0918 | - | - |
| 1.0 | 290 | 1.0354 | - | - |
| 1.0345 | 300 | 0.9816 | 0.4879 | 0.427 |
| 1.0691 | 310 | 0.9749 | - | - |
| 1.1036 | 320 | 0.9743 | - | - |
| 1.1382 | 330 | 0.905 | - | - |
| 1.1727 | 340 | 0.9706 | - | - |
| 1.2073 | 350 | 0.9017 | 0.4866 | 0.4252 |
| 1.2418 | 360 | 0.9318 | - | - |
| 1.2763 | 370 | 0.9577 | - | - |
| 1.3109 | 380 | 0.9529 | - | - |
| 1.3454 | 390 | 0.9866 | - | - |
| 1.3800 | 400 | 0.9696 | 0.4863 | 0.4243 |
| 1.4145 | 410 | 0.9322 | - | - |
| 1.4491 | 420 | 0.9313 | - | - |
| 1.4836 | 430 | 0.9352 | - | - |
| 1.5181 | 440 | 0.9885 | - | - |
| 1.5527 | 450 | 0.873 | 0.4864 | 0.4254 |
| 1.5872 | 460 | 0.9204 | - | - |
| 1.6218 | 470 | 0.9117 | - | - |
| 1.6563 | 480 | 0.8663 | - | - |
| 1.6908 | 490 | 0.9397 | - | - |
| 1.7254 | 500 | 0.8624 | 0.4873 | 0.4259 |
| 1.7599 | 510 | 0.91 | - | - |
| 1.7945 | 520 | 0.9202 | - | - |
| 1.8290 | 530 | 0.9903 | - | - |
| 1.8636 | 540 | 0.8564 | - | - |
| 1.8981 | 550 | 0.9594 | 0.4867 | 0.4253 |
| 1.9326 | 560 | 0.9858 | - | - |
| 1.9672 | 570 | 0.9477 | - | - |
| 2.0 | 580 | 0.9216 | - | - |
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{kusupati2024matryoshka,
2 title={Matryoshka Representation Learning},
3 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},
4 year={2024},
5 eprint={2205.13147},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG}
8}1@misc{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 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},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}