CoolFace
Modelpublic

BookingCare/gte-multilingual-base-v1

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

SentenceTransformer based on Alibaba-NLP/gte-multilingual-base

This is a sentence-transformers model finetuned from Alibaba-NLP/gte-multilingual-base on the vi_health_qa dataset. 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: Alibaba-NLP/gte-multilingual-base <!-- at revision f7d567e1f2493bb0df9413965d144de9f15e7bab -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 768 tokens
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —vi_health_qa
  • —Language: vi <!-- - 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("multilingual-e5-base-finetuned")
# Run inference
sentences = [
    'Tăng bạch cầu có ảnh hưởng gì tới viêm lợi không?',
    'Bé nhà bạn ngoài hay bị nhiệt, viêm lợi ra thì còn có vấn đề sức khỏe nào khác không?Cháu đã uống thuốc gì để điều trị nhiệt, viêm lợi ?Bạch cầu của cháu tăng có thể do nhiều nguyên nhân, thường gặp là do viêm nhiễm hoặc do dùng một số loại thuốc. Bạn nên đưa bé đến khám để được chẩn đoán tốt hơn.',
    'Điều trị phẫu thuật và làm xét nghiệm mô bệnh học là phương pháp điều trị các khối u tuyến nước bọt tốt nhất. Phẫu thuật khối u tuyến nước bọt mang tai phụ thuộc vào loại, kích thước, tính chất khối u. Theo đó, phẫu thuật có thể tiến hành loại bỏ một phần hoặc loại bỏ toàn bộ tuyến nước bọt và có hoặc không kèm theo loại bỏ các hạch bạch huyết, dây thần kinh có liên quan.Bên cạnh đó còn có phương pháp phẫu thuật tái tạo, nghĩa là sau khi phẫu thuật để loại bỏ khối u, bác sĩ có thể đề nghị phẫu thuật tái tạo để sửa chữa khu vực. Trong quá trình phẫu thuật tái tạo, bác sĩ phẫu thuật làm việc để sửa chữa cải thiện khả năng nhai, nuốt, nói hoặc thở, có thể cần ghép da, mô hoặc dây thần kinh từ các bộ phận khác của cơ thể để xây dựng lại các khu vực trong miệng, cổ họng hoặc hàm của bệnh nhân.Vì không có thông tin về chẩn đoán của em trước mổ, tính chất (mềm hay cứng, đau hay không đau, có xâm lấn hay không...) và kích thước khối u, phương pháp phẫu thuật, thời gian phẫu thuật bao lâu rồi, em đã thăm khám lại với bác sĩ mổ cho mình hay chưa. Nên chưa thể kết luận liệt dây thần kinh 9,10 sau mổ u tuyến nước bọt có khả năng phục hồi khôngTuy nhiên, bác sĩ có một vài lời khuyên dành cho em:Tái khám đúng lịch để theo dõi tiến triển của khối u cũng như khả năng tái phát của khối u sau điều trị. Đồng thời bác sĩ sẽ đánh giá mức độ tổn thương thần kinh, kết hợp khám chuyên khoa Vật lý trị liệu- Phục hồi chức năng để tập luyện chức năng nói, nuốt.Xét nghiệm thường xuyên theo chỉ định của bác sĩBổ sung dinh dưỡng và uống nhiều nước.',
]
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

Information Retrieval
MetricValue
cosine_accuracy@10.6284
cosine_accuracy@30.7825
cosine_accuracy@50.8318
cosine_accuracy@100.8882
cosine_precision@10.6284
cosine_precision@30.2608
cosine_precision@50.1664
cosine_precision@100.0888
cosine_recall@10.6284
cosine_recall@30.7825
cosine_recall@50.8318
cosine_recall@100.8882
cosine_ndcg@100.7576
cosine_mrr@100.7157
cosine_map@1000.7208
dot_accuracy@10.6284
dot_accuracy@30.7825
dot_accuracy@50.8318
dot_accuracy@100.8882
dot_precision@10.6284
dot_precision@30.2608
dot_precision@50.1664
dot_precision@100.0888
dot_recall@10.6284
dot_recall@30.7825
dot_recall@50.8318
dot_recall@100.8882
dot_ndcg@100.7576
dot_mrr@100.7157
dot_map@1000.7208
Information Retrieval
MetricValue
cosine_accuracy@10.5946
cosine_accuracy@30.7486
cosine_accuracy@50.8003
cosine_accuracy@100.8584
cosine_precision@10.5946
cosine_precision@30.2495
cosine_precision@50.1601
cosine_precision@100.0858
cosine_recall@10.5946
cosine_recall@30.7486
cosine_recall@50.8003
cosine_recall@100.8584
cosine_ndcg@100.726
cosine_mrr@100.6836
cosine_map@1000.6887
dot_accuracy@10.5946
dot_accuracy@30.7486
dot_accuracy@50.8003
dot_accuracy@100.8584
dot_precision@10.5946
dot_precision@30.2495
dot_precision@50.1601
dot_precision@100.0858
dot_recall@10.5946
dot_recall@30.7486
dot_recall@50.8003
dot_recall@100.8584
dot_ndcg@100.726
dot_mrr@100.6836
dot_map@1000.6887

