SentenceTransformer based on sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2

This is a sentence-transformers model finetuned from sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2. It maps sentences & paragraphs to a 384-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 Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, '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("farihashifa/paraphrase-multilingual-MiniLM-L12-v2-bn-paraphrase-all-mini")
# Run inference
sentences = [
    'নাটকটি লিখেছেন সুমাইয়া ইসলাম এবং পরিচালনা করেছেন জাহিদ হাসান।',
    'চলচ্চিত্রটি পরিচালনা করেছেন ইসরাত জাহান কাদের এবং প্রযোজনা করেছেন মাহফুজ আহমেদ।',
    'তিনি ডিমলা থানায় কাজ করতেন এবং প্রত্যক্ষদর্শীদের জানান, হারুন অর রশিদ মোটরসাইকেল নিয়ে নীলফামারী শহরের দিকে যাচ্ছিলেন',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Evaluation

Metrics

Semantic Similarity

Metric paraphrase-multilingual-MiniLM-L12-v2 sts-test
pearson_cosine 0.9447 0.9411
spearman_cosine 0.8648 0.865

Training Details

Training Dataset

Unnamed Dataset

  • Size: 3,500 training samples
  • Columns: Original_Text, Postive, and Negative
  • Approximate statistics based on the first 1000 samples:
    Original_Text Postive Negative
    type string string string
    details
    • min: 6 tokens
    • mean: 32.48 tokens
    • max: 128 tokens
    • min: 5 tokens
    • mean: 27.36 tokens
    • max: 54 tokens
    • min: 6 tokens
    • mean: 26.29 tokens
    • max: 49 tokens
  • Samples:
    Original_Text Postive Negative
    সেখানে ডিসেম্বর থেকে ফেব্রুয়ারি মাসে বৃষ্টি হয়। নভেম্বর থেকে জানুয়ারি মাস পর্যন্ত এখানে বৃষ্টি হয়। নাটকটি পরিচালনা করেছেন মাবরুর রশীদ বান্না এবং প্রযোজনা করেছেন শ্রিয়া সর্বজয়া তৌসি
    গতকাল যশোর ও খুলনার বিভিন্ন পথসভায় বক্তব্য দেন রফিক। গতকাল কাদের কুমিল্লা ও ফেনীর বিভিন্ন জনসভায় বক্তব্য রাখেন। তিন দিনের সফরে প্রধানমন্ত্রী বুধবার সকালে তুরস্কে যাওয়ার জন্য ঢাকা ত্যাগ করেন।
    আমাজন প্রাইম ইনস্টাগ্রাম অ্যাপল আইক্লাউড টুইটার ওয়ার্কস্পেস জিমেইল এ সবই ক্লাউড সেবা ড্রপবক্স নেটফ্লিক্স ফ্লিকার গুগল ড্রাইভ মাইক্রোসফট অফিস ৩৬৫ ইয়াহু মেইল সব ক্লাউড সার্ভিস। রাজাপুর থানার ওসি আতাউর রহমান বিবিসিকে বলেন, কাউখালী থেকে পিরোজপুর পর্যন্ত বাসটি সাতুরিয়া এলাকায়
  • Loss: TripletLoss with these parameters:
    {
        "distance_metric": "TripletDistanceMetric.COSINE",
        "triplet_margin": 0.5
    }
    

Evaluation Dataset

Unnamed Dataset

  • Size: 500 evaluation samples
  • Columns: Original_Text, Postive, and Negative
  • Approximate statistics based on the first 500 samples:
    Original_Text Postive Negative
    type string string string
    details
    • min: 4 tokens
    • mean: 31.52 tokens
    • max: 128 tokens
    • min: 6 tokens
    • mean: 26.27 tokens
    • max: 48 tokens
    • min: 7 tokens
    • mean: 26.06 tokens
    • max: 54 tokens
  • Samples:
    Original_Text Postive Negative
    গত মার্চে চট্টগ্রামে নিজের বাড়িতে খুন হন রিয়াদ ও মোনা। ফেব্রুয়ারি মাসে রাজধানীতে নিজ বাড়িতে সাগর ও রুনিকে হত্যা করা হয়। ফিদা কামাল ওয়ান ইলেভেন সরকারের অ্যাটর্নি জেনারেল ছিলেন।
    পহেলা বৈশাখের বিশেষ আকর্ষণ হলো বৈসু উৎসবের অন্যতম প্রধান আকর্ষণ হচ্ছে উৎসব। কেন্দুয়া উপজেলা পরিষদ চত্বরে প্রাথমিক শিক্ষার মান উন্নয়নের লক্ষ্যে উপজেলা প্রাথমিক শিক্ষক সমিতি এই সমাবেশের আয়োজন করে।
    আরো বক্তব্য রাখেন জাসদের সদস্য রুমানা আহমেদ নেওয়াজ অধ্যক্ষ এম বি রহমান চৌধুরী ও অধ্যাপক মাহমুদ হাসান। এ ছাড়া সমিতির সদস্য শ্যামলী নাসরিন চৌধুরী, অধ্যক্ষ এম.এ. আউয়াল সিদ্দিকী এবং অধ্যাপক সাজেদুল ইসলাম গ্লোবাল মার্চ এগেইনস্ট চাইল্ড লেবার ইন্টারন্যাশনাল সেন্টার অন চাইল্ড লেবার অ্যান্ড এডুকেশন ছাড়াও গ্লোবাল ক্যাম্পেইন ফর এডুকেশন
  • Loss: TripletLoss with these parameters:
    {
        "distance_metric": "TripletDistanceMetric.COSINE",
        "triplet_margin": 0.5
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • learning_rate: 2e-05
  • warmup_ratio: 0.1
  • fp16: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 3
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: True
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss Validation Loss paraphrase-multilingual-MiniLM-L12-v2_spearman_cosine sts-test_spearman_cosine
-1 -1 - - 0.5069 -
0.2727 15 - 0.0428 0.8479 -
0.4545 25 0.1408 - - -
0.5455 30 - 0.0210 0.8625 -
0.8182 45 - 0.0170 0.8633 -
0.9091 50 0.0303 - - -
1.0727 60 - 0.0149 0.8643 -
1.3455 75 0.0161 0.0143 0.8641 -
1.6182 90 - 0.0136 0.8644 -
1.8 100 0.0169 - - -
1.8909 105 - 0.0134 0.8645 -
2.1455 120 - 0.0129 0.8647 -
2.2364 125 0.0172 - - -
2.4182 135 - 0.0125 0.8647 -
2.6909 150 0.0108 0.0123 0.8647 -
2.9636 165 - 0.0123 0.8648 -
-1 -1 - - - 0.8650

Framework Versions

  • Python: 3.11.11
  • Sentence Transformers: 3.4.1
  • Transformers: 4.48.3
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.3.0
  • Datasets: 3.6.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",
}

TripletLoss

@misc{hermans2017defense,
    title={In Defense of the Triplet Loss for Person Re-Identification},
    author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
    year={2017},
    eprint={1703.07737},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}
Downloads last month
2
Safetensors
Model size
118M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for farihashifa/paraphrase-multilingual-MiniLM-L12-v2-bn-paraphrase-all-mini

Evaluation results