Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 12
This is a sentence-transformers model finetuned from snunlp/KR-SBERT-V40K-klueNLI-augSTS. 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': 128, '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("SungJoo/sbert-ft-slide-textbook-0914")
# Run inference
sentences = [
'쿼터스트라이크의 개선 계획은 무엇인가요?',
'기존 440 등급의 강철로 1.0mm 두께를 사용하던 것을 590 등급의 강철로 변경하고 두께를 1.8mm로 증가시키는 계획입니다.',
'등판(Back Plate)에 가해진 힘을 측정한 결과, Y축 방향으로 1.18 kN의 힘이 측정되었고, 이로 인해 -0.120점의 감점이 있었습니다.',
]
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]
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
이 테스트 결과가 자동차 제조사들에게 미치는 영향은 무엇인가요? |
이 테스트 결과는 자동차 제조사들이 지속적으로 차량의 안전성을 개선하도록 유도하는 역할을 합니다. |
3. 정보의 일관성: 50kph 프로토콜을 참조하도록 함으로써, 다양한 차량 모델이나 테스트 간의 머리 보호 평가 결과를 일관성 있게 비교할 수 있게 됩니다. |
이는 안전성 평가의 신뢰도와 객관성을 높이는 데 기여합니다. |
복부의 상부와 하부 측면 압축 값은 각각 얼마인가요? |
복부의 상부와 하부 측면 압축은 각각 11.0mm와 21.3mm입니다. |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
per_device_train_batch_size: 64per_device_eval_batch_size: 64num_train_epochs: 10multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 64per_device_eval_batch_size: 64per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 10max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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: Falsefp16_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: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss |
|---|---|---|
| 0.1497 | 500 | 1.5924 |
| 0.2993 | 1000 | 0.8394 |
| 0.4490 | 1500 | 0.6154 |
| 0.5986 | 2000 | 0.5072 |
| 0.7483 | 2500 | 0.4423 |
| 0.8979 | 3000 | 0.3944 |
| 1.0476 | 3500 | 0.3535 |
| 1.1972 | 4000 | 0.3231 |
| 1.3469 | 4500 | 0.2963 |
| 1.4966 | 5000 | 0.2661 |
| 1.6462 | 5500 | 0.2425 |
| 1.7959 | 6000 | 0.2181 |
| 1.9455 | 6500 | 0.188 |
| 2.0952 | 7000 | 0.1697 |
| 2.2448 | 7500 | 0.1568 |
| 2.3945 | 8000 | 0.1472 |
| 2.5441 | 8500 | 0.1388 |
| 2.6938 | 9000 | 0.1268 |
| 2.8435 | 9500 | 0.1193 |
| 2.9931 | 10000 | 0.1002 |
| 3.1428 | 10500 | 0.097 |
| 3.2924 | 11000 | 0.0907 |
| 3.4421 | 11500 | 0.0855 |
| 3.5917 | 12000 | 0.0801 |
| 3.7414 | 12500 | 0.0748 |
| 3.8911 | 13000 | 0.0673 |
| 4.0407 | 13500 | 0.0603 |
| 4.1904 | 14000 | 0.0587 |
| 4.3400 | 14500 | 0.0557 |
| 4.4897 | 15000 | 0.0534 |
| 4.6393 | 15500 | 0.0505 |
| 4.7890 | 16000 | 0.0465 |
| 4.9386 | 16500 | 0.0424 |
| 5.0883 | 17000 | 0.0402 |
| 5.2380 | 17500 | 0.0378 |
| 5.3876 | 18000 | 0.0353 |
| 5.5373 | 18500 | 0.0356 |
| 5.6869 | 19000 | 0.0321 |
| 5.8366 | 19500 | 0.032 |
| 5.9862 | 20000 | 0.0279 |
| 6.1359 | 20500 | 0.0274 |
| 6.2855 | 21000 | 0.0271 |
| 6.4352 | 21500 | 0.025 |
| 6.5849 | 22000 | 0.025 |
| 6.7345 | 22500 | 0.0234 |
| 6.8842 | 23000 | 0.0212 |
| 7.0338 | 23500 | 0.0215 |
| 7.1835 | 24000 | 0.0198 |
| 7.3331 | 24500 | 0.0191 |
| 7.4828 | 25000 | 0.0187 |
| 7.6324 | 25500 | 0.0183 |
| 7.7821 | 26000 | 0.0173 |
| 7.9318 | 26500 | 0.0162 |
| 8.0814 | 27000 | 0.0159 |
| 8.2311 | 27500 | 0.0151 |
| 8.3807 | 28000 | 0.0146 |
| 8.5304 | 28500 | 0.015 |
| 8.6800 | 29000 | 0.0138 |
| 8.8297 | 29500 | 0.0143 |
| 8.9793 | 30000 | 0.0134 |
| 9.1290 | 30500 | 0.0127 |
| 9.2787 | 31000 | 0.0133 |
| 9.4283 | 31500 | 0.012 |
| 9.5780 | 32000 | 0.0124 |
| 9.7276 | 32500 | 0.0117 |
| 9.8773 | 33000 | 0.0116 |
@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
snunlp/KR-SBERT-V40K-klueNLI-augSTS