<!--

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 Dataset

vihealthqa
  • —Dataset: vi_health_qa at d90a62d
  • —Size: 7,009 training samples
  • —Columns: <code>question</code> and <code>answer</code>
  • —Approximate statistics based on the first 1000 samples: | | question | answer | |:--------|:-----------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 8 tokens</li><li>mean: 30.36 tokens</li><li>max: 325 tokens</li></ul> | <ul><li>min: 12 tokens</li><li>mean: 131.93 tokens</li><li>max: 1249 tokens</li></ul> |
  • —Samples: | question | answer | |:------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>Đang chích ngừa viêm gan B có chích ngừa Covid-19 được không?</code> | <code>Nếu anh/chị đang tiêm ngừa vaccine phòng bệnh viêm gan B, anh/chị vẫn có thể tiêm phòng vaccine phòng Covid-19, tuy nhiên vaccine Covid-19 phải được tiêm cách trước và sau mũi vaccine viêm gan B tối thiểu là 14 ngày.</code> | | <code>Đau đầu, căng thẳng do công việc, suy giảm trí nhớ khoảng gần một năm phải làm sao?</code> | <code>Tình trạng đau đầu theo bạn mô tả thì chưa rõ. Vì thế, bác sĩ khuyến khích bạn đến cơ sở y tế hoặc bệnh viện thuộc Hệ thống Y tế Vinmec để khám chuyên khoa Thần kinh. Nếu đau đầu thông thường thì cần nghỉ ngơi thư giãn sẽ đỡ, còn nếu có những yếu tố khác thì cần phải khám kỹ, xét nghiệm cận lâm sàng để chẩn đoán chính xác hơn và có hướng điều trị phù hợp.</code> | | <code>Đặt lưu lượng khí hệ thống Jackson-Rees thấp hơn quy định khi sử dụng gây mê cho trẻ em sẽ gây hậu quả gì?</code> | <code>Hệ thống Jackson – Rees dùng khi gây mê để tránh hít lại khí thở ra cần đặt lưu lượng khí mới gấp 2 – 2,5 lần thông khí phút của bệnh nhân. Nếu cài đặt thấp hơn mức này sẽ gây ra hiện tượng ưu thán hay còn gọi là thừa khí CO2 biểu hiện kích thích vã mồ hôi, tăng huyết áp, nguy hiểm hơn là bệnh nhân tím tái, trụy tim mạch, thậm chí là tử vong.Nếu còn thắc mắc, bạn có thể liên hệ hoặc đến trực tiếp một trong các bệnh viện thuộc Hệ thống Y tế Vinmec trên toàn quốc để được bác sĩ chuyên môn tư vấn cụ thể hơn.Cảm ơn bạn đã tin tưởng và đặt câu hỏi tới Vinmec. Trân trọng!</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Evaluation Dataset

