Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'BertModel'})
(1): Pooling({'word_embedding_dimension': 384, '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})
(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 '[OFFER] Лен | 10.0 упаковка',
8 '[ORDER] Лен | 10.0 упаковка',
9 '[OFFER] Арматура 8А500С L=11,7 м | 8.5 т',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 384]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[ 1.0000, 0.9970, -0.0349],
19# [ 0.9970, 1.0000, -0.0279],
20# [-0.0349, -0.0279, 1.0000]])goods-valTripletEvaluator| Metric | Value |
|---|---|
| cosine_accuracy | 0.9561 |
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
[OFFER] 231625 Болт | 24.0 шт | [ORDER] Болт для крепления углового карданного вала МАНИТУ МТ732 231625 | 24.0 шт |
[OFFER] BPL2930 Профиль П-обр. PSL L3000 1,5мм ДКС | 30.0 м | [ORDER] Профиль П-образный PSL 29х48х3000 1.5 мм (BPL2930) / DKC | 30.0 м |
[OFFER] Счетчик электроэнергии трехфазный многотарифный (2 тарифа) Меркурий-231 АТ-011 5-60А IrDA DIN ЖКИ Инкотекс | 2.0 шт | [ORDER] Электросчетчик "Меркурий 231AT-01 I", мн.т. ЖКИ, IrDA 5(60)A | 2.0 шт |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false
5}per_device_train_batch_size: 24num_train_epochs: 4eval_strategy: stepsper_device_eval_batch_size: 24multi_dataset_batch_sampler: round_robinper_device_train_batch_size: 24num_train_epochs: 4max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torchoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1label_smoothing_factor: 0.0bf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: trackioeval_strategy: stepsper_device_eval_batch_size: 24prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_backend: Noneddp_timeout: 1800fsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}deepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | goods-val_cosine_accuracy |
|---|---|---|---|
| 0.0586 | 500 | 0.8426 | - |
| 0.1172 | 1000 | 0.2536 | - |
| 0.1758 | 1500 | 0.2174 | - |
| 0.2344 | 2000 | 0.1768 | - |
| 0.2929 | 2500 | 0.1701 | - |
| 0.3515 | 3000 | 0.1486 | - |
| 0.4101 | 3500 | 0.1418 | - |
| 0.4687 | 4000 | 0.1197 | - |
| 0.5 | 4267 | - | 0.9440 |
| 0.5273 | 4500 | 0.1159 | - |
| 0.5859 | 5000 | 0.1029 | - |
| 0.6445 | 5500 | 0.0910 | - |
| 0.7031 | 6000 | 0.0887 | - |
| 0.7617 | 6500 | 0.0819 | - |
| 0.8202 | 7000 | 0.0709 | - |
| 0.8788 | 7500 | 0.0708 | - |
| 0.9374 | 8000 | 0.0708 | - |
| 0.9960 | 8500 | 0.0608 | - |
| 1.0 | 8534 | - | 0.9530 |
| 1.0546 | 9000 | 0.0520 | - |
| 1.1132 | 9500 | 0.0492 | - |
| 1.1718 | 10000 | 0.0520 | - |
| 1.2304 | 10500 | 0.0487 | - |
| 1.2890 | 11000 | 0.0503 | - |
| 1.3476 | 11500 | 0.0455 | - |
| 1.4061 | 12000 | 0.0444 | - |
| 1.4647 | 12500 | 0.0454 | - |
| 1.5 | 12801 | - | 0.9550 |
| 1.5233 | 13000 | 0.0421 | - |
| 1.5819 | 13500 | 0.0412 | - |
| 1.6405 | 14000 | 0.0449 | - |
| 1.6991 | 14500 | 0.0374 | - |
| 1.7577 | 15000 | 0.0358 | - |
| 1.8163 | 15500 | 0.0360 | - |
| 1.8749 | 16000 | 0.0349 | - |
| 1.9334 | 16500 | 0.0386 | - |
| 1.9920 | 17000 | 0.0365 | - |
| 2.0 | 17068 | - | 0.9520 |
| 2.0506 | 17500 | 0.0287 | - |
| 2.1092 | 18000 | 0.0336 | - |
| 2.1678 | 18500 | 0.0274 | - |
| 2.2264 | 19000 | 0.0256 | - |
| 2.2850 | 19500 | 0.0278 | - |
| 2.3436 | 20000 | 0.0240 | - |
| 2.4022 | 20500 | 0.0276 | - |
| 2.4607 | 21000 | 0.0266 | - |
| 2.5 | 21335 | - | 0.9557 |
| 2.5193 | 21500 | 0.0274 | - |
| 2.5779 | 22000 | 0.0240 | - |
| 2.6365 | 22500 | 0.0249 | - |
| 2.6951 | 23000 | 0.0253 | - |
| 2.7537 | 23500 | 0.0244 | - |
| 2.8123 | 24000 | 0.0256 | - |
| 2.8709 | 24500 | 0.0261 | - |
| 2.9295 | 25000 | 0.0225 | - |
| 2.9880 | 25500 | 0.0231 | - |
| 3.0 | 25602 | - | 0.9549 |
| 3.0466 | 26000 | 0.0250 | - |
| 3.1052 | 26500 | 0.0201 | - |
| 3.1638 | 27000 | 0.0159 | - |
| 3.2224 | 27500 | 0.0206 | - |
| 3.2810 | 28000 | 0.0230 | - |
| 3.3396 | 28500 | 0.0193 | - |
| 3.3982 | 29000 | 0.0185 | - |
| 3.4568 | 29500 | 0.0178 | - |
| 3.5 | 29869 | - | 0.9557 |
| 3.5154 | 30000 | 0.0209 | - |
| 3.5739 | 30500 | 0.0193 | - |
| 3.6325 | 31000 | 0.0194 | - |
| 3.6911 | 31500 | 0.0170 | - |
| 3.7497 | 32000 | 0.0191 | - |
| 3.8083 | 32500 | 0.0161 | - |
| 3.8669 | 33000 | 0.0190 | - |
| 3.9255 | 33500 | 0.0197 | - |
| 3.9841 | 34000 | 0.0189 | - |
| 4.0 | 34136 | - | 0.9561 |
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{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 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},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}