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-otc-loss")
# Run inference
sentences = [
'Viêm mũi dị ứng không chỉ ảnh hưởng trực tiếp tới sức khỏe mà còn gây ra không ít phiền toái trong cuộc sống hằng ngày Xin chào bạn, Bệnh lý Viêm mũi dị ứng cơ chế do phản ứng dị ứng quá mẫn của cơ thể với các tác động của môi trường (không khí lạnh, phấn hoa, bụi bẩn …). Thuốc điều trị chủ yếu là nhóm kháng Histamin (Cetirizine và các loại thuốc tương tự khác), thật ra sử dụng kháng histamin kéo dài là đặc thù của bệnh nhân có bệnh lý dị ứng. Cũng chưa thấy đề cập đến những vấn đề nguy hiểm khi sử dụng thuốc kháng Histamin lâu dài – có vài loại thuốc gây khô họng miệng nhưng không đáng kể và các thế hệ thuốc sau thì tác dụng phụ này ngày càng giảm. Bạn đừng quá lo lắng nữa nhé.\xa0Bên cạnh việc sử dụng thuốc, nhớ làm sạch môi trường sinh hoạt xung quanh để giảm thiểu nguy cơ làm bệnh lý viêm mũi dị ứng nặng hơn. Thân ái chào bạn.',
'Em có vấn đề thắc mắc xin được Bác sĩ giải đáp giúp ạ.Em đi khám và Bác sĩ kết luận em bị viêm mũi dị ứng. Cho thuốc cetirizin 10 mg ngày uống 1 viên. Prednisolon 5 mg ngày uống 1 viên (Bác sĩ khám có dặn là prednisolon không được uống kéo dài).Khi còn uống thuốc thì em không bị hắt hơi, sổ mũi mà hết uống lại bị. Do bác sĩ dặn kg uống pred kéo dài, nên em chỉ uống cetirizin 10 mg ngày uống 1 viên nhưng ngày nào cũng uống (vì không uống là không cắt được cơn hắt hơi, sổ mũi).Liệu uống cetirizin liên tục trong 1 thời gian dài có bị ảnh hưởng gì không bác sĩ? Nhưng không uống thì em hắt hơi miết không làm được việc gì hết ạ. Em rất bế tắc, mong nhận được hồi âm từ BS!',
'Chào bác sĩ. Em năm nay 18 tuổi, năm 8 tuổi em bị tai nạn khiến 1 mắt bị lác, vậy giờ em có thể phẫu thuật kéo mắt lại không ạ?',
]
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.6598 |
cosine_accuracy@3 | 0.7874 |
cosine_accuracy@5 | 0.8307 |
cosine_accuracy@10 | 0.8848 |
cosine_precision@1 | 0.6598 |
cosine_precision@3 | 0.2625 |
cosine_precision@5 | 0.1661 |
cosine_precision@10 | 0.0885 |
cosine_recall@1 | 0.6598 |
cosine_recall@3 | 0.7874 |
cosine_recall@5 | 0.8307 |
cosine_recall@10 | 0.8848 |
cosine_ndcg@10 | 0.7706 |
cosine_mrr@10 | 0.7344 |
cosine_map@100 | 0.739 |
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: 37 tokens
- mean: 187.21 tokens
- max: 256 tokens
- min: 6 tokens
- mean: 77.0 tokens
- max: 256 tokens
- Samples:
positive query Chào bạn, /mẻ gây nhạy cảm thì chỉ cần trám lại là sẽ bớt ngay. Tuy nhiên độ bền thì còn tùy thuộc vào vị trí gãy/vỡ/mẻ cũng như độ lớn của vùng đó. Nếu bạn bị vỡ hết cả nửa răng thì trám lại chắc chỉ được vài tháng là sẽ bị bong miếng trám ra mất do miếng trám quá lớn còn răng thì quá yếu. Vì vậy bạn nên đi khám bác sĩ xem thử có trám lại bền được không, nếu không thì bạn phải bọc răng sứ thì mới bền được. Thân mến,
Chào bác sĩ,
Răng của em bị vỡ nửa cái do em bị tai nạn, giờ cảm thấy đau buốt khi nuốt nước bọt và khi uống nước lạnh. Có thể khắc phục được không, thưa BS?Chào em, Khi một số trường hợp có thể gây sang chấn, dẫn đến hiện tượng chảy máu, chảy dịch hồng như em mô tả. Tuy nhiên hiện tượng này có thể tự giới hạn. Trường hợp của em, nếu vẫn tiếp tục chảy dịch hồng hoặc chảy máu tươi, em nên tái khám để tìm nguyên nhân và điều trị em nhé.
Chào bác sĩ,
2 ngày trước em đi khám, được chuẩn đoán là viêm mũi - viêm xoang, ghi trong toa là “Proezt”. Sau khi hút xoang xong cỡ 30 phút trong mũi trái của em có máu chảy ra. Đến giờ dịch nhầy ở mũi trái của em có màu đỏ. Em có sử dụng thuốc xịt mũi nhưng tình hình không khả quan hơn. Mong BS tư vấn ạ.Chào em, Khi bị viêm, mắt có triệu chứng sưng, đau, gỉ mắt làm cho 2 mí dính lại và khó mở ra vào buổi sáng. Em nên đến khám BS Mắt để xem lại chẩn đoán, tìm nguyên nhân và kê toa thuốc nhỏ mắt thích hợp nhé. Thân mến!
BS ơi,
Sáng sớm ngủ dậy tự nhiên mắt em mở không lên. Một hồi sau mới mở mắt được ạ. Sau đó thì nó sưng lên và đau thì làm sao ạ? BS tư vấn giúp em với. Em không có bị ngứa mắt ạ. - 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
: 40per_device_eval_batch_size
: 40learning_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
: 40per_device_eval_batch_size
: 40per_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
Epoch | Step | Training Loss | dim_768_cosine_ndcg@10 |
---|---|---|---|
0.0912 | 100 | 9.312 | - |
0.1825 | 200 | 7.4093 | - |
0.2737 | 300 | 3.8224 | - |
0.3650 | 400 | 1.6865 | - |
0.4562 | 500 | 1.1151 | - |
0.5474 | 600 | 0.8235 | - |
0.6387 | 700 | 0.6362 | - |
0.7299 | 800 | 0.6181 | - |
0.8212 | 900 | 0.5331 | - |
0.9124 | 1000 | 0.4978 | - |
1.0 | 1096 | - | 0.6982 |
1.0036 | 1100 | 0.4167 | - |
1.0949 | 1200 | 0.4154 | - |
1.1861 | 1300 | 0.3793 | - |
1.2774 | 1400 | 0.3905 | - |
1.3686 | 1500 | 0.3534 | - |
1.4599 | 1600 | 0.3538 | - |
1.5511 | 1700 | 0.3357 | - |
1.6423 | 1800 | 0.2892 | - |
1.7336 | 1900 | 0.2882 | - |
1.8248 | 2000 | 0.2902 | - |
1.9161 | 2100 | 0.3083 | - |
2.0 | 2192 | - | 0.7386 |
2.0073 | 2200 | 0.2854 | - |
2.0985 | 2300 | 0.2546 | - |
2.1898 | 2400 | 0.2759 | - |
2.2810 | 2500 | 0.2525 | - |
2.3723 | 2600 | 0.2735 | - |
2.4635 | 2700 | 0.2576 | - |
2.5547 | 2800 | 0.2525 | - |
2.6460 | 2900 | 0.2545 | - |
2.7372 | 3000 | 0.2627 | - |
2.8285 | 3100 | 0.2494 | - |
2.9197 | 3200 | 0.2404 | - |
3.0 | 3288 | - | 0.7531 |
3.0109 | 3300 | 0.2284 | - |
3.1022 | 3400 | 0.226 | - |
3.1934 | 3500 | 0.212 | - |
3.2847 | 3600 | 0.2228 | - |
3.3759 | 3700 | 0.2132 | - |
3.4672 | 3800 | 0.1971 | - |
3.5584 | 3900 | 0.2004 | - |
3.6496 | 4000 | 0.2247 | - |
3.7409 | 4100 | 0.2226 | - |
3.8321 | 4200 | 0.2064 | - |
3.9234 | 4300 | 0.1961 | - |
4.0 | 4384 | - | 0.7638 |
4.0146 | 4400 | 0.1811 | - |
4.1058 | 4500 | 0.1722 | - |
4.1971 | 4600 | 0.1732 | - |
4.2883 | 4700 | 0.1954 | - |
4.3796 | 4800 | 0.203 | - |
4.4708 | 4900 | 0.184 | - |
4.5620 | 5000 | 0.189 | - |
4.6533 | 5100 | 0.1932 | - |
4.7445 | 5200 | 0.1596 | - |
4.8358 | 5300 | 0.1756 | - |
4.9270 | 5400 | 0.188 | - |
5.0 | 5480 | - | 0.7706 |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.10.18
- 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-otc-loss
Base model
vinai/phobert-base-v2Dataset used to train thang1943/phobert-base-v2-otc-loss
Evaluation results
- Cosine Accuracy@1 on dim 768self-reported0.660
- Cosine Accuracy@3 on dim 768self-reported0.787
- Cosine Accuracy@5 on dim 768self-reported0.831
- Cosine Accuracy@10 on dim 768self-reported0.885
- Cosine Precision@1 on dim 768self-reported0.660
- Cosine Precision@3 on dim 768self-reported0.262
- Cosine Precision@5 on dim 768self-reported0.166
- Cosine Precision@10 on dim 768self-reported0.088
- Cosine Recall@1 on dim 768self-reported0.660
- Cosine Recall@3 on dim 768self-reported0.787