vihealthqa
  • —Dataset: vi_health_qa at d90a62d
  • —Size: 993 evaluation samples
  • —Columns: <code>question</code> and <code>answer</code>
  • —Approximate statistics based on the first 993 samples: | | question | answer | |:--------|:-----------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 9 tokens</li><li>mean: 30.03 tokens</li><li>max: 267 tokens</li></ul> | <ul><li>min: 13 tokens</li><li>mean: 133.86 tokens</li><li>max: 1103 tokens</li></ul> |
  • —Samples: | question | answer | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>Em nghe nói kích trứng nhiều lần sẽ làm rối loạn nội tiết và tăng khả năng ung thư buồng trứng có phải không? Vì em có dự trữ buồng trứng rất thấp, được chỉ định gom trứng nên nghe thông tin trên em rất lo lắng.</code> | <code>Theo thông tin chị cung cấp thì chưa đủ dữ liệu để kết luận là kích trứng gây rối loạn nội tiết hay ung thư, tuy nhiên những điều này vẫn có thể ảnh hưởng về sau.</code> | | <code>Tại sao tỷ lệ dịch chuyển tinh trùng thấp?</code> | <code> Nguyên nhân dẫn đến tỷ lệ dịch chuyển tinh trùng thấp là do tinh trùng tổn thương đuôi, tinh trùng không hoạt động, tinh trùng chết. Bạn nên thăm khám bác sĩ chuyên khoa và có phương pháp điều trị thích hợp, tránh ảnh hưởng đến khả năng sinh sản. Nếu được bạn nên giảm thức đêm. Thức đêm cũng là nguyên nhân ảnh hưởng đến chất lượng và số lượng tinh trùng. Ngoài ra, bạn cần ăn uống các loại thực phẩm tươi sạch bổ dưỡng, cần bỏ rượu, thuốc lá và các chất kích thích khác như rượu, cần sa, amphetamin... nếu hai vợ chồng đang cố gắng thụ thai. Ngoài ra, cần tập luyện thể dục đều đặn để nâng cao thể lực, duy trì cân nặng ở mức phù hợp, giảm cân nếu đang thừa cân và hạn chế tiếp xúc với điện thoại di động.</code> | | <code>Ngồi dậy hay nằm xuống đều bị chóng mặt có phải bị tổn thương dây thần kinh do phẫu thuật không?</code> | <code>Xương đòn khi mổ rất lâu liền xương, 3 tuần chưa thể có cal xương dù là cal non, Để đánh giá có tổn thương thần kinh hay không cần khám về lâm sàng, bạn có thể đến khám tại bệnh viện thuộc Hệ thống Y tế Vinmec trên toàn quốc để bác sĩ tư vấn rõ hơn và đưa ra hướng điều trị phù hợp nhất.</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 6
  • —per_device_eval_batch_size: 6
  • —learning_rate: 3.0692519709098972e-06
  • —num_train_epochs: 4
  • —warmup_ratio: 0.04970511867965379
  • —fp16: True
  • —batch_sampler: no_duplicates
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: 6
  • —per_device_eval_batch_size: 6
  • —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: 3.0692519709098972e-06
  • —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.04970511867965379
  • —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: False
  • —hub_always_push: False
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —include_inputs_for_metrics: False
  • —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
  • —eval_use_gather_object: False
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining Losslosshealthcare-dev_cosine_map@100
00--0.6555
0.08551000.17440.15990.6672
0.17112000.16180.11780.6927
0.25663000.12190.09200.7032
0.34224000.07780.08070.7083
0.42775000.09930.07390.7106
0.51336000.08210.06950.7149
0.59887000.06320.06850.7125
0.68438000.06530.06690.7129
0.76999000.09620.06550.7185
0.855410000.03950.06480.7170
0.941011000.07840.06280.7154
1.026512000.07910.06270.7180
1.112113000.0630.06180.7179
1.197614000.08110.06060.7163
1.283115000.04250.06100.7179
1.368716000.0280.06030.7205
1.454217000.07610.05960.7202
1.539818000.04190.05910.7190
1.625319000.03940.05890.7214
1.710920000.06230.05930.7235
1.796421000.06830.05940.7214
1.882022000.03160.05900.7212
1.967523000.06810.05790.7246
2.053024000.03660.05790.7243
2.138625000.03150.05790.7247
2.224126000.06330.05780.7247
2.309727000.02780.05800.7247
2.395228000.0290.05820.7236
2.480829000.04720.05770.7206
2.566330000.03070.05750.7208
2.651831000.02480.05740.7198
2.737432000.05040.05750.7195
2.822933000.02590.05740.7208
2.908534000.02880.05700.7214
2.994035000.05950.05660.7233
3.079636000.03720.05620.7212
3.165137000.03340.05630.7218
3.250638000.03840.05630.7210
3.336239000.01780.05640.7200
3.421740000.03130.05640.7201
3.507341000.04470.05620.7197
3.592842000.02810.05620.7199
3.678443000.020.05630.7199
3.763944000.05350.05620.7212
3.849445000.0170.05620.7207
3.935046000.03530.05620.7208
4.04676--0.6887

Framework Versions

  • —Python: 3.10.12
  • —Sentence Transformers: 3.1.0
  • —Transformers: 4.44.2
  • —PyTorch: 2.4.0+cu121
  • —Accelerate: 0.34.2
  • —Datasets: 3.0.0
  • —Tokenizers: 0.19.1

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",
}
MultipleNegativesRankingLoss
bibtex
@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}
}

<!--

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. -->