SentenceTransformer
This is a sentence-transformers model trained. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Maximum Sequence Length: 192 tokens
- Output Dimensionality: 384 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'mean', 'include_prompt': True})
)
Usage
Direct Usage (Sentence Transformers)
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("sentence_transformers_model_id")
# Run inference
sentences = [
'query: aayakar praadhikaran dvaaraa apiil karane ke lie kaun sii kar chhuut upalabdh hai?',
'passage: धारा 373: आयकर प्राधिकरण द्वारा अपील दाखिल करना 373. (1) बोर्ड इस अध्याय के प्रावधानों के तहत किसी आयकर प्राधिकरण द्वारा अपील दाखिल करने के उद्देश्य से, इस अध्याय के प्रावधानों के तहत किसी भी आयकर प्राधिकरण द्वारा अपील दाखिल करने को विनियमित करने के उद्देश्य से, समय-समय पर अन्य आयकर प्राधिकरणों को आदेश, निर्देश या निर्देश जारी कर सकता है, यह ऐसे मौद्रिक सीमाओं को निर्धारित करने से नहीं रोक सकता है, जो वह किसी भी आयकर वर्ष के लिए किसी भी आयकर प्राधिकरण के मामले में किसी भी मुद्दे पर अपील नहीं कर सकता है। (2) जहां उप-धारा (1) के तहत जारी आदेशों, निर्देशों या निर्देशों का पालन करते हुए आयकर प्राधिकरण ने किसी भी मामले में किसी भी मुद्दे पर अपील नहीं दायर की है, तो यह इस तरह के किसी भी प्राधिकरण को किसी अन्य आयकर वर्ष के लिए किसी भी मामले में याचिका दायर करने से नहीं रोक सकता है। (3) जहां उप-धारा (1) के तहत किसी आयकर प्राधिकरण द्वारा या निर्देशों के तहत किसी भी मामले में याचिका दायर नहीं की गई है, और जहां किसी भी मामले में अपील करने वाले पक्ष द्वारा या याचिका दायर नहीं की गई है, उस मामले में अदालत द्वारा किसी भी याचिका दायर नहीं की जाएगी। (1)',
'passage: Section 367: Appeal to Supreme Court\n\n367. An appeal shall lie to the Supreme Court from any judgment of the High \n Court delivered on an appeal made to High Court in respect of an order \npassed under section 363 in any case which the High Court certifies to be fit for \nappeal to the Supreme Court.\nHearing before Supreme Court.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.2213, 0.1421],
# [0.2213, 1.0000, 0.3914],
# [0.1421, 0.3914, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 4,000 training samples
- Columns: anchor, positive, and negative
- Approximate statistics based on the first 100 samples:
anchor positive negative type string string string modality text text text details min: 11 tokensmean: 31.81 tokensmax: 104 tokens min: 29 tokensmean: 164.93 tokensmax: 192 tokens min: 4 tokensmean: 132.9 tokensmax: 192 tokens - Samples:
anchor positive negative query: तलाशी और जब्त के लिए किस प्रकार की कर छूट उपलब्ध है? passage: Section 247: Search and seizure247. (1) Where the competent authority, in consequence of information in hispossession, has reason to believe that—( a) any person to whom a summons under section 131(1) or a notice undersection 142(1) of the Income-tax Act, 1961 (43 of 1961) or summonsunder section 246(1) or a notice under section 268(1) of this Act,––( I) was issued to produce, or cause to be produced, any books of accountor other documents, or any information in electronic form or ona computer system, has omitted or failed to produce, or cause tobe produced, such books of account or other documents or suchinformation as required by such summons or notice; or( II) has been issued or might be issued, will not, or would not, produceor cause to be produced, any books of account or other documents,or any information in electronic form or on a computer systemwhich will be useful for, or relevant to, any proceedings under theIncome-tax Act, 1961 (43 of 1... passage: धारा 296: धारा 63[(1) धारा 286 के प्रावधानों के बावजूद, धारा 294 के तहत आदेश उस तिमाही के अंत से अठारह महीने के भीतर पारित किया जाएगा जिसमें तलाशी शुरू की गई थी या तलाशी ली गई थी.] (2) जहां तलाशी शुरू की गई थी या तलाशी ली गई थी, और संबंधित खंड अवधि की कुल अज्ञात आय के आकलन या पुनर्मूल्यांकन के दौरान धारा 166 (1) के तहत कोई संदर्भ दिया गया है, ऐसे मूल्यांकन या पुनर्मूल्यांकन प्रक्रिया को पूरा करने के लिए उपलब्ध अवधि को बारह महीने तक बढ़ाया जाएगा। (3) उपधारा (1) के तहत समय सीमा की गणना में, उस समय अवधि (एक सौ और अस्सी दिनों से अधिक नहीं) जो उस तारीख से शुरू होती है जिस दिन ऐसी तलाशी शुरू की गई है या एक पुनर्मूल्यांकन किया गया है और जहां धारा 166 (1) के तहत प्रदान की गई अवधि की समाप्ति के दौरान धनराशि का पुनर्मूल्यांकन किया गया है, और जब धारा 261 के अंत के अंत के लिए ऐसी अवधि समाप्त हो जाती है, तो ऐसे अनुच्छेद (2) के तहत किसी अन्य व्यक्ति द्वारा इस तरह के मूल्यांकन की अवधि के अंत तक या पुनर्मूल्यांकन की अवधि के लिए संदर्भित किया जाएगा, यदि धारा 29 (5) के अंत तक किसी अन्य व्यक्ति ... query: aay kii kam riporting aur galat riporting ke lie jurmaanaa ke lie kaun sii kar chhuut upalabdh hai? passage: Section 439: Penalty for under-reporting and misreporting of income(12) The tax payable in respect of the under-reported income shall be—( a) where no return of income has been furnished or where return has beenfurnished for the first time under section 280 and the income has beenassessed for the first time, the amount of tax calculated on the under-re-ported income as increased by the maximum amount not chargeable totax as if it were the total income;( b) where the total income determined under section 270(1)(a) or assessed,reassessed or recomputed in a preceding order is a loss, the amount oftax calculated on the under-reported income as if it were the total income;( c) in any other case, determined as follows—(X – Y)where,—X = the amount of tax calculated on the under-reported incomeas increased by the total income determined under section270(1)(a) or total income assessed, reassessed or recomputedin a preceding order as if it were the total ... passage: Section 367: Appeal to Supreme Court367. An appeal shall lie to the Supreme Court from any judgment of the High Court delivered on an appeal made to High Court in respect of an order passed under section 363 in any case which the High Court certifies to be fit for appeal to the Supreme Court.Hearing before Supreme Court. query: कार्यवाही को अमान्य नहीं करने के लिए अधिनियम में किस धारा के तहत रिक्त पद आदि को कवर किया गया है? passage: धारा 382: रिक्तियां, आदि, कार्यवाही को अमान्य नहीं करने के लिए 382. अग्रिम निर्णय बोर्ड द्वारा कोई कार्यवाही या अग्रिम निर्णय की घोषणा, केवल बोर्ड के गठन में किसी भी रिक्त स्थान या दोष की उपस्थिति के आधार पर प्रश्न या अमान्य होगी। अग्रिम निर्णय के लिए आवेदन। passage: धारा 381: अग्रिम निर्णयों के लिए बोर्ड 381. (1) केंद्र सरकार इस अध्याय के तहत अग्रिम निर्णय देने के लिए एक या अधिक बोर्डों का गठन करेगी, जैसा कि आवश्यक हो, उस तिथि पर या उसके बाद, जिसे केंद्र सरकार अधिसूचना द्वारा नियुक्त कर सकती है। (2) अग्रिम निर्णयों के लिए बोर्ड में दो सदस्य होंगे, प्रत्येक एक अधिकारी मुख्य आयुक्त के पद से कम नहीं होगा, जैसा कि बोर्ड द्वारा नामित किया जा सकता है। रिक्तियां आदि, कार्यवाही को अमान्य नहीं करने के लिए। - Loss: MultipleNegativesRankingLoss with these parameters:
{ "scale": 20.0, "similarity_fct": "cos_sim", "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 96learning_rate: 2e-05num_train_epochs: 1lr_scheduler_type: cosinewarmup_ratio: 0.1seed: 45dataloader_num_workers: 4
All Hyperparameters
overwrite_output_dir: Falsedo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 96per_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: cosinelr_scheduler_kwargs: Nonewarmup_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: 45data_seed: Nonejit_mode_eval: Falsebf16: Falsefp16: Falsefp16_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: 4dataloader_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}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: 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: 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: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss |
|---|---|---|
| 0.2381 | 10 | 2.4989 |
| 0.4762 | 20 | 2.3856 |
| 0.7143 | 30 | 2.3208 |
| 0.9524 | 40 | 2.343 |
Training Time
- Training: 15.6 minutes
Framework Versions
- Python: 3.12.3
- Sentence Transformers: 5.7.0
- Transformers: 4.57.6
- PyTorch: 2.13.0+cpu
- Accelerate: 1.14.0
- Datasets: 5.0.1
- Tokenizers: 0.22.2
Additional Resources
- Training and Finetuning Embedding Models with Sentence Transformers: the end-to-end guide for training or finetuning Sentence Transformer models.
- Introduction to Matryoshka Embedding Models: variable-size embeddings that can be truncated with minimal quality loss.
- Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval: post-training compression of embedding vectors.
- Multimodal Embedding & Reranker Models with Sentence Transformers: use text, image, audio, and video models through the same API.
- Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers: train multimodal embedding models, with a Visual Document Retrieval walkthrough.
Citation
BibTeX
Sentence Transformers
@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",
}
MultipleNegativesRankingLoss
@misc{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}