Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper
•
1908.10084
•
Published
•
11
This is a sentence-transformers model finetuned from BAAI/bge-m3. It maps sentences & paragraphs to a 1024-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': 8192, 'do_lower_case': False, 'architecture': 'XLMRobertaModel'})
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
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("hwjello/artwork_embedding")
# Run inference
sentences = [
"'파블로 피카소 ' 작가의 '둥근 눈의 얼굴'의 재료",
"'파블로 피카소 ' 작가의 '둥근 눈의 얼굴'의 재료는 백색 도기토입니다.",
"'한묵' 작가의 '무제'의 규격은 75×63입니다.",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000, 0.9937, -0.1045],
# [ 0.9937, 1.0000, -0.0946],
# [-0.1045, -0.0946, 1.0000]])
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
'아이작 위트킨' 작가의 '가을'의 부문 |
'아이작 위트킨' 작가의 '가을'의 부문은 조각ㆍ설치입니다. |
'이항성' 작가의 '강수(江水)'의 재료 |
'이항성' 작가의 '강수(江水)'의 재료는 종이에 석판입니다. |
'김순기' 작가의 '정원과 돌' |
김순기(金順基, 1946- )는 서양화를 전공하고 1971년 니스에 위치한 국제예술교류센터(Centre Artistique de Rencontre International) 초청작가로 선발되어 프랑스로 건너갔다. 그는 1974년부터 니스 국립장식미술학교(École Nationale d’Art Décoratif de Nice), 디종 국립고등미술학교(École Nationale Supérieure d’Art de Dijon) 등에서 교수로 재직했다. 그는 남프랑스 지역에서 철학자, 단체와 만나면서 실험적인 설치 작품 및 프로젝트를 선보였다. 1980년대 초부터는 존 케이지(John Cage), 백남준, 이라 슈나이더(Ira Schneider) 등과 교류하면서 예술과 철학, 과학이 접목된 실험적인 비디오와 멀티미디어 작업을 지속해왔다. 그는 1986년부터 파리 근교 비엘메종(Viels-Maisons)의 농가를 개조한 작업실에 거주하면서 동·서양의 철학, 시간과 공간 개념에 관한 탐구를 바탕으로 정형화될 수 없는 예술과 삶의 관계를 고찰해왔다.<정원과 돌>은 핀홀 카메라로 정원을 촬영한 사진 중 하나로, 우측 화단에 넓적한 돌판이 놓여 있고 그 옆으로 나무와 야생화가 피어 있다. 핀홀 카메라는 상자에 작은 구멍을 뚫어 만든 단순한 형태의 사진기로, 구멍을 통해 빛이 들어오면 상자 안쪽에 부착된 필름에 상이 맺혀 사진이 찍힌다. 김순기는 장시간 노출이 필요한 핀홀 카메라를 사용하여 시간에 따라 변화하는 자연의 모습을 사진에 담아냈다. 작가에게 핀홀 카메라 작업은 자연 속에서 이미지를 발견하는 일, 더 나아가 자연이 스스로 이미지를 만들게 하는 일이었다. 여기에는 ‘억지로 무엇인가를 하지 않으려는’ 작가의 미학적 태도가 반영되어 있다. |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
per_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 1multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_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: 1max_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_torch_fusedoptim_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: Nonehub_always_push: Falsehub_revision: Nonegradient_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.1419 | 500 | 0.0097 |
| 0.2838 | 1000 | 0.0022 |
| 0.4258 | 1500 | 0.0021 |
| 0.5677 | 2000 | 0.0032 |
| 0.7096 | 2500 | 0.0026 |
| 0.8515 | 3000 | 0.0027 |
| 0.9935 | 3500 | 0.0015 |
@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
BAAI/bge-m3