SentenceTransformer based on nlpai-lab/KURE-v1
This is a sentence-transformers model finetuned from nlpai-lab/KURE-v1. 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.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: nlpai-lab/KURE-v1
- Maximum Sequence Length: 1024 tokens
- Output Dimensionality: 1024 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 1024, 'do_lower_case': False}) with Transformer model: 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()
)
Usage
Direct Usage (Sentence Transformers)
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("sentence_transformers_model_id")
# Run inference
sentences = [
'한동대학교의 입학 지원절차는 어디에서 확인할 수 있나요?',
'제 44 조 (학사경고)\n매학기 평점평균 2.0미만인 자에게 학사경고를 과하되, 본인 및 보증인, 소속 학과(부)장에게 즉시 통보한다.\n다만, 직전학기까지의 취득학점이 110학점 이상이고 등록학기 8학기 이상의 학생은 제외한다.\n제1항의 학생에게는 수강신청 학점을 제한 할 수 있으며, 이에 관한 세부사항은 총장이 따로 정한다.',
'제 55 조 (학생지도위원회)\n학생자치 활동을 비롯한 학생들의 생활전반에 관한 사항을 지도, 협의하기 위하여 학생지도위원회를 둔다.\n학생지도위원회는 위원장 1인을 포함한 11인 이내의 위원으로 구성하되, 학생인재개발처장을 위원장으로 하고 교목실장, RC학장은 당 연직위원이 되며 그외 위원은 전임교원중에서 총장이 임명한다.\n학생지도위원회의 운영에 관하여 필요한 사항은 총장이 따로 정한다.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Training Details
Training Dataset
Unnamed Dataset
- Size: 3,609 training samples
- Columns: sentence_0, sentence_1, and label
- Approximate statistics based on the first 1000 samples:
sentence_0 sentence_1 label type string string float details min: 9 tokensmean: 17.29 tokensmax: 29 tokens min: 18 tokensmean: 108.36 tokensmax: 566 tokens min: 0.0mean: 0.08max: 1.0 - Samples:
sentence_0 sentence_1 label 한동대학교 교무회의에서 심의하는 주요 사항은 무엇인가요? 제 52 조 (총학생회)건전한 학풍을 조성하고 학생자치활동을 신장시키기 위하여 한동대학교 총학생회(이하 "총학생회"라 한다)를 둔다.총학생회의 조직과 운영에 관한 사항은 총장의 승인을 얻어 학생회칙으로 따로 정한다.전시·사변 또는 이에 준하는 국가 비상사태시에는 그 활동이 정지된다. 0.0 한동대학교에서 이수한 교과목의 취득학점을 철회할 수 있나요? 제 43 조 (수강과목 철회 및 재이수)수강신청한 과목을 철회할 수 있으며, 이에 관한 세부사항은 학사운영규정으로 정한다.이미 이수한 과목을 재이수하고자 할 때는 재이수 신청을 하여 이미 취득한 학점을 취소하고 재이수할 수 있다.재이수는 성적이 "C+"이하인 과목에 한하여 허용한다. 다만, 총장이 특별히 필요하다고 인정하는 경우에는 그러하지 아니하다. 0.0 한동대학교 교수회는 대학 운영의 중요한 사항도 심의하나요? 제 64 조 (휴학자의 납입금)휴학자에 대하여는 다음 학기 이후의 휴학기간중의 납입금을 면제 한다.다만, 당해학기 개강일전에 휴학한 자는 그 학기부터 면제한다.납입금을 납입하고 당해학기 휴학한 자의 납입금은 휴학시점에 따라 복학시 등록금을 차등 면제한다.이때 면제 등록금에 대하여는 증액된 납입금을 징수하지 아니한다.제2항의 휴학시점에 따라 복학시 등록금을 차등 면제하는 기준은 학사운영규정으로 정한다. 0.0 - Loss: ContrastiveLoss with these parameters:
{ "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE", "margin": 0.3, "size_average": true }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepsper_device_train_batch_size: 2per_device_eval_batch_size: 2num_train_epochs: 7fp16: Truemulti_dataset_batch_sampler: round_robin
All Hyperparameters
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 2per_device_eval_batch_size: 2per_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: 7max_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: 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: batch_samplermulti_dataset_batch_sampler: round_robin
Training Logs
| Epoch | Step | Training Loss |
|---|---|---|
| 0.0554 | 50 | - |
| 0.1107 | 100 | - |
| 0.1661 | 150 | - |
| 0.2215 | 200 | - |
| 0.2769 | 250 | - |
| 0.3322 | 300 | - |
| 0.3876 | 350 | - |
| 0.4430 | 400 | - |
| 0.4983 | 450 | - |
| 0.5537 | 500 | 0.0036 |
| 0.6091 | 550 | - |
| 0.6645 | 600 | - |
| 0.7198 | 650 | - |
| 0.7752 | 700 | - |
| 0.8306 | 750 | - |
| 0.8859 | 800 | - |
| 0.9413 | 850 | - |
| 0.9967 | 900 | - |
| 1.0 | 903 | - |
| 1.0520 | 950 | - |
| 1.1074 | 1000 | 0.0019 |
| 1.1628 | 1050 | - |
| 1.2182 | 1100 | - |
| 1.2735 | 1150 | - |
| 1.3289 | 1200 | - |
| 1.3843 | 1250 | - |
| 1.4396 | 1300 | - |
| 1.4950 | 1350 | - |
| 1.5504 | 1400 | - |
| 1.6058 | 1450 | - |
| 1.6611 | 1500 | 0.0016 |
| 1.7165 | 1550 | - |
| 1.7719 | 1600 | - |
| 1.8272 | 1650 | - |
| 1.8826 | 1700 | - |
| 1.9380 | 1750 | - |
| 1.9934 | 1800 | - |
| 2.0 | 1806 | - |
| 2.0487 | 1850 | - |
| 2.1041 | 1900 | - |
| 2.1595 | 1950 | - |
| 2.2148 | 2000 | 0.0011 |
| 2.2702 | 2050 | - |
| 2.3256 | 2100 | - |
| 2.3810 | 2150 | - |
| 2.4363 | 2200 | - |
| 2.4917 | 2250 | - |
| 2.5471 | 2300 | - |
| 2.6024 | 2350 | - |
| 2.6578 | 2400 | - |
| 2.7132 | 2450 | - |
| 2.7685 | 2500 | 0.0008 |
| 2.8239 | 2550 | - |
| 2.8793 | 2600 | - |
| 2.9347 | 2650 | - |
| 2.9900 | 2700 | - |
| 3.0 | 2709 | - |
| 3.0454 | 2750 | - |
| 3.1008 | 2800 | - |
| 3.1561 | 2850 | - |
| 3.2115 | 2900 | - |
| 3.2669 | 2950 | - |
| 3.3223 | 3000 | 0.0007 |
| 3.3776 | 3050 | - |
| 3.4330 | 3100 | - |
| 3.4884 | 3150 | - |
| 3.5437 | 3200 | - |
| 3.5991 | 3250 | - |
| 3.6545 | 3300 | - |
| 3.7099 | 3350 | - |
| 3.7652 | 3400 | - |
| 3.8206 | 3450 | - |
| 3.8760 | 3500 | 0.0005 |
| 3.9313 | 3550 | - |
| 3.9867 | 3600 | - |
| 4.0 | 3612 | - |
| 4.0421 | 3650 | - |
| 4.0975 | 3700 | - |
| 4.1528 | 3750 | - |
| 4.2082 | 3800 | - |
| 4.2636 | 3850 | - |
| 4.3189 | 3900 | - |
| 4.3743 | 3950 | - |
| 4.4297 | 4000 | 0.0004 |
| 4.4850 | 4050 | - |
| 4.5404 | 4100 | - |
| 4.5958 | 4150 | - |
| 4.6512 | 4200 | - |
| 4.7065 | 4250 | - |
| 4.7619 | 4300 | - |
| 4.8173 | 4350 | - |
| 4.8726 | 4400 | - |
| 4.9280 | 4450 | - |
| 4.9834 | 4500 | 0.0002 |
| 5.0 | 4515 | - |
| 5.0388 | 4550 | - |
| 5.0941 | 4600 | - |
| 5.1495 | 4650 | - |
| 5.2049 | 4700 | - |
| 5.2602 | 4750 | - |
| 5.3156 | 4800 | - |
| 5.3710 | 4850 | - |
| 5.4264 | 4900 | - |
| 5.4817 | 4950 | - |
| 5.5371 | 5000 | 0.0003 |
| 5.5925 | 5050 | - |
| 5.6478 | 5100 | - |
| 5.7032 | 5150 | - |
| 5.7586 | 5200 | - |
| 5.8140 | 5250 | - |
| 5.8693 | 5300 | - |
| 5.9247 | 5350 | - |
| 5.9801 | 5400 | - |
| 6.0 | 5418 | - |
| 6.0354 | 5450 | - |
| 6.0908 | 5500 | 0.0002 |
| 6.1462 | 5550 | - |
| 6.2016 | 5600 | - |
| 6.2569 | 5650 | - |
| 6.3123 | 5700 | - |
| 6.3677 | 5750 | - |
| 6.4230 | 5800 | - |
| 6.4784 | 5850 | - |
| 6.5338 | 5900 | - |
| 6.5891 | 5950 | - |
| 6.6445 | 6000 | 0.0002 |
| 6.6999 | 6050 | - |
| 6.7553 | 6100 | - |
| 6.8106 | 6150 | - |
| 6.8660 | 6200 | - |
| 6.9214 | 6250 | - |
| 6.9767 | 6300 | - |
Framework Versions
- Python: 3.10.13
- Sentence Transformers: 3.3.1
- Transformers: 4.46.2
- PyTorch: 2.0.1+cu118
- Accelerate: 0.34.2
- Datasets: 3.0.0
- Tokenizers: 0.20.1
Citation
BibTeX
Sentence Transformers
@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",
}
ContrastiveLoss
@inproceedings{hadsell2006dimensionality,
author={Hadsell, R. and Chopra, S. and LeCun, Y.},
booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)},
title={Dimensionality Reduction by Learning an Invariant Mapping},
year={2006},
volume={2},
number={},
pages={1735-1742},
doi={10.1109/CVPR.2006.100}
}