CoolFace
Modelpublic

BookingCare/gte-multilingual-base-v2.1-similarity

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes31downloads
Model Card

SentenceTransformer based on BookingCare/gte-multilingual-base-v2.1

This is a sentence-transformers model finetuned from BookingCare/gte-multilingual-base-v2.1 on the train and test datasets. 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: BookingCare/gte-multilingual-base-v2.1 <!-- at revision bbf643b22cc8b5ad3e129b8811afdffbce783a8d -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 768 dimensions
  • —Similarity Function: Cosine Similarity
  • —Training Datasets:
  • —train
  • —test <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

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()
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("BookingCare/gte-multilingual-base-v2.1-similarity")
# Run inference
sentences = [
    'Tôi muốn tìm hiểu về dịch vụ khám chữa bệnh tại phòng khám đa khoa Cầu Giấy.',
    'Cho tôi biết thông tin về phòng khám đa khoa Cầu Giấy, cụ thể là dịch vụ khám chữa bệnh.',
    'Những dịch vụ y tế nào được cung cấp tại bệnh viện Đa khoa Hà Nội?',
]
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]

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

Evaluation

Metrics

Triplet
MetricValue
cosine_accuracy0.969

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Datasets

train
  • —Dataset: train at 54473e6
  • —Size: 46,571 training samples
  • —Columns: <code>query</code>, <code>answer</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | query | answer | negative | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 19.92 tokens</li><li>max: 72 tokens</li></ul> | <ul><li>min: 9 tokens</li><li>mean: 21.43 tokens</li><li>max: 75 tokens</li></ul> | <ul><li>min: 9 tokens</li><li>mean: 20.46 tokens</li><li>max: 58 tokens</li></ul> |
  • —Samples: | query | answer | negative | |:---------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------| | <code>Các bác sĩ đã đề nghị phẫu thuật để điều trị bệnh nhân bị ung thư gan giai đoạn cuối.</code> | <code>Bệnh nhân bị ung thư gan giai đoạn cuối đã được bác sĩ đề nghị phẫu thuật.</code> | <code>Bệnh nhân được chẩn đoán mắc bệnh ung thư giai đoạn cuối, và cơ hội phục hồi là rất thấp.</code> | | <code>Cơn đau đầu của tôi bắt đầu vào sáng nay và đã trở nên tồi tệ hơn trong suốt cả ngày.</code> | <code>Tôi đã phải chịu đựng cơn đau đầu dữ dội suốt cả ngày, bắt đầu từ sáng sớm.</code> | <code>Tôi bị đau đầu nghiêm trọng, nên làm gì?</code> | | <code>Mẹ tôi phải nhập viện vì bệnh tim. </code> | <code> Mẹ tôi bị bệnh tim và phải nhập viện để điều trị.</code> | <code>Bệnh nhân đã được chẩn đoán mắc bệnh tim trước đây.</code> |
  • —Loss: <code>TripletLoss</code> with these parameters:
json
  {
      "distance_metric": "TripletDistanceMetric.EUCLIDEAN",
      "triplet_margin": 5
  }
test
  • —Dataset: test at 54473e6
  • —Size: 46,571 training samples
  • —Columns: <code>query</code>, <code>answer</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | query | answer | negative | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 20.12 tokens</li><li>max: 62 tokens</li></ul> | <ul><li>min: 9 tokens</li><li>mean: 21.51 tokens</li><li>max: 54 tokens</li></ul> | <ul><li>min: 9 tokens</li><li>mean: 20.19 tokens</li><li>max: 56 tokens</li></ul> |
  • —Samples: | query | answer | negative | |:-----------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------| | <code>Tôi cần tìm hiểu về bệnh u nang buồng trứng, triệu chứng, phương pháp điều trị và những lưu ý</code> | <code>Cho tôi biết thông tin về bệnh u nang buồng trứng, bao gồm các triệu chứng, cách điều trị và những điểm cần chú ý</code> | <code>Cho tôi thông tin về bệnh ung thư vú</code> | | <code>Tôi muốn tìm hiểu về các loại thuốc trị bệnh dạ dày</code> | <code>Cho tôi biết thông tin về thuốc điều trị bệnh dạ dày</code> | <code>Làm ơn cho tôi biết về các loại thuốc điều trị bệnh tiểu đường</code> | | <code>Viêm khớp tâm bình có thể bị thu hồi hoàn toàn không?</code> | <code>Liệu viêm khớp tâm bình có thể khỏi hẳn hay không?</code> | <code>Viêm khớp dạng thấp có khả năng chữa khỏi hoàn toàn hay không?</code> |
  • —Loss: <code>TripletLoss</code> with these parameters:
