Downloads · 30 days
7
4% of all-time downloads
thang1943/phobert-base-v2-otc-loss
phobert-base-v2-otc-loss is a sentence similarity model from thang1943. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model finetuned from vinai/phobert-base-v2 on the datasetfullfixed dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual s…
Downloads · 30 days
7
4% of all-time downloads
All-time downloads
164
Public
Parameters
135M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors540 MB · 100%
From the Hugging Face model README
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.
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})
)
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]
<!--
### 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.*
-->
dim_768{
"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 |
| positive | query | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 37 tokens</li><li>mean: 187.21 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 77.0 tokens</li><li>max: 256 tokens</li></ul> |
| positive | query |
|---|---|
| <code>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,</code> | <code>Chào bác sĩ, |
{'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}
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_duplicatesoverwrite_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| 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 |
@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",
}
@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}
}
<!--
## 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.*
-->