SentenceTransformer based on vinai/phobert-base-v2
This is a sentence-transformers model finetuned from vinai/phobert-base-v2 on the dataset_full_fixed 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: vinai/phobert-base-v2
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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("phobert-base-v2-gloss")
# Run inference
sentences = [
'Mô tả ngắn:\nThuốc A.T Simvastatin 20 là sản phẩm Công ty Cổ phần Dược phẩm An Thiên, có thành phần chính là Simvastatin. Đây là thuốc được sử dụng để điều trị bổ sung cùng chế độ ăn kiêng để giảm hiện tượng tăng cholesterol toàn phần (C-toàn phần), cholesterol lipoprotein tỉ trọng thấp (LDL-C), apolipoprotein B (Apo B), triglyceride (TG), và cholesterol lipoprotein tỉ trọng không cao (không-HDL-C), và để tăng cholesterol lipoprotein tỉ trọng cao (HDL-C) ở bệnh nhân có tăng cholesterol máu nguyên phát (dị hợp tử có tính chất gia đình và không có tính chất gia đình) hoặc tăng lipid máu hỗn hợp.\nThành phần:\nSimvastatin: 20mg\nChỉ định:\nThuốc A.T Simvastatin 20 được chỉ định dùng trong các trường hợp sau:\nTăng cholesterol máu nguyên phát, thuốc được chỉ định như điều trị bổ sung cùng chế độ ăn kiêng để giảm hiện tượng tăng cholesterol toàn phần (C-toàn phần), cholesterol lipoprotein tỉ trọng thấp (LDL-C), apolipoprotein B (Apo B), triglyceride (TG), và cholesterol lipoprotein tỉ trọng không cao (không-HDL-C), và để tăng cholesterol lipoprotein tỉ trọng cao (HDL-C) ở bệnh nhân có tăng cholesterol máu nguyên phát (dị hợp tử có tính chất gia đình và không có tính chất gia đình) hoặc tăng lipid máu hỗn hợp.',
'Thuốc A.T Simvastatin 20mg An Thiên điều trị Tăng cholesterol máu nguyên phát (3 vỉ x 10 viên)',
'Chào BS,\r\n\r\nBS cho em hỏi mẹ em bị đau tất cả các khớp, có thuốc nào tốt không và em nghe có thuốc Glucosamin. Mẹ em bị viêm tai và đau họng thì không dùng được phải không ạ? Mong nhận được phản hồi từ BS. Em cảm ơn.',
]
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
- Dataset:
dim_768
- Evaluated with
InformationRetrievalEvaluator
with these parameters:{ "truncate_dim": 768 }
Metric | Value |
---|---|
cosine_accuracy@1 | 0.649 |
cosine_accuracy@3 | 0.7725 |
cosine_accuracy@5 | 0.8141 |
cosine_accuracy@10 | 0.8698 |
cosine_precision@1 | 0.649 |
cosine_precision@3 | 0.2575 |
cosine_precision@5 | 0.1628 |
cosine_precision@10 | 0.087 |
cosine_recall@1 | 0.649 |
cosine_recall@3 | 0.7725 |
cosine_recall@5 | 0.8141 |
cosine_recall@10 | 0.8698 |
cosine_ndcg@10 | 0.7567 |
cosine_mrr@10 | 0.7209 |
cosine_map@100 | 0.7262 |
Training Details
Training Dataset
dataset_full_fixed
- Dataset: dataset_full_fixed at ef2e7fd
- Size: 43,803 training samples
- Columns:
positive
andquery
- Approximate statistics based on the first 1000 samples:
positive query type string string details - min: 31 tokens
- mean: 184.76 tokens
- max: 256 tokens
- min: 5 tokens
- mean: 74.27 tokens
- max: 256 tokens
- Samples:
positive query Chào em, Trước hết, em đã điều trị đứt dây chằng chéo trước chưa? Nếu em đã phẫu thuật điều trị đứt dây chằng chéo trước thì sau 3 tháng, em có thể bắt đầu tập yoga trở lại, tất nhiên là phải tập từ từ theo sức mình, các động tác từ dễ đến khó. Nếu em chưa điều trị đứt dây chằng chéo trước thì việc chơi các môn thể thao, kể cả yoga, cần tránh các động tác dùng đến cẳng chân - khớp gối vì có nguy cơ trật khớp. Khi bị dứt dây chằng chéo trước, phần mâm chày của cẳng chân có xu hướng bị bán trật ra trước lúc chạy nhảy, xoay người. Những người bị đứt dây chằng chéo trước đôi khi không biết mình bị đứt dây chằng mà chỉ thấy lâu lâu bị sụm té, nhất là khi chạy, nhảy, leo cầu thang hay khi đi nhanh và xoay người đột ngột. Sự bán trật khớp gối của người bị đứt dây chằng chéo trước khiến việc vận động mạnh của bệnh nhân hạn chế, mặt khác khớp gối thoái hóa do khớp gối bị bán trật thường xuyên. Đó là lý do khiến các bác sĩ phải mổ để tái tạo dây chằng chéo trước cho bệnh nhân. Đứt dây chằng thì ...
Em bị dứt dây chằng chéo trước, vậy có thể tập được yoga không bác sĩ? Mong bác sĩ cho em lời khuyên ạ.
Chào em, Hình ảnh X-quang như trên là bằng chứng gợi ý . Tuy nhiên, em cần làm thêm xét nghiệm đàm, tìm vi khuẩn lao (gọi là AFB đàm) làm tối thiểu 3 mẫu, nếu có 1 mẫu dương tính được chẩn đoán xác định lao phổi, em sẽ được điều trị tại trạm chống lao địa phương hoặc tại BV Phạm Ngọc Thạch tùy theo hiện trạng sức khỏe hiện tại. Trường hợp 3 mẫu đàm âm tính, nếu có các triệu chứng nhiễm lao chung em sẽ được làm thêm 3 mẫu đàm nữa và được hội chuẩn với chuyên gia hô hấp để xem xét điều trị lao. Thân mến!
Xin chào bác sĩ,
Kết quả X-quang là thâm nhiễm xơ vùng trên và sườn phải, vùng giữa bên trái. BS chẩn đoán là lao phổi có đúng không? Nếu chưa đủ kết luận thì làm thêm xét nghiệm gì nữa ạ? Xin cảm ơn BS.Chỉ số đường huyết lúc đói ở mức 5,45 mmol/L là bình thường Chào bạn Đường huyết đói được định nghĩa là đường huyết đo sau khi nhịn ăn ít nhất 8 giờ, lấy máu tĩnh mạch và buổi sáng. Đường huyết đói có chỉ số bình thường 70-100 mg/dL tương ứng 3,88- 5,55 mmol/L theo tiêu chuẩn Hiệp hội Đái tháo đường Hoa Kỳ (ADA). Do đó, đường huyết đói của bạn ở mức 5,42 là trong giới hạn bình thường bạn nhé!
Chào bác sĩ,Kết quả xét nghiệm glucose lúc đói của em có chỉ số 5,42mmol/L. Như vậy có ổn không ạ?
- Loss:
GISTEmbedLoss
with these parameters:{'guide': SentenceTransformer( (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: XLMRobertaModel (1): Pooling({'word_embedding_dimension': 1024, '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}) (2): Normalize() ), 'temperature': 0.01, 'margin_strategy': 'absolute', 'margin': 0.0}
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: epochper_device_train_batch_size
: 200per_device_eval_batch_size
: 200learning_rate
: 1e-06num_train_epochs
: 5lr_scheduler_type
: constant_with_warmupwarmup_ratio
: 0.1bf16
: Truetf32
: Falseload_best_model_at_end
: Trueoptim
: adamw_torch_fusedbatch_sampler
: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: epochprediction_loss_only
: Trueper_device_train_batch_size
: 200per_device_eval_batch_size
: 200per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 1e-06weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 5max_steps
: -1lr_scheduler_type
: constant_with_warmuplr_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
: Truefp16
: Falsefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Falselocal_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_torch_fusedoptim_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
: Falsehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseeval_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
: Falseeval_use_gather_object
: Falseprompts
: Nonebatch_sampler
: no_duplicatesmulti_dataset_batch_sampler
: proportional
Training Logs
Click to expand
Epoch | Step | Training Loss | dim_768_cosine_ndcg@10 |
---|---|---|---|
-1 | -1 | - | 0.1484 |
0.0455 | 10 | 11.4251 | - |
0.0909 | 20 | 11.4794 | - |
0.1364 | 30 | 11.3822 | - |
0.1818 | 40 | 10.7379 | - |
0.2273 | 50 | 10.3104 | - |
0.2727 | 60 | 9.7628 | - |
0.3182 | 70 | 8.6263 | - |
0.3636 | 80 | 8.1373 | - |
0.4091 | 90 | 7.1869 | - |
0.4545 | 100 | 6.3167 | - |
0.5 | 110 | 5.3152 | - |
0.5455 | 120 | 4.5314 | - |
0.5909 | 130 | 3.752 | - |
0.6364 | 140 | 3.3901 | - |
0.6818 | 150 | 2.947 | - |
0.7273 | 160 | 2.5918 | - |
0.7727 | 170 | 2.4167 | - |
0.8182 | 180 | 2.2655 | - |
0.8636 | 190 | 2.0746 | - |
0.9091 | 200 | 1.9378 | - |
0.9545 | 210 | 1.8902 | - |
1.0 | 220 | 1.5983 | 0.5831 |
1.0455 | 230 | 1.6749 | - |
1.0909 | 240 | 1.5945 | - |
1.1364 | 250 | 1.5606 | - |
1.1818 | 260 | 1.4134 | - |
1.2273 | 270 | 1.3958 | - |
1.2727 | 280 | 1.416 | - |
1.3182 | 290 | 1.4131 | - |
1.3636 | 300 | 1.2604 | - |
1.4091 | 310 | 1.2475 | - |
1.4545 | 320 | 1.1835 | - |
1.5 | 330 | 1.1184 | - |
1.5455 | 340 | 1.1365 | - |
1.5909 | 350 | 1.1258 | - |
1.6364 | 360 | 1.0866 | - |
1.6818 | 370 | 1.1356 | - |
1.7273 | 380 | 1.094 | - |
1.7727 | 390 | 1.0312 | - |
1.8182 | 400 | 1.0143 | - |
1.8636 | 410 | 0.943 | - |
1.9091 | 420 | 0.9405 | - |
1.9545 | 430 | 0.9687 | - |
2.0 | 440 | 0.8296 | 0.7100 |
2.0455 | 450 | 0.951 | - |
2.0909 | 460 | 0.9334 | - |
2.1364 | 470 | 0.8836 | - |
2.1818 | 480 | 0.8543 | - |
2.2273 | 490 | 0.9503 | - |
2.2727 | 500 | 0.8737 | - |
2.3182 | 510 | 0.8757 | - |
2.3636 | 520 | 0.8313 | - |
2.4091 | 530 | 0.7678 | - |
2.4545 | 540 | 0.8151 | - |
2.5 | 550 | 0.8573 | - |
2.5455 | 560 | 0.7598 | - |
2.5909 | 570 | 0.8508 | - |
2.6364 | 580 | 0.7947 | - |
2.6818 | 590 | 0.771 | - |
2.7273 | 600 | 0.8582 | - |
2.7727 | 610 | 0.7967 | - |
2.8182 | 620 | 0.8315 | - |
2.8636 | 630 | 0.8048 | - |
2.9091 | 640 | 0.8296 | - |
2.9545 | 650 | 0.7431 | - |
3.0 | 660 | 0.7041 | 0.7339 |
3.0455 | 670 | 0.7783 | - |
3.0909 | 680 | 0.7217 | - |
3.1364 | 690 | 0.7571 | - |
3.1818 | 700 | 0.6938 | - |
3.2273 | 710 | 0.7176 | - |
3.2727 | 720 | 0.7291 | - |
3.3182 | 730 | 0.7894 | - |
3.3636 | 740 | 0.7121 | - |
3.4091 | 750 | 0.7371 | - |
3.4545 | 760 | 0.6819 | - |
3.5 | 770 | 0.7264 | - |
3.5455 | 780 | 0.6336 | - |
3.5909 | 790 | 0.7073 | - |
3.6364 | 800 | 0.7376 | - |
3.6818 | 810 | 0.7071 | - |
3.7273 | 820 | 0.6733 | - |
3.7727 | 830 | 0.7581 | - |
3.8182 | 840 | 0.6735 | - |
3.8636 | 850 | 0.6495 | - |
3.9091 | 860 | 0.6835 | - |
3.9545 | 870 | 0.684 | - |
4.0 | 880 | 0.6506 | 0.7478 |
4.0455 | 890 | 0.6689 | - |
4.0909 | 900 | 0.6441 | - |
4.1364 | 910 | 0.7037 | - |
4.1818 | 920 | 0.5784 | - |
4.2273 | 930 | 0.663 | - |
4.2727 | 940 | 0.7332 | - |
4.3182 | 950 | 0.6072 | - |
4.3636 | 960 | 0.636 | - |
4.4091 | 970 | 0.6488 | - |
4.4545 | 980 | 0.6635 | - |
4.5 | 990 | 0.6138 | - |
4.5455 | 1000 | 0.6488 | - |
4.5909 | 1010 | 0.5974 | - |
4.6364 | 1020 | 0.6348 | - |
4.6818 | 1030 | 0.6153 | - |
4.7273 | 1040 | 0.6438 | - |
4.7727 | 1050 | 0.6058 | - |
4.8182 | 1060 | 0.6368 | - |
4.8636 | 1070 | 0.6268 | - |
4.9091 | 1080 | 0.6126 | - |
4.9545 | 1090 | 0.5718 | - |
5.0 | 1100 | 0.5638 | 0.7567 |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 4.1.0
- Transformers: 4.44.2
- PyTorch: 2.7.0+cu128
- Accelerate: 1.7.0
- Datasets: 3.6.0
- Tokenizers: 0.19.1
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",
}
GISTEmbedLoss
@misc{solatorio2024gistembed,
title={GISTEmbed: Guided In-sample Selection of Training Negatives for Text Embedding Fine-tuning},
author={Aivin V. Solatorio},
year={2024},
eprint={2402.16829},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
- Downloads last month
- 4
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for thang1943/phobert-base-v2-gloss
Base model
vinai/phobert-base-v2Dataset used to train thang1943/phobert-base-v2-gloss
Evaluation results
- Cosine Accuracy@1 on dim 768self-reported0.649
- Cosine Accuracy@3 on dim 768self-reported0.772
- Cosine Accuracy@5 on dim 768self-reported0.814
- Cosine Accuracy@10 on dim 768self-reported0.870
- Cosine Precision@1 on dim 768self-reported0.649
- Cosine Precision@3 on dim 768self-reported0.257
- Cosine Precision@5 on dim 768self-reported0.163
- Cosine Precision@10 on dim 768self-reported0.087
- Cosine Recall@1 on dim 768self-reported0.649
- Cosine Recall@3 on dim 768self-reported0.772