json
  {
      "distance_metric": "TripletDistanceMetric.EUCLIDEAN",
      "triplet_margin": 5
  }

Evaluation Dataset

sts-hard-negatives
  • —Dataset: sts-hard-negatives at 54473e6
  • —Size: 46,571 evaluation samples
  • —Columns: <code>query</code>, <code>answer</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | query | answer | negative | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 20.12 tokens</li><li>max: 62 tokens</li></ul> | <ul><li>min: 9 tokens</li><li>mean: 21.51 tokens</li><li>max: 54 tokens</li></ul> | <ul><li>min: 9 tokens</li><li>mean: 20.19 tokens</li><li>max: 56 tokens</li></ul> |
  • —Samples: | query | answer | negative | |:-----------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------| | <code>Tôi cần tìm hiểu về bệnh u nang buồng trứng, triệu chứng, phương pháp điều trị và những lưu ý</code> | <code>Cho tôi biết thông tin về bệnh u nang buồng trứng, bao gồm các triệu chứng, cách điều trị và những điểm cần chú ý</code> | <code>Cho tôi thông tin về bệnh ung thư vú</code> | | <code>Tôi muốn tìm hiểu về các loại thuốc trị bệnh dạ dày</code> | <code>Cho tôi biết thông tin về thuốc điều trị bệnh dạ dày</code> | <code>Làm ơn cho tôi biết về các loại thuốc điều trị bệnh tiểu đường</code> | | <code>Viêm khớp tâm bình có thể bị thu hồi hoàn toàn không?</code> | <code>Liệu viêm khớp tâm bình có thể khỏi hẳn hay không?</code> | <code>Viêm khớp dạng thấp có khả năng chữa khỏi hoàn toàn hay không?</code> |
  • —Loss: <code>TripletLoss</code> with these parameters:
json
  {
      "distance_metric": "TripletDistanceMetric.EUCLIDEAN",
      "triplet_margin": 5
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —num_train_epochs: 4
  • —warmup_ratio: 0.1
  • —fp16: True
All Hyperparameters

<details><summary>Click to expand</summary>

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: steps
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —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: 5e-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: 4
  • —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: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: batch_sampler
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining LossValidation Losscosine_accuracy
0.07632004.74.40350.9647
0.15274004.55164.22370.9435
0.22906004.4154.11960.9458
0.30538004.33054.07270.9427
0.381710004.28394.06110.9323
0.458012004.24364.04070.9339
0.534414004.20534.04850.9218
0.610716004.21764.02330.9275
0.687018004.18283.98830.9308
0.763420004.11323.98670.9296
0.839722004.06973.95510.9277
0.916024004.07143.93130.9265
0.992426004.06253.92840.9239
1.068728004.02863.90260.9275
1.145030003.99073.94270.9213
1.221432004.03413.96210.9210
1.297734004.00373.91110.9260
1.374036004.0133.90630.9289
1.450438003.98973.87850.9377
1.526740003.96583.87650.9368
1.603142003.99033.86190.9389
1.679444003.95993.87340.9339
1.755746003.93753.86360.9399
1.832148003.91973.83820.9404
1.908450003.96113.83100.9444
1.984752003.94343.82720.9427
2.061154003.88253.81570.9447
2.137456003.88593.82310.9430
2.213758003.89243.79480.9501
2.290160003.89573.78890.9504
2.366462003.85113.77220.9528
2.442764003.85983.76540.9561
2.519166003.84723.75690.9554
2.595468003.85583.74960.9528
2.671870003.8293.75140.9552
2.748172003.85643.73460.9568
2.824474003.83923.73380.9599
2.900876003.80033.73090.9604
2.977178003.79363.72880.9611
3.053480003.77833.71810.9618
3.129882003.75863.71360.9652
3.206184003.78063.71010.9637
3.282486003.76693.70490.9628
3.358888003.78193.70240.9642
3.435190003.76853.69650.9628
3.511592003.76073.69200.9656
3.587894003.76013.68400.9652
3.664196003.76073.67910.9661
3.740598003.73873.67500.9692
3.8168100003.7243.67060.9707
3.8931102003.78893.66820.9688
3.9695104003.75253.66700.9690

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.3.1
  • —Tokenizers: 0.21.0

Citation

BibTeX

Sentence Transformers
bibtex
@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
bibtex
@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}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->