CoolFace
Modelpublic

meandyou200175/phobert-finetune

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes103downloads
Model Card

SentenceTransformer based on vinai/phobert-base-v2

This is a sentence-transformers model finetuned from vinai/phobert-base-v2. 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 <!-- at revision e2375d266bdf39c6e8e9a87af16a5da3190b0cc8 -->
  • —Maximum Sequence Length: 256 tokens
  • —Output Dimensionality: 768 tokens
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

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:

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("meandyou200175/phobert-finetune")
# Run inference
sentences = [
    'Bác sĩ cho em hỏi, em bị rạn nứt xương gót chân bên phải. Em bị hơn 1 tháng nay rồi. Em bỏ thuốc lá. Em muốn hỏi bác sĩ thông thường bó bột hơn hay thuốc lá hơn? Như của em khoảng bao lâu thì khỏi? Và giờ em vẫn chưa đi được bác sĩ ạ. Em cảm ơn.',
    'Chào em, Thứ nhất, bắt buộc phải có phim Xquang để biết em có thực sự nứt xương gót hay bị gãy phức tạp hơn, vì nhiều trường hợp tưởng chỉ nứt xương thôi nhưng thật ra là vỡ phức tạp, phải phẫu thuật mới nhanh ổn được. Thứ hai, theo nguyên tắc điều trị nứt gãy xương là phải cố định tốt để can xương mọc ra, chỗ nứt gãy mới được nối liền. Do đó, nếu bó bột thì chân sẽ được cố định liên tục trong 4-6 tuần, còn bó lá thì phải thay thường xuyên, mỗi lần thay là 1 lần xê dịch nên xương khó lành. Tốt hơn hết em nên đến Bệnh viện Chấn thương Chỉnh hình để được kiểm tra và điều trị thích hợp, em nhé. Thân mến.',
    'Chào bạn, Qua hình ảnh sang thương và mô tả triệu chứng, bệnh lý của bạn có khả năng là chàm hay còn gọi là viêm da dị ứng với đặc điểm là viêm và nổi mụn nhỏ, ngứa ngáy. Nguyên nhân của chàm hiện nay chưa rõ nhưng có thể do cơ địa dị ứng (người mắc hen, viêm mũi dị ứng có nguy cơ cao mắc chàm), do kích thích của hóa chất như nước rửa chén, bột giặt, cao su, kim loại, chất liệu giày dép (chàm tiếp xúc),... Thời tiết lạnh, stress, đổ mồ hôi nhiều và phấn hoa... cũng là những nguyên nhân có thể khiến da bị chàm. Chàm cũng có thể gặp ở người bị suy van tĩnh mạch, giãn tĩnh mạch chân khiến tình trạng bệnh dai dẳng, kém đáp ứng điều trị. Điều trị chàm thường phải sử dụng một số loại thuốc bôi da kéo dài, có thể để lại tác dụng phụ, do đó bạn nên khám BS Da liễu để kê toa loại thuốc phù hợp. Ngoài ra, bạn nên chú ý xem có yếu tố nào thường kích thích khởi phát chàm để tránh cho bệnh tái phát bạn nhé! Thân 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]

<!--

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.7045
cosine_accuracy@30.8353
cosine_accuracy@50.8767
cosine_accuracy@100.9231
cosine_precision@10.7045
cosine_precision@30.2784
cosine_precision@50.1753
cosine_precision@100.0923
cosine_recall@10.7045
cosine_recall@30.8353
cosine_recall@50.8767
cosine_recall@100.9231
cosine_ndcg@100.8141
cosine_mrr@100.7792
cosine_map@1000.7828
dot_accuracy@10.6861
dot_accuracy@30.8221
dot_accuracy@50.8698
dot_accuracy@100.9207
dot_precision@10.6861
dot_precision@30.274
dot_precision@50.174
dot_precision@100.0921
dot_recall@10.6861
dot_recall@30.8221
dot_recall@50.8698
dot_recall@100.9207
dot_ndcg@100.8028
dot_mrr@100.7651
dot_map@1000.7689

<!--

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 Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —learning_rate: 2e-05
  • —num_train_epochs: 5
  • —warmup_ratio: 0.1
  • —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: 16
  • —per_device_eval_batch_size: 16
  • —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: 2e-05
  • —weight_decay: 0.0
  • —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: linear
  • —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: 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
  • —use_liger_kernel: False
  • —eval_use_gather_object: False
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

<details><summary>Click to expand</summary>

EpochStepTraining LossValidation Losscosine_map@100
00--0.1388
0.03651002.3162--
0.07302000.6289--
0.10963000.3538--
0.14614000.2815--
0.18265000.2206--
0.21916000.224--
0.25577000.1869--
0.29228000.1742--
0.32879000.1825--
0.365210000.17310.12700.6999
0.401811000.1557--
0.438312000.1845--
0.474813000.1593--
0.511314000.1352--
0.547815000.1573--
0.584416000.1482--
0.620917000.1413--
0.657418000.1315--
0.693919000.1253--
0.730520000.12980.10680.7262
0.767021000.1282--
0.803522000.1052--
0.840023000.1002--
0.876624000.1001--
0.913125000.1233--
0.949626000.1191--
0.986127000.1156--
1.022628000.1026--
1.059229000.0999--
1.095730000.09890.07850.7370
1.132231000.0769--
1.168732000.0839--
1.205333000.0777--
1.241834000.0745--
1.278335000.0676--
1.314836000.0636--
1.351437000.0575--
1.387938000.0403--
1.424439000.0616--
1.460940000.03790.07170.7557
1.497441000.0386--
1.534042000.0346--
1.570543000.0327--
1.607044000.0378--
1.643545000.0265--
1.680146000.0317--
1.716647000.0262--
1.753148000.0275--
1.789649000.025--
1.826250000.0250.06870.7647
1.862751000.0195--
1.899252000.0316--
1.935753000.0368--
1.972254000.029--
2.008855000.0285--
2.045356000.0245--
2.081857000.0208--
2.118358000.0197--
2.154959000.0234--
2.191460000.01950.06820.7699
2.227961000.0233--
2.264462000.0184--
2.300963000.0217--
2.337564000.0233--
2.374065000.016--
2.410566000.0168--
2.447067000.0151--
2.483668000.0123--
2.520169000.0081--
2.556670000.01090.06160.7744
2.593171000.0073--
2.629772000.0088--
2.666273000.0124--
2.702774000.0078--
2.739275000.0066--
2.775776000.0066--
2.812377000.0072--
2.848878000.0066--
2.885379000.0088--
2.921880000.00960.05790.7767
2.958481000.0094--
2.994982000.0084--
3.031483000.008--
3.067984000.0061--
3.104585000.0082--
3.141086000.0056--
3.177587000.005--
3.214088000.0052--
3.250589000.0059--
3.287190000.00710.05920.7757
3.323691000.0059--
3.360192000.0056--
3.396693000.0037--
3.433294000.0068--
3.469795000.0037--
3.506296000.0037--
3.542797000.0041--
3.579398000.0026--
3.615899000.0029--
3.6523100000.00440.06070.7752
3.6888101000.0029--
3.7253102000.003--
3.7619103000.0026--
3.7984104000.0028--
3.8349105000.003--
3.8714106000.0026--
3.9080107000.0029--
3.9445108000.003--
3.9810109000.0022--
4.0175110000.0030.05790.7816
4.0541111000.0024--
4.0906112000.0029--
4.1271113000.0025--
4.1636114000.0024--
4.2001115000.0022--
4.2367116000.0026--
4.2732117000.0022--
4.3097118000.003--
4.3462119000.0023--
4.3828120000.00180.05620.7819
4.4193121000.0022--
4.4558122000.0021--
4.4923123000.0017--
4.5289124000.0016--
4.5654125000.0017--
4.6019126000.0015--
4.6384127000.0017--
4.6749128000.0016--
4.7115129000.0014--
4.7480130000.00150.05610.7828
4.7845131000.0015--
4.8210132000.0012--
4.8576133000.0014--
4.8941134000.0017--
4.9306135000.0018--
4.9671136000.0015--

</details>

Framework Versions

  • —Python: 3.10.14
  • —Sentence Transformers: 3.2.0
  • —Transformers: 4.45.1
  • —PyTorch: 2.4.0
  • —Accelerate: 0.34.2
  • —Datasets: 3.0.1
  • —Tokenizers: 0.20.0

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