metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:165665
- loss:MultipleNegativesRankingLoss
base_model: sentence-transformers/LaBSE
widget:
- source_sentence: کدام یک از تجربیات بدی که در زندگی داشتید؟
sentences:
- آیا Urjit Patel برای فرماندار RBI مناسب است؟
- چگونه برای اولین بار با پورنو آشنا شدید؟
- برخی از تجربیات خوب و بد زندگی شما چه بود؟
- source_sentence: بهترین مشاغل در فیلیپین چیست؟
sentences:
- >-
چرا مردم در مورد Quora سؤالاتی می پرسند که به راحتی توسط Google قابل
پاسخگویی است؟
- آیا جهان بی نهایت است یا به جهان پایان می یابد؟
- بهترین کار در فیلیپین چیست؟
- source_sentence: آیا بروس لی می تواند جنگجویان MMA را تحمل کند؟
sentences:
- آیا بروس لی در اوج خود می تواند با مبارزان برتر MMA امروز رقابت کند؟
- آیا باید تصاویر را در رسانه های اجتماعی ارسال کنید؟
- آیا ظرفیت گرما همان گرمای خاص است؟
- source_sentence: چگونه می توانم موهای زائد را متوقف کنم؟
sentences:
- چه اتفاقی می افتد اگر نامزد ریاست جمهوری قبل از انتخابات نوامبر درگذشت؟
- بهترین وسایل آیفون که واقعاً ارزش خرید دارند چیست؟
- چگونه می توانم موهای زائد را متوقف کنم؟
- source_sentence: معنی و هدف زندگی چیست؟
sentences:
- چه فیلم هایی را به همه توصیه می کنید که تماشا کنند؟
- مراکز خرید در آینده چگونه خواهد بود؟
- معنی دقیق زندگی چیست؟
pipeline_tag: sentence-similarity
library_name: sentence-transformers
SentenceTransformer based on sentence-transformers/LaBSE
This is a sentence-transformers model finetuned from sentence-transformers/LaBSE. 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: sentence-transformers/LaBSE
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, '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': False, 'include_prompt': True})
(2): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
(3): Normalize()
)
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("codersan/FaLaBSE-v4")
# 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]
Training Details
Training Dataset
Unnamed Dataset
- Size: 165,665 training samples
- Columns:
anchor
andpositive
- Approximate statistics based on the first 1000 samples:
anchor positive type string string details - min: 5 tokens
- mean: 14.65 tokens
- max: 48 tokens
- min: 5 tokens
- mean: 14.87 tokens
- max: 53 tokens
- Samples:
anchor positive طالع بینی: من یک ماه و کلاه درپوش خورشید است ... این در مورد من چه می گوید؟
من یک برج سه گانه (خورشید ، ماه و صعود در برجستگی) هستم که این در مورد من چه می گوید؟
چگونه می توانم یک زمین شناس خوب باشم؟
چه کاری باید انجام دهم تا یک زمین شناس عالی باشم؟
چگونه می توانم نظرات YouTube خود را بخوانم و پیدا کنم؟
چگونه می توانم تمام نظرات YouTube خود را ببینم؟
- Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size
: 32learning_rate
: 2e-05weight_decay
: 0.01batch_sampler
: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: noprediction_loss_only
: Trueper_device_train_batch_size
: 32per_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.01adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 3max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.0warmup_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
: 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
: 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
: Nonedispatch_batches
: Nonesplit_batches
: 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
Training Logs
Epoch | Step | Training Loss |
---|---|---|
0.0386 | 100 | 0.0863 |
0.0772 | 200 | 0.0652 |
0.1159 | 300 | 0.0595 |
0.1545 | 400 | 0.0614 |
0.1931 | 500 | 0.05 |
0.2317 | 600 | 0.0453 |
0.2704 | 700 | 0.0579 |
0.3090 | 800 | 0.0542 |
0.3476 | 900 | 0.0534 |
0.3862 | 1000 | 0.0532 |
0.4249 | 1100 | 0.0548 |
0.4635 | 1200 | 0.0519 |
0.5021 | 1300 | 0.0547 |
0.5407 | 1400 | 0.0563 |
0.5794 | 1500 | 0.0474 |
0.6180 | 1600 | 0.0433 |
0.6566 | 1700 | 0.0545 |
0.6952 | 1800 | 0.0509 |
0.7339 | 1900 | 0.0453 |
0.7725 | 2000 | 0.0446 |
0.8111 | 2100 | 0.0506 |
0.8497 | 2200 | 0.046 |
0.8884 | 2300 | 0.0413 |
0.9270 | 2400 | 0.149 |
0.9656 | 2500 | 0.6993 |
1.0039 | 2600 | 1.081 |
1.0425 | 2700 | 0.0397 |
1.0811 | 2800 | 0.0337 |
1.1197 | 2900 | 0.0307 |
1.1584 | 3000 | 0.0323 |
1.1970 | 3100 | 0.0273 |
1.2356 | 3200 | 0.0292 |
1.2742 | 3300 | 0.0323 |
1.3129 | 3400 | 0.0352 |
1.3515 | 3500 | 0.0281 |
1.3901 | 3600 | 0.0318 |
1.4287 | 3700 | 0.0281 |
1.4674 | 3800 | 0.0304 |
1.5060 | 3900 | 0.0321 |
1.5446 | 4000 | 0.035 |
1.5832 | 4100 | 0.0279 |
1.6219 | 4200 | 0.0286 |
1.6605 | 4300 | 0.0333 |
1.6991 | 4400 | 0.0323 |
1.7377 | 4500 | 0.0312 |
1.7764 | 4600 | 0.0261 |
1.8150 | 4700 | 0.0361 |
1.8536 | 4800 | 0.0306 |
1.8922 | 4900 | 0.028 |
1.9309 | 5000 | 0.1226 |
1.9695 | 5100 | 0.5625 |
2.0077 | 5200 | 0.8337 |
2.0463 | 5300 | 0.0273 |
2.0850 | 5400 | 0.0242 |
2.1236 | 5500 | 0.0236 |
2.1622 | 5600 | 0.0237 |
2.2008 | 5700 | 0.0197 |
2.2395 | 5800 | 0.0217 |
2.2781 | 5900 | 0.0244 |
2.3167 | 6000 | 0.027 |
2.3553 | 6100 | 0.0235 |
2.3940 | 6200 | 0.0233 |
2.4326 | 6300 | 0.0225 |
2.4712 | 6400 | 0.023 |
2.5098 | 6500 | 0.023 |
2.5485 | 6600 | 0.0243 |
2.5871 | 6700 | 0.0215 |
2.6257 | 6800 | 0.0236 |
2.6643 | 6900 | 0.0234 |
2.7030 | 7000 | 0.0239 |
2.7416 | 7100 | 0.0248 |
2.7802 | 7200 | 0.02 |
2.8188 | 7300 | 0.0271 |
2.8575 | 7400 | 0.0235 |
2.8961 | 7500 | 0.0214 |
2.9347 | 7600 | 0.1147 |
2.9733 | 7700 | 0.5838 |
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.3.1
- Transformers: 4.47.0
- PyTorch: 2.5.1+cu121
- Accelerate: 1.2.1
- Datasets: 3.2.0
- Tokenizers: 0.21.0
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{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}
}