--- datasets: [] language: [] library_name: sentence-transformers pipeline_tag: sentence-similarity tags: - sentence-transformers - sentence-similarity - feature-extraction - generated_from_trainer - dataset_size:561155 - loss:CosineSimilarityLoss widget: - source_sentence: 地下室那个主管道铁管子烂的不行了 sentences: - 怎么停水了? - 怎么停水了? - 维修人员什么时候能到 - source_sentence: 什么时候能给加装过滤网啊,我都等好久了 sentences: - 怎么停水了? - 您可以拨打营业大厅电话进行处理,电话号码是,824,777,6 - 你好 - source_sentence: 咋没水了呢 sentences: - 我家水管冻了 - 怎么停水了? - 我家漏水了 - source_sentence: 你好我想问一下怎么在网上交不了费啊 sentences: - 水表怎么安装和更换? - 查询用户编号需要营业大厅办理,请拨打8247776 - 我家漏水了 - source_sentence: 大概几点来水? sentences: - 本人到供水公司办理,需携带房本复印件、本人身份证复印件到供水公司办理, 待办需携带房本复印件、房主身份证复印件、代办人身份证复印件 - 线上报装登录佳木斯供水公众号, 点击“报装申请”,提交后,工作人员会在24小时内联系您。线下报装需本人到供水公司申请,居民用户携带本人身份证复印件和房照复印件,非居民用户携带营业执照复印件、法人复印件及公章。 - 我家漏水了 --- # SentenceTransformer This is a [sentence-transformers](https://www.SBERT.net) model trained. 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. ## Model Details ### Model Description - **Model Type:** Sentence Transformer - **Maximum Sequence Length:** 512 tokens - **Output Dimensionality:** 768 tokens - **Similarity Function:** Cosine Similarity ### Model Sources - **Documentation:** [Sentence Transformers Documentation](https://sbert.net) - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers) - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) ### Full Model Architecture ``` 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}) ) ``` ## Usage ### Direct Usage (Sentence Transformers) First install the Sentence Transformers library: ```bash pip install -U sentence-transformers ``` Then you can load this model and run inference. ```python from sentence_transformers import SentenceTransformer # Download from the 🤗 Hub model = SentenceTransformer("sentence_transformers_model_id") # Run inference sentences = [ '大概几点来水?', '本人到供水公司办理,需携带房本复印件、本人身份证复印件到供水公司办理, 待办需携带房本复印件、房主身份证复印件、代办人身份证复印件', '我家漏水了', ] 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] ``` ## Training Details ### Training Dataset #### Unnamed Dataset * Size: 561,155 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 | | | | * Samples: | sentence_0 | sentence_1 | label | |:-----------------------------------------|:------------------------------------------------------------|:-----------------| | 查询一下我的户号 | 我要投诉 | 0.3 | | XX现在正在漏水,不确定是供水还是供热,方便去看一下吗 | 怎么停水了? | 0.3 | | 我家突然没有水压了,滴答水 | 居民用水2.95元/吨,非居民请登录微信公众号佳木斯供水-网上营业厅-业务办理-水价信息查寻 | 0.3 | * Loss: [CosineSimilarityLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters: ```json { "loss_fct": "torch.nn.modules.loss.MSELoss" } ``` ### Training Hyperparameters #### Non-Default Hyperparameters - `per_device_train_batch_size`: 16 - `per_device_eval_batch_size`: 16 - `multi_dataset_batch_sampler`: round_robin #### All Hyperparameters
Click to expand - `overwrite_output_dir`: False - `do_predict`: False - `eval_strategy`: no - `prediction_loss_only`: True - `per_device_train_batch_size`: 16 - `per_device_eval_batch_size`: 16 - `per_gpu_train_batch_size`: None - `per_gpu_eval_batch_size`: None - `gradient_accumulation_steps`: 1 - `eval_accumulation_steps`: None - `torch_empty_cache_steps`: None - `learning_rate`: 5e-05 - `weight_decay`: 0.0 - `adam_beta1`: 0.9 - `adam_beta2`: 0.999 - `adam_epsilon`: 1e-08 - `max_grad_norm`: 1 - `num_train_epochs`: 3 - `max_steps`: -1 - `lr_scheduler_type`: linear - `lr_scheduler_kwargs`: {} - `warmup_ratio`: 0.0 - `warmup_steps`: 0 - `log_level`: passive - `log_level_replica`: warning - `log_on_each_node`: True - `logging_nan_inf_filter`: True - `save_safetensors`: True - `save_on_each_node`: False - `save_only_model`: False - `restore_callback_states_from_checkpoint`: False - `no_cuda`: False - `use_cpu`: False - `use_mps_device`: False - `seed`: 42 - `data_seed`: None - `jit_mode_eval`: False - `use_ipex`: False - `bf16`: False - `fp16`: False - `fp16_opt_level`: O1 - `half_precision_backend`: auto - `bf16_full_eval`: False - `fp16_full_eval`: False - `tf32`: None - `local_rank`: 0 - `ddp_backend`: None - `tpu_num_cores`: None - `tpu_metrics_debug`: False - `debug`: [] - `dataloader_drop_last`: False - `dataloader_num_workers`: 0 - `dataloader_prefetch_factor`: None - `past_index`: -1 - `disable_tqdm`: False - `remove_unused_columns`: True - `label_names`: None - `load_best_model_at_end`: False - `ignore_data_skip`: False - `fsdp`: [] - `fsdp_min_num_params`: 0 - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False} - `fsdp_transformer_layer_cls_to_wrap`: None - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None} - `deepspeed`: None - `label_smoothing_factor`: 0.0 - `optim`: adamw_torch - `optim_args`: None - `adafactor`: False - `group_by_length`: False - `length_column_name`: length - `ddp_find_unused_parameters`: None - `ddp_bucket_cap_mb`: None - `ddp_broadcast_buffers`: False - `dataloader_pin_memory`: True - `dataloader_persistent_workers`: False - `skip_memory_metrics`: True - `use_legacy_prediction_loop`: False - `push_to_hub`: False - `resume_from_checkpoint`: None - `hub_model_id`: None - `hub_strategy`: every_save - `hub_private_repo`: False - `hub_always_push`: False - `gradient_checkpointing`: False - `gradient_checkpointing_kwargs`: None - `include_inputs_for_metrics`: False - `eval_do_concat_batches`: True - `fp16_backend`: auto - `push_to_hub_model_id`: None - `push_to_hub_organization`: None - `mp_parameters`: - `auto_find_batch_size`: False - `full_determinism`: False - `torchdynamo`: None - `ray_scope`: last - `ddp_timeout`: 1800 - `torch_compile`: False - `torch_compile_backend`: None - `torch_compile_mode`: None - `dispatch_batches`: None - `split_batches`: None - `include_tokens_per_second`: False - `include_num_input_tokens_seen`: False - `neftune_noise_alpha`: None - `optim_target_modules`: None - `batch_eval_metrics`: False - `eval_on_start`: False - `use_liger_kernel`: False - `eval_use_gather_object`: False - `batch_sampler`: batch_sampler - `multi_dataset_batch_sampler`: round_robin
### Training Logs
Click to expand | Epoch | Step | Training Loss | |:------:|:------:|:-------------:| | 0.0143 | 500 | 0.2112 | | 0.0285 | 1000 | 0.1787 | | 0.0428 | 1500 | 0.1278 | | 0.0570 | 2000 | 0.0723 | | 0.0713 | 2500 | 0.0294 | | 0.0855 | 3000 | 0.0126 | | 0.0998 | 3500 | 0.0074 | | 0.1140 | 4000 | 0.0053 | | 0.1283 | 4500 | 0.0043 | | 0.1426 | 5000 | 0.0036 | | 0.1568 | 5500 | 0.0031 | | 0.1711 | 6000 | 0.0029 | | 0.1853 | 6500 | 0.0028 | | 0.1996 | 7000 | 0.0026 | | 0.2138 | 7500 | 0.0024 | | 0.2281 | 8000 | 0.0022 | | 0.2424 | 8500 | 0.002 | | 0.2566 | 9000 | 0.002 | | 0.2709 | 9500 | 0.0019 | | 0.2851 | 10000 | 0.0019 | | 0.2994 | 10500 | 0.002 | | 0.3136 | 11000 | 0.0017 | | 0.3279 | 11500 | 0.0018 | | 0.3421 | 12000 | 0.0017 | | 0.3564 | 12500 | 0.0018 | | 0.3707 | 13000 | 0.0014 | | 0.3849 | 13500 | 0.0014 | | 0.3992 | 14000 | 0.0014 | | 0.4134 | 14500 | 0.0016 | | 0.4277 | 15000 | 0.0013 | | 0.4419 | 15500 | 0.0013 | | 0.4562 | 16000 | 0.0012 | | 0.4704 | 16500 | 0.0012 | | 0.4847 | 17000 | 0.0013 | | 0.4990 | 17500 | 0.0014 | | 0.5132 | 18000 | 0.0011 | | 0.5275 | 18500 | 0.0012 | | 0.5417 | 19000 | 0.0011 | | 0.5560 | 19500 | 0.0011 | | 0.5702 | 20000 | 0.0009 | | 0.5845 | 20500 | 0.0011 | | 0.5988 | 21000 | 0.0009 | | 0.6130 | 21500 | 0.001 | | 0.6273 | 22000 | 0.001 | | 0.6415 | 22500 | 0.0009 | | 0.6558 | 23000 | 0.0011 | | 0.6700 | 23500 | 0.0009 | | 0.6843 | 24000 | 0.0011 | | 0.6985 | 24500 | 0.0008 | | 0.7128 | 25000 | 0.0008 | | 0.7271 | 25500 | 0.0007 | | 0.7413 | 26000 | 0.0007 | | 0.7556 | 26500 | 0.0007 | | 0.7698 | 27000 | 0.0007 | | 0.7841 | 27500 | 0.0008 | | 0.7983 | 28000 | 0.0007 | | 0.8126 | 28500 | 0.0006 | | 0.8268 | 29000 | 0.0008 | | 0.8411 | 29500 | 0.0007 | | 0.8554 | 30000 | 0.0006 | | 0.8696 | 30500 | 0.0007 | | 0.8839 | 31000 | 0.0005 | | 0.8981 | 31500 | 0.0007 | | 0.9124 | 32000 | 0.0006 | | 0.9266 | 32500 | 0.0006 | | 0.9409 | 33000 | 0.0006 | | 0.9552 | 33500 | 0.0005 | | 0.9694 | 34000 | 0.0006 | | 0.9837 | 34500 | 0.0006 | | 0.9979 | 35000 | 0.0006 | | 1.0122 | 35500 | 0.0006 | | 1.0264 | 36000 | 0.0005 | | 1.0407 | 36500 | 0.0004 | | 1.0549 | 37000 | 0.0007 | | 1.0692 | 37500 | 0.0005 | | 1.0835 | 38000 | 0.0005 | | 1.0977 | 38500 | 0.0004 | | 1.1120 | 39000 | 0.0005 | | 1.1262 | 39500 | 0.0005 | | 1.1405 | 40000 | 0.0004 | | 1.1547 | 40500 | 0.0005 | | 1.1690 | 41000 | 0.0004 | | 1.1832 | 41500 | 0.0005 | | 1.1975 | 42000 | 0.0005 | | 1.2118 | 42500 | 0.0005 | | 1.2260 | 43000 | 0.0005 | | 1.2403 | 43500 | 0.0004 | | 1.2545 | 44000 | 0.0005 | | 1.2688 | 44500 | 0.0005 | | 1.2830 | 45000 | 0.0004 | | 1.2973 | 45500 | 0.0005 | | 1.3116 | 46000 | 0.0006 | | 1.3258 | 46500 | 0.0004 | | 1.3401 | 47000 | 0.0004 | | 1.3543 | 47500 | 0.0004 | | 1.3686 | 48000 | 0.0004 | | 1.3828 | 48500 | 0.0003 | | 1.3971 | 49000 | 0.0003 | | 1.4113 | 49500 | 0.0004 | | 1.4256 | 50000 | 0.0004 | | 1.4399 | 50500 | 0.0004 | | 1.4541 | 51000 | 0.0004 | | 1.4684 | 51500 | 0.0003 | | 1.4826 | 52000 | 0.0003 | | 1.4969 | 52500 | 0.0006 | | 1.5111 | 53000 | 0.0004 | | 1.5254 | 53500 | 0.0004 | | 1.5396 | 54000 | 0.0003 | | 1.5539 | 54500 | 0.0003 | | 1.5682 | 55000 | 0.0003 | | 1.5824 | 55500 | 0.0004 | | 1.5967 | 56000 | 0.0004 | | 1.6109 | 56500 | 0.0004 | | 1.6252 | 57000 | 0.0003 | | 1.6394 | 57500 | 0.0003 | | 1.6537 | 58000 | 0.0003 | | 1.6679 | 58500 | 0.0004 | | 1.6822 | 59000 | 0.0005 | | 1.6965 | 59500 | 0.0004 | | 1.7107 | 60000 | 0.0003 | | 1.7250 | 60500 | 0.0004 | | 1.7392 | 61000 | 0.0002 | | 1.7535 | 61500 | 0.0003 | | 1.7677 | 62000 | 0.0003 | | 1.7820 | 62500 | 0.0003 | | 1.7963 | 63000 | 0.0003 | | 1.8105 | 63500 | 0.0003 | | 1.8248 | 64000 | 0.0003 | | 1.8390 | 64500 | 0.0003 | | 1.8533 | 65000 | 0.0002 | | 1.8675 | 65500 | 0.0004 | | 1.8818 | 66000 | 0.0002 | | 1.8960 | 66500 | 0.0002 | | 1.9103 | 67000 | 0.0002 | | 1.9246 | 67500 | 0.0003 | | 1.9388 | 68000 | 0.0003 | | 1.9531 | 68500 | 0.0003 | | 1.9673 | 69000 | 0.0002 | | 1.9816 | 69500 | 0.0003 | | 1.9958 | 70000 | 0.0003 | | 2.0101 | 70500 | 0.0003 | | 2.0243 | 71000 | 0.0003 | | 2.0386 | 71500 | 0.0002 | | 2.0529 | 72000 | 0.0004 | | 2.0671 | 72500 | 0.0003 | | 2.0814 | 73000 | 0.0003 | | 2.0956 | 73500 | 0.0002 | | 2.1099 | 74000 | 0.0002 | | 2.1241 | 74500 | 0.0003 | | 2.1384 | 75000 | 0.0002 | | 2.1527 | 75500 | 0.0003 | | 2.1669 | 76000 | 0.0002 | | 2.1812 | 76500 | 0.0003 | | 2.1954 | 77000 | 0.0002 | | 2.2097 | 77500 | 0.0002 | | 2.2239 | 78000 | 0.0003 | | 2.2382 | 78500 | 0.0001 | | 2.2524 | 79000 | 0.0002 | | 2.2667 | 79500 | 0.0003 | | 2.2810 | 80000 | 0.0003 | | 2.2952 | 80500 | 0.0002 | | 2.3095 | 81000 | 0.0003 | | 2.3237 | 81500 | 0.0003 | | 2.3380 | 82000 | 0.0002 | | 2.3522 | 82500 | 0.0002 | | 2.3665 | 83000 | 0.0003 | | 2.3807 | 83500 | 0.0003 | | 2.3950 | 84000 | 0.0002 | | 2.4093 | 84500 | 0.0002 | | 2.4235 | 85000 | 0.0002 | | 2.4378 | 85500 | 0.0002 | | 2.4520 | 86000 | 0.0002 | | 2.4663 | 86500 | 0.0002 | | 2.4805 | 87000 | 0.0002 | | 2.4948 | 87500 | 0.0004 | | 2.5091 | 88000 | 0.0003 | | 2.5233 | 88500 | 0.0003 | | 2.5376 | 89000 | 0.0001 | | 2.5518 | 89500 | 0.0002 | | 2.5661 | 90000 | 0.0002 | | 2.5803 | 90500 | 0.0002 | | 2.5946 | 91000 | 0.0002 | | 2.6088 | 91500 | 0.0002 | | 2.6231 | 92000 | 0.0002 | | 2.6374 | 92500 | 0.0002 | | 2.6516 | 93000 | 0.0002 | | 2.6659 | 93500 | 0.0003 | | 2.6801 | 94000 | 0.0005 | | 2.6944 | 94500 | 0.0003 | | 2.7086 | 95000 | 0.0003 | | 2.7229 | 95500 | 0.0003 | | 2.7371 | 96000 | 0.0002 | | 2.7514 | 96500 | 0.0002 | | 2.7657 | 97000 | 0.0001 | | 2.7799 | 97500 | 0.0002 | | 2.7942 | 98000 | 0.0002 | | 2.8084 | 98500 | 0.0003 | | 2.8227 | 99000 | 0.0001 | | 2.8369 | 99500 | 0.0002 | | 2.8512 | 100000 | 0.0002 | | 2.8655 | 100500 | 0.0002 | | 2.8797 | 101000 | 0.0001 | | 2.8940 | 101500 | 0.0002 | | 2.9082 | 102000 | 0.0002 | | 2.9225 | 102500 | 0.0002 | | 2.9367 | 103000 | 0.0003 | | 2.9510 | 103500 | 0.0002 | | 2.9652 | 104000 | 0.0002 | | 2.9795 | 104500 | 0.0003 | | 2.9938 | 105000 | 0.0003 |
### Framework Versions - Python: 3.10.13 - Sentence Transformers: 3.0.1 - Transformers: 4.45.0.dev0 - PyTorch: 2.2.1 - Accelerate: 0.31.0 - Datasets: 2.17.1 - Tokenizers: 0.19.1 ## Citation ### BibTeX #### Sentence Transformers ```bibtex @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", } ```