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()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("sentence_transformers_model_id")
5# Run inference
6sentences = [
7 '제주 항일운동가 손실 소식에 대해 알고 싶습니다.',
8 '다. 항일ㆍ노동운동의 거목이 손실되자 조선인ㆍ일본인의 노동계가 합동으로 시신을 유리관(棺)에 안치, 오사카시 노동장(勞動葬)으로 성대히 엄수... (내용이 길어 일부 생략됨)',
9 '머리가 되는 것이 아니다. 누구가 먼저 키를 잡는 수완과 자질을 발휘해 선점하느냐에 따라 도사공의 지위를 차지하게 된다는 말이다.',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 1024]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[ 1.0000, -0.9309, -0.9304],
19# [-0.9309, 1.0000, 0.9989],
20# [-0.9304, 0.9989, 1.0000]])valTripletEvaluator| Metric | Value |
|---|---|
| cosine_accuracy | 0.4135 |
sentence_0, sentence_1, and sentence_2| sentence_0 | sentence_1 | sentence_2 | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| sentence_0 | sentence_1 | sentence_2 |
|---|---|---|
할머니, 할아버지는 어떤 모습일까요? | [삼 서끈 할망은 놀레 불르곡, 노 서끈 하르방은 운다.][object Object]삼 섞은 할머니는 노래 부르고, 노 섞은 할아버지는 운다. 여자는 인내력과 서둘지 않은 차분한 일 처리 능력이 남자에 비해서 앞선다는 말이다. | 정부에서는 고인의 공훈을 기리어 1990년 광복절에 건국훈장 애족장을 추서하였다. |
제주도에서는 밥 먹는 일이 일과 어떤 연관이 있나요? | 하고 다음 일을 할 수 있다. 어느 한 쪽이 늦어지면 그만큼 다음 일 착수가 늦어질 뿐만 아리나 일 처리도 미뤄지므로, 밥 먹는 일 자체가 곧 일을 차리는 것이 된다는 말이다.[object Object]의미: 밥 먹음도 일 차림이다. 밥을 먹는 일은 평상시 정례화 된 사실이지만, 먹는 쪽이나 그 식사를 마련하는 쪽이 다 정해진 일과의 한 과정을 수행하고 있는 것이다. 그러니 먹는 사람은 먹어야 다음 일을 시작할 수 있고, 식사를 차려놓는 사람은 제 때에 먹어 버려야 뒤처리를 하고 다음 일을 할 수 있다. 어느 한 쪽이 늦어지면 그만큼 다음 일 착수가 늦어질 뿐만 아리나 일 처리도 미뤄지므로, 밥 먹는 일 자체가 곧 일을 차리는 것이 된다는 말이다. | 나하고 둘이 둥실 사랑하자.` |
행원남당본풀이 이야기 들어보고 싶습니다. | [행원남당본풀이][object Object](myth)[object Object][신화] MYTH2.002 - 핵심어: 본풀이,행원남당본풀이 | 못하고 몸만 상하고 마는 현상을 지적하고 있다 |
TripletLoss with these parameters:
1{
2 "distance_metric": "TripletDistanceMetric.EUCLIDEAN",
3 "triplet_margin": 5
4}eval_strategy: stepsper_device_train_batch_size: 1per_device_eval_batch_size: 1fp16: Truemulti_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 1per_device_eval_batch_size: 1per_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: 3max_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: 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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: noneftune_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: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | val_cosine_accuracy |
|---|---|---|---|
| 0.0802 | 500 | 4.8733 | 0.4135 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{hermans2017defense,
2 title={In Defense of the Triplet Loss for Person Re-Identification},
3 author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
4 year={2017},
5 eprint={1703.07737},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV}
8}