iambestfeed/phobert-base-v2-finetuned-filtered_data_wseg-lr5e-06-1-epochs-bs-16
SentenceTransformer based on vinai/phobert-base-v2
This is a sentence-transformers model finetuned from vinai/phobert-base-v2 on the vnexpress-data-similarity 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 <!-- at revision e2375d266bdf39c6e8e9a87af16a5da3190b0cc8 -->
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
- vnexpress-data-similarity <!-- - Language: Unknown --> <!-- - License: Unknown -->
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-transformersThen you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("iambestfeed/phobert-base-v2-finetuned-filtered_data_wseg-lr5e-06")
# Run inference
sentences = [
'Động_đất mạnh 5,6 độ ở tỉnh Tây_Java của Indonesia khiến ít_nhất 44 người thiệt_mạng , nhiều nhà_cửa tại thủ_đô Jakarta cũng bị rung_chuyển . - VnExpress',
'Cơ_quan Khí_tượng , Khí_hậu và Địa_vật_lý Indonesia ( BMKG ) cho biết trận động_đất mạnh 5,6 độ xảy ra lúc 13h21 hôm_nay , tâm chấn nằm trên đất_liền ở độ sâu 10 km tại tỉnh Tây_Java , cách thủ_đô Jakarta khoảng 100 km về phía nam . Trong khi đó , Cơ_quan Khảo_sát Địa_chất Mỹ ( USGS ) cho biết trận động_đất mạnh 5,4 độ . USGS xác_định những trận động_đất có tâm chấn ở độ sâu dưới 70 km là " tâm chấn nông " và chúng thường gây thiệt_hại nặng_nề hơn so với " tâm chấn sâu " . \n BMKG nói rằng không có nguy_cơ xảy ra sóng_thần sau trận động_đất . \n " Hàng trăm , thậm_chí có_thể hàng nghìn ngôi nhà bị hư_hại . 44 người đã thiệt_mạng " , Adam , phát_ngôn_viên của chính_quyền địa_phương tại thị_trấn Cianjur ở Tây_Java , nói với AFP. \n Herman_Suherman , lãnh_đạo thị_trấn Cianjur , trước đó nói trên truyền_hình rằng chỉ riêng một trong 4 bệnh_viện tại đây đã ghi_nhận gần 20 người chết và ít_nhất 300 người bị_thương . " Phần_lớn nạn_nhân bị_thương do mắc_kẹt dưới đống đổ_nát " , ông cho biết và cảnh_báo con_số thương_vong có_thể tăng thêm . \n Nhân_chứng cho biết nhiều tòa nhà tại Jakarta bị rung_chuyển , khiến không ít người phải sơ_tán khỏi các văn_phòng ở quận trung_tâm thủ_đô . Số khác nói rằng họ cảm_nhận được các tòa nhà rung lắc và chứng_kiến đồ_đạc di_chuyển . \n " Tôi đang làm_việc thì sàn nhà rung_chuyển , tôi có_thể cảm_nhận chấn_động rất rõ_ràng " , Mayadita_Waluyo , một luật_sư 22 tuổi làm_việc tại một tòa nhà_văn_phòng ở Jakarta , kể . " Lúc đó tôi chưa hình_dung được chuyện gì đã xảy ra , nhưng rung lắc ngày_càng mạnh hơn và kéo_dài khá lâu " . \n Waluyo cho hay cô và nhiều đồng_nghiệp trong văn_phòng sau đó đã hoảng_hốt chạy xuống cầu_thang bộ để thoát khỏi tòa nhà . \n Indonesia thường_xuyên trải qua các trận động_đất và phun trào núi_lửa do nằm trên " Vành_đai lửa " , một vòng_cung hoạt_động địa_chấn dữ_dội , nơi các mảng kiến_tạo va_chạm kéo_dài từ Nhật_Bản qua Đông_Nam_Á và lưu_vực Thái_Bình_Dương . \n Năm 2004 , trận động_đất 9,1 độ xảy ra ngoài khơi đảo Sumatra , gây ra sóng_thần giết chết 220.000 người khắp khu_vực , trong đó có khoảng 170.000 người ở Indonesia . \n Năm 2018 , một trận động_đất 7,5 độ và sóng_thần theo sau ở Palu trên đảo Sulawesi đã khiến hơn 4.300 người chết và mất_tích . \n Vũ_Anh ( Theo AFP )',
'Nếu mua xe mới tôi phải vay thêm tiền mới đủ lăn bánh_xe cỡ A trong khi mua xe cũ thì có thế chọn xe cỡ B. ( Lan_Anh ) \n >> Xem thêm : cẩm_nang mua xe',
]
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. -->
<!--
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 Dataset
vnexpress-data-similarity
- Dataset: vnexpress-data-similarity at e6cb542
- Size: 74,620 training samples
- Columns: <code>anchor</code> and <code>positive</code>
- Approximate statistics based on the first 1000 samples: | | anchor | positive | |:--------|:------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 18 tokens</li><li>mean: 32.21 tokens</li><li>max: 104 tokens</li></ul> | <ul><li>min: 21 tokens</li><li>mean: 140.01 tokens</li><li>max: 256 tokens</li></ul> |
- Samples: | anchor | positive | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>Gene quyếtđịnh phầnlớn chiều cao của trẻ , những thóiquen sinhhoạt , ănuống cũng ảnhhưởng đến quátrình pháttriển . - VnExpress</code> | <code>Gene quyếtđịnh phầnlớn chiều cao của trẻ , những thóiquen sinhhoạt , ănuống cũng ảnhhưởng đến quátrình pháttriển . <br> Lê Nguyễn ( Theo Timesofindia , WebMD ) <br> Vuilòng điền đầyđủ thôngtin để chúngtôi cóthể hỗtrợ bạn</code> | | <code>H & # 039 ; Hen Niê đưa bốmẹ và cháu gái cùng đi côngtác , VũThuPhương đưa con sang Anh nhậphọc , PhươngTrinh Jolie bế contrai mới sinh , Mạc VănKhoa xúcđộng khi được diễn chung với NSƯT HoàiLinh . - Ngôisao</code> | <code>PhongKiều <br> - Showbiz <br> - Thờitrang <br> - Làmđẹp <br> - Xem <br> - Ănchơi <br> - Lốisống <br> - Thểthao <br> - Thờicuộc <br> - Podcasts <br> - Thươngtrường <br> - Trắcnghiệm <br> - Video <br> - Ảnh <br> - Reviews & Deals <br> H ' Hen Niê đưa bốmẹ và cháu gái cùng đi côngtác , VũThuPhương đưa con sang Anh nhậphọc , PhươngTrinh Jolie bế contrai mới sinh , Mạc VănKhoa xúcđộng khi được diễn chung với NSƯT HoàiLinh . <br> PhongKiều</code> | | <code>Hạtgiống số một giành chiếnthắng với tỷsố 7 - 6 ( 1 ) , 6 - 3 ở trận raquân tại Halle Mởrộng 2019 . - VnExpress</code> | <code>Hạtgiống số một giành chiếnthắng với tỷsố 7 - 6 ( 1 ) , 6 - 3 ở trận raquân tại Halle Mởrộng 2019 . <br> QuangDũng</code> |
- Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 16gradient_accumulation_steps: 5learning_rate: 5e-06warmup_ratio: 0.1save_safetensors: Falsefp16: Truepush_to_hub: Truehub_model_id: iambestfeed/phobert-base-v2-finetuned-filtereddatawseg-lr5e-06batch_sampler: no_duplicates
All Hyperparameters
<details><summary>Click to expand</summary>
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 5eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-06weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 3max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Falsesave_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: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Truedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_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: Trueresume_from_checkpoint: Nonehub_model_id: iambestfeed/phobert-base-v2-finetuned-filtereddatawseg-lr5e-06hub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Falseuse_liger_kernel: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional
</details>
Training Logs
<details><summary>Click to expand</summary>
</details>
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.3.1
- Transformers: 4.47.0
- PyTorch: 2.5.1+cu121
- Accelerate: 1.2.1
- Datasets: 3.3.1
- Tokenizers: 0.21.0
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",
}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}
}<!--
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. -->
