Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 12
This is a sentence-transformers model finetuned from tintnguyen/bert-base-vi-uncased-st-3 on the train 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': 512, 'do_lower_case': False}) with Transformer model: BertModel
(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("tintnguyen/bert-base-vi-uncased-st-4")
# Run inference
sentences = [
'rotheca là gì',
'Rotheca ::: Rotheca là một chi thực vật có hoa trong họ Hoa môi (Lamiaceae).',
'Rothera ::: Trạm Nghiên cứu Rothera là một Cơ sở Khảo sát Nam Cực của Anh (BAS) trên bán đảo Nam Cực, tọa lạc tại Điểm Rothera, Đảo Adelaide. Rothera cũng phục vụ như là thủ phủ của Lãnh thổ Nam Cực thuộc Anh, Lãnh thổ hải ngoại thuộc Anh.',
]
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]
anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| anchor | positive | negative |
|---|---|---|
cầu thủ ahn joon-soo là ai |
Ahn Joon-soo ::: Ahn Joon-soo (安俊洙, sinh ngày 28 tháng 1 năm 1998) là một cầu thủ bóng đá người Hàn Quốc. Anh thi đấu cho Cerezo Osaka. |
Ahn Jung-hwan ::: Ahn Jung-Hwan (Hangul: 안정환; sinh ngày 27 tháng 1 năm 1976 tại Paju, Gyeonggi) là một cựu cầu thủ bóng đá người Hàn Quốc, anh nổi tiếng với việc ghi bàn thắng vàng cho đội tuyển Hàn Quốc trong trận gặp Ý tại vòng hai World Cup 2002 đồng thời đưa tuyển Hàn tiến vào tứ kết. |
cầu thủ ahn joon-soo là ai |
Ahn Joon-soo ::: Ahn Joon-soo (安俊洙, sinh ngày 28 tháng 1 năm 1998) là một cầu thủ bóng đá người Hàn Quốc. Anh thi đấu cho Cerezo Osaka. |
Ahn Sung-nam ::: Ahn Sung-Nam (Hangul: 안성남; Hanja: 安成男, sinh ngày 17 tháng 4 năm 1984) là một cầu thủ bóng đá Hàn Quốc hiện tại thi đấu cho Gyeongnam FC. |
cầu thủ ahn joon-soo là ai |
Ahn Joon-soo ::: Ahn Joon-soo (安俊洙, sinh ngày 28 tháng 1 năm 1998) là một cầu thủ bóng đá người Hàn Quốc. Anh thi đấu cho Cerezo Osaka. |
Ahn So-hee ::: Ahn So-hee (Hangul: 안소희), sinh ngày 27 tháng 6 năm 1992, là nữ ca sĩ, diễn viên, vũ công, MC người Hàn Quốc, cựu thành viên nhóm nhạc Wonder Girls do JYP quản lý nhưng đã rời JYP. Hiện cô đang đầu quân cho KeyEast, tập trung vào diễn xuất. |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
per_device_train_batch_size: 40per_device_eval_batch_size: 32learning_rate: 2e-05num_train_epochs: 2warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 40per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 2max_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: 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: 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| Epoch | Step | Training Loss |
|---|---|---|
| 0.0138 | 500 | 0.2135 |
| 0.0276 | 1000 | 0.1575 |
| 0.0414 | 1500 | 0.1395 |
| 0.0552 | 2000 | 0.1241 |
| 0.0690 | 2500 | 0.1041 |
| 0.0828 | 3000 | 0.1063 |
| 0.0966 | 3500 | 0.1011 |
| 0.1104 | 4000 | 0.0982 |
| 0.1242 | 4500 | 0.0923 |
| 0.1380 | 5000 | 0.0916 |
| 0.1517 | 5500 | 0.0831 |
| 0.1655 | 6000 | 0.0904 |
| 0.1793 | 6500 | 0.0891 |
| 0.1931 | 7000 | 0.0843 |
| 0.2069 | 7500 | 0.0816 |
| 0.2207 | 8000 | 0.0862 |
| 0.2345 | 8500 | 0.0743 |
| 0.2483 | 9000 | 0.09 |
| 0.2621 | 9500 | 0.0761 |
| 0.2759 | 10000 | 0.0762 |
| 0.2897 | 10500 | 0.0794 |
| 0.3035 | 11000 | 0.0761 |
| 0.3173 | 11500 | 0.0757 |
| 0.3311 | 12000 | 0.0697 |
| 0.3449 | 12500 | 0.0746 |
| 0.3587 | 13000 | 0.0736 |
| 0.3725 | 13500 | 0.0672 |
| 0.3863 | 14000 | 0.0683 |
| 0.4001 | 14500 | 0.0684 |
| 0.4139 | 15000 | 0.0683 |
| 0.4277 | 15500 | 0.0717 |
| 0.4415 | 16000 | 0.0673 |
| 0.4552 | 16500 | 0.0624 |
| 0.4690 | 17000 | 0.0658 |
| 0.4828 | 17500 | 0.0661 |
| 0.4966 | 18000 | 0.0667 |
| 0.5104 | 18500 | 0.0658 |
| 0.5242 | 19000 | 0.0665 |
| 0.5380 | 19500 | 0.0642 |
| 0.5518 | 20000 | 0.0635 |
| 0.5656 | 20500 | 0.0634 |
| 0.5794 | 21000 | 0.0623 |
| 0.5932 | 21500 | 0.0628 |
| 0.6070 | 22000 | 0.0658 |
| 0.6208 | 22500 | 0.0611 |
| 0.6346 | 23000 | 0.0623 |
| 0.6484 | 23500 | 0.0655 |
| 0.6622 | 24000 | 0.0587 |
| 0.6760 | 24500 | 0.0551 |
| 0.6898 | 25000 | 0.0555 |
| 0.7036 | 25500 | 0.0551 |
| 0.7174 | 26000 | 0.0622 |
| 0.7312 | 26500 | 0.0528 |
| 0.7450 | 27000 | 0.058 |
| 0.7587 | 27500 | 0.0538 |
| 0.7725 | 28000 | 0.0568 |
| 0.7863 | 28500 | 0.0531 |
| 0.8001 | 29000 | 0.0552 |
| 0.8139 | 29500 | 0.0533 |
| 0.8277 | 30000 | 0.0547 |
| 0.8415 | 30500 | 0.0541 |
| 0.8553 | 31000 | 0.055 |
| 0.8691 | 31500 | 0.0519 |
| 0.8829 | 32000 | 0.0492 |
| 0.8967 | 32500 | 0.0569 |
| 0.9105 | 33000 | 0.0484 |
| 0.9243 | 33500 | 0.0493 |
| 0.9381 | 34000 | 0.0507 |
| 0.9519 | 34500 | 0.0496 |
| 0.9657 | 35000 | 0.0502 |
| 0.9795 | 35500 | 0.0473 |
| 0.9933 | 36000 | 0.0532 |
| 1.0071 | 36500 | 0.0492 |
| 1.0209 | 37000 | 0.0469 |
| 1.0347 | 37500 | 0.046 |
| 1.0484 | 38000 | 0.0385 |
| 1.0622 | 38500 | 0.037 |
| 1.0760 | 39000 | 0.0359 |
| 1.0898 | 39500 | 0.0315 |
| 1.1036 | 40000 | 0.0274 |
| 1.1174 | 40500 | 0.0271 |
| 1.1312 | 41000 | 0.0242 |
| 1.1450 | 41500 | 0.0249 |
| 1.1588 | 42000 | 0.021 |
| 1.1726 | 42500 | 0.0197 |
| 1.1864 | 43000 | 0.0194 |
| 1.2002 | 43500 | 0.0157 |
| 1.2140 | 44000 | 0.0153 |
| 1.2278 | 44500 | 0.0143 |
| 1.2416 | 45000 | 0.0179 |
| 1.2554 | 45500 | 0.0148 |
| 1.2692 | 46000 | 0.0155 |
| 1.2830 | 46500 | 0.0145 |
| 1.2968 | 47000 | 0.0147 |
| 1.3106 | 47500 | 0.0141 |
| 1.3244 | 48000 | 0.0138 |
| 1.3382 | 48500 | 0.0148 |
| 1.3519 | 49000 | 0.0137 |
| 1.3657 | 49500 | 0.014 |
| 1.3795 | 50000 | 0.0132 |
| 1.3933 | 50500 | 0.0131 |
| 1.4071 | 51000 | 0.0125 |
@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
tintnguyen/bert-base-vi-uncased