Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NewModel
(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): Normalize()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("xmanii/maux-gte-persian-v2")
5# Run inference
6sentences = [
7 'تفاوت بین کشاورزی ارگانیک و کشاورزی سنتی چیست؟',
8 'بازارهای کشاورزان مکان\u200cهای محبوبی برای خرید محصولات ارگانیک به طور مستقیم از کشاورزان محلی هستند.',
9 'تاریخ حفظ آب به تمدن\u200cهای باستانی برمی\u200cگردد که سیستم\u200cهای آبیاری را توسعه دادند.',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 768]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities.shape)
18# [3, 3]EmbeddingSimilarityEvaluator| Metric | Value |
|---|---|
| pearson_cosine | 0.9488 |
| spearman_cosine | 0.9479 |
persian_question, persian_answer, and score| persian_question | persian_answer | score | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| persian_question | persian_answer | score |
|---|---|---|
آیا میتوانید فرآیند برنامهریزی مسیر ربات را توضیح دهید؟ | رباتها میتوانند برنامهنویسی شوند تا مجموعهای از وظایف را انجام دهند، از اقدامهای تکراری ساده تا فرآیندهای پیچیده تصمیمگیری. | 0.27999999999999997 |
آیا انسانها میتوانند در مریخ زندگی کنند؟ | مریخ چهارمین سیاره از خورشید است و به دلیل ظاهر سرخش اغلب به سیاره سرخ معروف است. | 0.16 |
عناصر کلیدی ترکیب در هنر انتزاعی چیست؟ | تاریخ هنر انتزاعی به اوایل قرن بیستم برمیگردد، با پیشگامانی مانند واسیلی کاندینسکی و پیت موندریان. | 0.36 |
CosineSimilarityLoss with these parameters:
1{
2 "loss_fct": "torch.nn.modules.loss.MSELoss"
3}persian_question, persian_answer, and score| persian_question | persian_answer | score | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| persian_question | persian_answer | score |
|---|---|---|
آیا میتوانید فرآیند برنامهریزی مسیر ربات را توضیح دهید؟ | رباتها میتوانند برنامهنویسی شوند تا مجموعهای از وظایف را انجام دهند، از اقدامهای تکراری ساده تا فرآیندهای پیچیده تصمیمگیری. | 0.27999999999999997 |
آیا انسانها میتوانند در مریخ زندگی کنند؟ | مریخ چهارمین سیاره از خورشید است و به دلیل ظاهر سرخش اغلب به سیاره سرخ معروف است. | 0.16 |
عناصر کلیدی ترکیب در هنر انتزاعی چیست؟ | تاریخ هنر انتزاعی به اوایل قرن بیستم برمیگردد، با پیشگامانی مانند واسیلی کاندینسکی و پیت موندریان. | 0.36 |
CosineSimilarityLoss with these parameters:
1{
2 "loss_fct": "torch.nn.modules.loss.MSELoss"
3}eval_strategy: stepsper_device_train_batch_size: 32per_device_eval_batch_size: 32learning_rate: 2e-05num_train_epochs: 5warmup_ratio: 0.1fp16: Trueload_best_model_at_end: Trueoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_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: 5max_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: 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}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: batch_samplermulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | Validation Loss | spearman_cosine |
|---|---|---|---|---|
| 0.1597 | 50 | 0.0663 | - | - |
| 0.3195 | 100 | 0.0409 | 0.0298 | 0.7983 |
| 0.4792 | 150 | 0.0342 | - | - |
| 0.6390 | 200 | 0.0294 | 0.0230 | 0.8464 |
| 0.7987 | 250 | 0.0296 | - | - |
| 0.9585 | 300 | 0.0298 | 0.0220 | 0.8610 |
| 1.1182 | 350 | 0.0249 | - | - |
| 1.2780 | 400 | 0.0237 | 0.0230 | 0.8745 |
| 1.4377 | 450 | 0.0241 | - | - |
| 1.5974 | 500 | 0.0218 | 0.0166 | 0.8900 |
| 1.7572 | 550 | 0.0227 | - | - |
| 1.9169 | 600 | 0.0231 | 0.0148 | 0.9045 |
| 2.0767 | 650 | 0.0196 | - | - |
| 2.2364 | 700 | 0.0173 | 0.0131 | 0.9179 |
| 2.3962 | 750 | 0.0172 | - | - |
| 2.5559 | 800 | 0.0172 | 0.0119 | 0.9231 |
| 2.7157 | 850 | 0.0167 | - | - |
| 2.8754 | 900 | 0.0172 | 0.0120 | 0.9291 |
| 3.0351 | 950 | 0.0175 | - | - |
| 3.1949 | 1000 | 0.013 | 0.0100 | 0.9362 |
| 3.3546 | 1050 | 0.0128 | - | - |
| 3.5144 | 1100 | 0.0129 | 0.0101 | 0.9390 |
| 3.6741 | 1150 | 0.0134 | - | - |
| 3.8339 | 1200 | 0.0137 | 0.0095 | 0.9430 |
| 3.9936 | 1250 | 0.0133 | - | - |
| 4.1534 | 1300 | 0.0109 | 0.0096 | 0.9449 |
| 4.3131 | 1350 | 0.0114 | - | - |
| 4.4728 | 1400 | 0.0111 | 0.0083 | 0.9479 |
| 4.6326 | 1450 | 0.0107 | - | - |
| 4.7923 | 1500 | 0.0122 | 0.0085 | 0.9479 |
| 4.9521 | 1550 | 0.0112 | - | - |
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}