bkai-fine-tuned-dermatology

This is a sentence-transformers model finetuned from bkai-foundation-models/vietnamese-bi-encoder on the json 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: bkai-foundation-models/vietnamese-bi-encoder
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:
    • json
  • Language: vi
  • License: apache-2.0

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: RobertaModel 
  (1): Pooling({'word_embedding_dimension': 768, '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("NamCr17/bkai-fine-tuned-dermatology")
# Run inference
sentences = [
    'Điều_trị prurigo nodularis nhằm mục_đích giảm ngứa và viêm , bao_gồm : 1 . Điều_trị tại_chỗ : Thuốc_mỡ hoặc kem bôi có chứa corticosteroid , capsaicin hoặc chất ức_chế calcineurin . 2 . Thuốc uống : Corticosteroid , thuốc kháng histamine hoặc thuốc ảnh_hưởng đến hệ miễn_dịch . 3 . Liệu_pháp ánh_sáng : Phương_pháp này bao_gồm việc chiếu một_số loại ánh_sáng nhất_định vào da để giúp giảm ngứa và viêm . 4 . Liệu_pháp lạnh : Đông_lạnh các nốt sần bằng nitơ lỏng để giúp giảm kích_thước . Hãy nhớ luôn tham_khảo ý_kiến chuyên_gia chăm_sóc sức_khỏe trước khi bắt_đầu bất_kỳ phương_pháp điều_trị nào .',
    'Phương_pháp điều_trị bệnh prurigo nodularis là gì ?',
    'Nguyên_nhân gây bệnh vẩy_nến là gì , triệu_chứng của bệnh là gì và cách kiểm_soát như thế_nào ?',
]
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]

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.4521
cosine_accuracy@3 0.726
cosine_accuracy@5 0.8151
cosine_accuracy@10 0.9247
cosine_precision@1 0.4521
cosine_precision@3 0.242
cosine_precision@5 0.163
cosine_precision@10 0.0925
cosine_recall@1 0.4521
cosine_recall@3 0.726
cosine_recall@5 0.8151
cosine_recall@10 0.9247
cosine_ndcg@10 0.6822
cosine_mrr@10 0.6051
cosine_map@100 0.6094

Information Retrieval

Metric Value
cosine_accuracy@1 0.4384
cosine_accuracy@3 0.726
cosine_accuracy@5 0.8082
cosine_accuracy@10 0.9247
cosine_precision@1 0.4384
cosine_precision@3 0.242
cosine_precision@5 0.1616
cosine_precision@10 0.0925
cosine_recall@1 0.4384
cosine_recall@3 0.726
cosine_recall@5 0.8082
cosine_recall@10 0.9247
cosine_ndcg@10 0.6749
cosine_mrr@10 0.5956
cosine_map@100 0.6

Information Retrieval

Metric Value
cosine_accuracy@1 0.4384
cosine_accuracy@3 0.7329
cosine_accuracy@5 0.7945
cosine_accuracy@10 0.911
cosine_precision@1 0.4384
cosine_precision@3 0.2443
cosine_precision@5 0.1589
cosine_precision@10 0.0911
cosine_recall@1 0.4384
cosine_recall@3 0.7329
cosine_recall@5 0.7945
cosine_recall@10 0.911
cosine_ndcg@10 0.6668
cosine_mrr@10 0.5891
cosine_map@100 0.5951

Information Retrieval

Metric Value
cosine_accuracy@1 0.4521
cosine_accuracy@3 0.7055
cosine_accuracy@5 0.8151
cosine_accuracy@10 0.9384
cosine_precision@1 0.4521
cosine_precision@3 0.2352
cosine_precision@5 0.163
cosine_precision@10 0.0938
cosine_recall@1 0.4521
cosine_recall@3 0.7055
cosine_recall@5 0.8151
cosine_recall@10 0.9384
cosine_ndcg@10 0.6832
cosine_mrr@10 0.603
cosine_map@100 0.6069

Information Retrieval

Metric Value
cosine_accuracy@1 0.4384
cosine_accuracy@3 0.7192
cosine_accuracy@5 0.8082
cosine_accuracy@10 0.911
cosine_precision@1 0.4384
cosine_precision@3 0.2397
cosine_precision@5 0.1616
cosine_precision@10 0.0911
cosine_recall@1 0.4384
cosine_recall@3 0.7192
cosine_recall@5 0.8082
cosine_recall@10 0.911
cosine_ndcg@10 0.6705
cosine_mrr@10 0.5939
cosine_map@100 0.5995

Training Details

Training Dataset

json

  • Dataset: json
  • Size: 1,168 training samples
  • Columns: positive and anchor
  • Approximate statistics based on the first 1000 samples:
    positive anchor
    type string string
    details
    • min: 44 tokens
    • mean: 145.24 tokens
    • max: 235 tokens
    • min: 7 tokens
    • mean: 15.36 tokens
    • max: 33 tokens
  • Samples:
    positive anchor
    Rosacea là một tình_trạng da mãn_tính gây ra mẩn đỏ , sưng tấy và đôi_khi là những nốt mụn nhỏ chứa mủ trên mặt . Nguyên_nhân chính_xác vẫn chưa được biết rõ , nhưng có_thể do các yếu_tố như nhiệt_độ khắc_nghiệt , đồ ăn cay , rượu , căng_thẳng , ánh nắng mặt_trời hoặc gió , một_số loại mỹ_phẩm và một_số loại thuốc gây ra . Các triệu_chứng phổ_biến của bệnh rosacea bao_gồm đỏ mặt , các nốt mụn đỏ sưng tấy , các vấn_đề về mắt ( nhiều người bị bệnh rosacea cũng bị khô , kích_ứng , sưng mắt và mí mắt đỏ sưng tấy ) và mũi to . Mặc_dù không có cách chữa khỏi bệnh rosacea , nhưng các phương_pháp điều_trị có_thể kiểm_soát và làm giảm các dấu_hiệu và triệu_chứng . Các lựa_chọn bao_gồm thuốc bôi ngoài da , kháng_sinh uống , liệu_pháp laser và phẫu_thuật . Ngoài_ra , việc xác_định và tránh các tác_nhân gây bệnh có_thể giúp kiểm_soát bệnh rosacea . Điều quan_trọng là phải tham_khảo ý_kiến bác_sĩ chăm_sóc sức_khỏe hoặc bác_sĩ da_liễu để được chẩn_đoán và lập kế_hoạch điều_trị . Nguyên_nhân gây ra bệnh trứng_cá đỏ , triệu_chứng và cách điều_trị như thế_nào ?
    Đúng_vậy , giống như bất_kỳ loại thuốc nào , việc điều_trị rụng tóc từng vùng có_thể có các tác_dụng phụ tiềm_ẩn . 1 . Corticosteroid : Sử_dụng corticosteroid trong thời_gian dài , dù là bôi ngoài da hay tiêm , có_thể dẫn đến da mỏng và đổi màu . Các tác_dụng phụ khác có_thể bao_gồm dễ bị bầm tím , thay_đổi phân_bố mỡ trong cơ_thể và trong một_số trường_hợp , thay_đổi tâm_trạng . 2 . Liệu_pháp miễn_dịch tại_chỗ : Phương_pháp điều_trị này có_thể dẫn đến phản_ứng dị_ứng , đặc_trưng bởi đỏ , ngứa và khó_chịu tại vị_trí bôi thuốc . 3 . Minoxidil : Tác_dụng phụ của minoxidil có_thể bao_gồm kích_ứng da đầu , mọc lông không mong_muốn ở các vùng lân_cận và nhịp tim nhanh . 4 . Thuốc ức_chế miễn_dịch : Thuốc ức_chế hệ miễn_dịch có_thể làm tăng nguy_cơ nhiễm_trùng và có_thể gây ra các tác_dụng phụ khác như buồn_nôn , đau bụng và tổn_thương gan . Điều này rất quan_trọng Các phương_pháp điều_trị rụng tóc từng mảng có tác_dụng phụ nào không ?
    Mặc_dù chốc_lở thường là một tình_trạng nhẹ và tự khỏi , nhưng nếu không được điều_trị , đôi_khi nó có_thể dẫn đến các biến_chứng như : 1 . Viêm mô tế_bào : Đây là một bệnh nhiễm_trùng da nghiêm_trọng hơn ảnh_hưởng đến các lớp sâu hơn của da . 2 . Viêm thận ( viêm cầu thận sau nhiễm liên cầu_khuẩn ) : Đây là một biến_chứng hiếm gặp có_thể xảy ra sau khi nhiễm liên cầu_khuẩn , có khả_năng dẫn đến tổn_thương thận . 3 . Sẹo : Nếu vết loét trên da lớn , chúng có_thể để lại sẹo nhỏ khi lành . 4 . MRSA ( tụ cầu vàng kháng methicillin ) : Đây là một loại vi_khuẩn tụ cầu kháng nhiều loại kháng_sinh . Nếu bạn nghi_ngờ mình bị chốc_lở , điều quan_trọng là phải tham_khảo ý_kiến của nhà cung_cấp dịch_vụ chăm_sóc sức_khỏe để ngăn_ngừa những biến_chứng tiềm_ẩn này . Những biến_chứng tiềm_ẩn của bệnh chốc_lở không được điều_trị là gì ?
  • Loss: MatryoshkaLoss with these parameters:
    {
        "loss": "MultipleNegativesRankingLoss",
        "matryoshka_dims": [
            768,
            512,
            256,
            128,
            64
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

Evaluation Dataset

json

  • Dataset: json
  • Size: 146 evaluation samples
  • Columns: positive and anchor
  • Approximate statistics based on the first 146 samples:
    positive anchor
    type string string
    details
    • min: 59 tokens
    • mean: 142.4 tokens
    • max: 220 tokens
    • min: 9 tokens
    • mean: 15.07 tokens
    • max: 30 tokens
  • Samples:
    positive anchor
    Mặc_dù viêm mô tế_bào cần được điều_trị y_tế ( thường là kháng_sinh ) , nhưng có những bước mà người_bệnh có_thể thực_hiện_tại nhà để kiểm_soát các triệu_chứng và đẩy nhanh quá_trình phục_hồi : 1 . Nghỉ_ngơi và nâng cao vùng bị nhiễm_trùng : Điều này có_thể giúp giảm sưng và giảm khó_chịu . 2 . Sử_dụng thuốc giảm đau không kê đơn : Thuốc giảm đau không kê đơn như ibuprofen hoặc acetaminophen có_thể giúp kiểm_soát cơn đau và hạ sốt . 3 . Giữ đủ nước : Uống đủ nước hỗ_trợ hệ_thống miễn_dịch và sức_khỏe tổng_thể của bạn . 4 . Đắp khăn mát , ẩm lên vùng bị ảnh_hưởng : Điều này có_thể làm dịu da và giảm đau . Hãy nhớ rằng những biện_pháp khắc_phục này chỉ nhằm mục_đích bổ_sung chứ không thay_thế điều_trị y_tế . Điều quan_trọng là phải được chăm_sóc y_tế khi bị viêm mô tế_bào để tránh các biến_chứng . Một_số biện_pháp khắc_phục tại nhà hiệu_quả để kiểm_soát các triệu_chứng của bệnh viêm mô tế_bào là gì ?
    Sơ_cứu bỏng nhẹ bao_gồm các bước sau : 1 . Làm mát vết bỏng : Đặt vùng bị bỏng dưới vòi_nước mát ( không lạnh ) đang chảy trong 10 đến 15 phút hoặc cho đến khi cơn đau dịu đi . Bạn cũng có_thể chườm gạc ướt , mát lên vùng bị bỏng . 2 . Bảo_vệ vết bỏng : Che vết bỏng bằng băng vô_trùng , không dính hoặc vải sạch . 3 . Giảm đau : Thuốc giảm đau không kê đơn có_thể giúp giảm đau và giảm viêm . 4 . Giữ đủ nước : Uống nhiều nước , vì bỏng có_thể khiến bạn dễ bị mất nước . 5 . Theo_dõi nhiễm_trùng : Theo_dõi vết bỏng để tìm các dấu_hiệu nhiễm_trùng , chẳng_hạn như đau tăng lên , đỏ , sốt , sưng hoặc rỉ dịch . Nếu nhiễm_trùng phát_triển , hãy tìm_kiếm sự trợ_giúp y_tế ngay lập_tức . Hãy nhớ rằng , các vết bỏng nghiêm_trọng cần được chuyên_gia chăm_sóc sức_khỏe kiểm_tra . Nếu vết bỏng lớn hơn , nếu nó Các biện_pháp sơ_cứu cho vết bỏng nhẹ là gì ?
    Có , một_số thay_đổi lối sống nhất_định có_thể giúp kiểm_soát viêm da cơ : 1 . Tập_thể_dục thường_xuyên : Mặc_dù nghỉ_ngơi rất quan_trọng trong quá_trình viêm hoạt_động , nhưng hoạt_động thể_chất thường_xuyên có_thể giúp duy_trì và cải_thiện sức_mạnh và độ linh_hoạt của cơ . 2 . Chế_độ ăn_uống lành_mạnh : Chế_độ ăn_uống cân_bằng có_thể cung_cấp các chất dinh_dưỡng cần_thiết cho sức_khỏe tổng_thể và năng_lượng . 3 . Chống nắng : Bảo_vệ da khỏi ánh nắng mặt_trời có_thể giúp ngăn_ngừa phát_ban da liên_quan đến viêm da cơ . 4 . Nghỉ_ngơi : Ngủ đủ giấc và nghỉ_ngơi có_thể giúp cơ_thể phục_hồi và kiểm_soát tình_trạng mệt_mỏi . 5 . Kiểm_tra sức_khỏe định_kỳ : Theo_dõi thường_xuyên có_thể giúp phát_hiện sớm bất_kỳ thay_đổi hoặc biến_chứng nào . Hãy nhớ rằng , điều quan_trọng là phải thảo_luận về bất_kỳ thay_đổi lối sống nào với nhà cung_cấp dịch_vụ chăm_sóc sức_khỏe của bạn để đảm_bảo chúng phù_hợp với tình_trạng cụ_thể của bạn . Có bất_kỳ thay_đổi lối sống nào có_thể giúp kiểm_soát bệnh viêm da cơ không ?
  • Loss: MatryoshkaLoss with these parameters:
    {
        "loss": "MultipleNegativesRankingLoss",
        "matryoshka_dims": [
            768,
            512,
            256,
            128,
            64
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: epoch
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • gradient_accumulation_steps: 4
  • learning_rate: 1e-05
  • weight_decay: 0.1
  • num_train_epochs: 5
  • lr_scheduler_type: cosine
  • warmup_ratio: 0.1
  • fp16: True
  • load_best_model_at_end: True
  • group_by_length: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: epoch
  • 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: 4
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 1e-05
  • weight_decay: 0.1
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 5
  • max_steps: -1
  • lr_scheduler_type: cosine
  • 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: True
  • 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: True
  • 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
  • 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 dim_768_cosine_ndcg@10 dim_512_cosine_ndcg@10 dim_256_cosine_ndcg@10 dim_128_cosine_ndcg@10 dim_64_cosine_ndcg@10
1.0 10 7.5644 1.4237 0.6177 0.6135 0.6115 0.6028 0.5717
2.0 20 4.0176 1.1306 0.6660 0.6629 0.6540 0.6511 0.6302
3.0 30 2.933 1.0524 0.6766 0.6717 0.6595 0.6748 0.6560
4.0 40 2.7869 1.0289 0.6823 0.6749 0.6647 0.6826 0.6702
5.0 50 2.7914 1.0223 0.6822 0.6749 0.6668 0.6832 0.6705
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.11.13
  • Sentence Transformers: 4.1.0
  • Transformers: 4.52.4
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.8.1
  • Datasets: 3.6.0
  • Tokenizers: 0.21.2

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",
}

MatryoshkaLoss

@misc{kusupati2024matryoshka,
    title={Matryoshka Representation Learning},
    author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
    year={2024},
    eprint={2205.13147},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

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}
}
Downloads last month
6
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for NamCr17/bkai-fine-tuned-dermatology

Finetuned
(45)
this model

Evaluation results