Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper
• 1908.10084 • Published
• 12
This is a sentence-transformers model finetuned from vinai/phobert-base-v2 on the json 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("tanbinh2210/mnrl_phobert-base-v2")
# Run inference
sentences = [
'Quy_trình lọc công_việc theo Người thực_hiện trong dự_án bao_gồm những bước nào ?',
'Tôi có_thể lọc được các công_việc tôi là Người thực_hiện ở trong dự_án không ?\nTại danh_sách công_việc trong dự_án bạn có_thể sử_dụng bộ lọc nâng cao ở thanh tìm_kiếm để lọc danh_sách các công_việc theo Người thực_hiện bằng cách :\nTại màn danh_sách công_việc trong dự_án Chọn tác_vụ Lọc trên Bộ lọc nâng cao\nLọc theo trường Người thực_hiện\nlọc công_việc trong dự_án theo người thực_hiện',
'Hồ_sơ bảo_hiểm\nKê_khai hồ_sơ bảo_hiểm\nKê_khai hồ_sơ bảo_hiểm là một thủ_tục bắt_buộc đối_với các doanh_nghiệp và người lao_động để đảm_bảo quyền_lợi và nghĩa_vụ về bảo_hiểm_xã_hội , bảo_hiểm_y_tế , bảo_hiểm thất_nghiệp .\nDanh_sách HSBH được tự_động cập_nhật từ danh_sách Hồ_sơ nhân_sự ( HSNS ) đang làm_việc trong phân hệ Nhân_sự dựa trên cài_đặt tăng giảm dự_kiến trong IVAN .\nCài_đặt 1 - IVAN\nDưới đây là các bước hướng_dẫn kê_khai và khai_báo HSBH :\nBước 1 : Truy_cập đối_tượng Hồ_sơ bảo_hiểm > Chọn tab Chờ kê_khai > Chọn hồ_sơ muốn khai_báo và nhấn chuột phải > Chọn thủ_tục kê_khai\nBước 1 Kê_khai hồ_sơ bảo_hiểm\nBước 2 : \xa0Điền thông_tin bắt_buộc tại tab Khai_báo > \xa0Nhấn Cập_nhật\nBước 2 Kê_khai hồ_sơ bảo_hiểm\nChú_ý : Đối_với những hồ_sơ chưa đầy_đủ thông_tin , người dùng cần bổ_sung tại các tab Hồ_sơ bảo_hiểm và Thông_tin gia_đình trước khi thực_hiện khai_báo .\nBước 3 : Click vào nhãn của thủ_tục muốn kê_khai > Thực_hiện kê_khai hồ_sơ bảo_hiểm > Nhấn nút Ký & Gửi kê_khai\nBước 3 Kê_khai hồ_sơ bảo_hiểm',
]
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]
question and positive| question | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| question | positive |
|---|---|
Nếu thiếu thông_tin về số người phụ_thuộc trong hồ_sơ nhân_sự thì sẽ ảnh_hưởng như_thế_nào đến quyết_toán thuế ? |
Khắc_phục sự_cố không có thông_tin quyết_toán thuế |
Trong một quy_trình công_việc đang chạy , vai_trò nào cho_phép tôi theo_dõi luồng vận_hành của quy_trình ? |
Quy_trình tự_động |
Trước khi ký và gửi hồ_sơ ngừng dịch_vụ 1 - IVAN lên BHXH , tôi cần kiểm_tra những thông_tin gì trong tờ khai ? |
Ngừng dịch_vụ 1 - IVAN |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
question and positive| question | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| question | positive |
|---|---|
Với vai_trò trưởng bộ_phận , làm_sao để tôi có cái nhìn tổng_quan về đánh_giá cũng như thực_hiện đúng nhiệm_vụ của mình ? |
PHÂN HỆ ĐÁNH_GIÁ |
Tính_năng ' Form báo_cáo ' trong quy_trình mẫu cho_phép người dùng làm gì ? |
Quản_lý quy_trình mẫu |
Sau khi tải plugin ký số về , tôi cần làm gì với file nén này ? |
Ký token là gì ? |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
overwrite_output_dir: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 32gradient_accumulation_steps: 4weight_decay: 0.01num_train_epochs: 10lr_scheduler_type: cosinewarmup_ratio: 0.05fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Truedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 4eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.01adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 10max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.05warmup_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: 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: Falsedataloader_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: {'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_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: 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: Falsebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss |
|---|---|---|
| 0.4878 | 50 | 0.5529 |
| 0.9756 | 100 | 0.1232 |
| 1.4634 | 150 | 0.0636 |
| 1.9512 | 200 | 0.0306 |
| 2.4390 | 250 | 0.0156 |
| 2.9268 | 300 | 0.0111 |
| 3.4146 | 350 | 0.0046 |
| 3.9024 | 400 | 0.0034 |
| 4.3902 | 450 | 0.0025 |
| 4.8780 | 500 | 0.0022 |
| 5.3659 | 550 | 0.0013 |
| 5.8537 | 600 | 0.0013 |
| 6.3415 | 650 | 0.0011 |
| 6.8293 | 700 | 0.0011 |
| 7.3171 | 750 | 0.001 |
| 7.8049 | 800 | 0.0009 |
| 8.2927 | 850 | 0.0009 |
| 8.7805 | 900 | 0.0009 |
| 9.2683 | 950 | 0.0009 |
| 9.7561 | 1000 | 0.0009 |
@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{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}
}
Base model
vinai/phobert-base-v2