Views
No views yet
A supervised baseline:all-MiniLM-L6-v2fine-tuned with MultipleNegativesRankingLoss on ESCI relevance labels (not bag-derived), used as a comparison point for the bag-of-documents retrieval research.
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 'preservatives free eye drops',
8 'Refresh Plus Lubricant Eye Drops, Preservative-Free, 0.01 Fl Oz Single-Use Containers, 30 Count (Pack of 1)',
9 'Ocusoft Retaine MGD Ophthalmic Emulsion, Milky White Solution, 30 count Single Use Containers, 0.01 Fluid Ounce',
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.7632, 0.4848],
19# [0.7632, 1.0000, 0.4949],
20# [0.4848, 0.4949, 1.0000]])sentence_0, sentence_1, and sentence_2| sentence_0 | sentence_1 | sentence_2 | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| sentence_0 | sentence_1 | sentence_2 |
|---|---|---|
e gift card | App Store & iTunes Gift Cards - Email Delivery | ASURION 4 Year Laptop Accident Protection Plan with Tech Support $600-699.99 |
mre's meals ready to eat military | Ozark Outdoorz, LLC 2020 Pack Date/2025 Best by Date - XMRE 1300XT (Meals Ready to Eat) - 4 Pack Random | 5000mAh Weather Radio,Solar Hand Crank Emergency Radio,NOAA/AM/FM Shortwave Outdoor Survival Portable Radio, Power Bank USB Charger,Flashlight/Reading Lamp,Headphone Jack,SOS |
nested magnesium glycinate chelate | EquiLife - Full Spectrum Magnesium, Magnesium Glycinate, Boosts Mood, Promotes Restful Sleep, Improves Bone Health, Enhances Energy & Focus, Helps Steady Blood Pressure, Non-GMO, Vegan (90 Servings) | Life Extension, Neuro-Mag, 90 Cápsulas vegetarianas |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}per_device_train_batch_size: 32num_train_epochs: 10per_device_eval_batch_size: 32multi_dataset_batch_sampler: round_robinper_device_train_batch_size: 32num_train_epochs: 10max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torch_fusedoptim_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: noper_device_eval_batch_size: 32prediction_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 |
|---|---|---|
| 0.1274 | 500 | 0.9736 |
| 0.2548 | 1000 | 0.8578 |
| 0.3823 | 1500 | 0.8133 |
| 0.5097 | 2000 | 0.7662 |
| 0.6371 | 2500 | 0.7642 |
| 0.7645 | 3000 | 0.7438 |
| 0.8919 | 3500 | 0.7035 |
| 1.0194 | 4000 | 0.6752 |
| 1.1468 | 4500 | 0.6039 |
| 1.2742 | 5000 | 0.5819 |
| 1.4016 | 5500 | 0.5710 |
| 1.5291 | 6000 | 0.5514 |
| 1.6565 | 6500 | 0.5315 |
| 1.7839 | 7000 | 0.5164 |
| 1.9113 | 7500 | 0.5121 |
| 2.0387 | 8000 | 0.4657 |
| 2.1662 | 8500 | 0.3968 |
| 2.2936 | 9000 | 0.3996 |
| 2.4210 | 9500 | 0.3826 |
| 2.5484 | 10000 | 0.3845 |
| 2.6758 | 10500 | 0.3783 |
| 2.8033 | 11000 | 0.3745 |
| 2.9307 | 11500 | 0.3708 |
| 3.0581 | 12000 | 0.3310 |
| 3.1855 | 12500 | 0.2975 |
| 3.3129 | 13000 | 0.2886 |
| 3.4404 | 13500 | 0.2926 |
| 3.5678 | 14000 | 0.2910 |
| 3.6952 | 14500 | 0.2800 |
| 3.8226 | 15000 | 0.2918 |
| 3.9501 | 15500 | 0.2828 |
| 4.0775 | 16000 | 0.2514 |
| 4.2049 | 16500 | 0.2344 |
| 4.3323 | 17000 | 0.2299 |
| 4.4597 | 17500 | 0.2315 |
| 4.5872 | 18000 | 0.2357 |
| 4.7146 | 18500 | 0.2350 |
| 4.8420 | 19000 | 0.2358 |
| 4.9694 | 19500 | 0.2350 |
| 5.0968 | 20000 | 0.2065 |
| 5.2243 | 20500 | 0.1891 |
| 5.3517 | 21000 | 0.1934 |
| 5.4791 | 21500 | 0.1922 |
| 5.6065 | 22000 | 0.1962 |
| 5.7339 | 22500 | 0.1927 |
| 5.8614 | 23000 | 0.1853 |
| 5.9888 | 23500 | 0.1886 |
| 6.1162 | 24000 | 0.1669 |
| 6.2436 | 24500 | 0.1593 |
| 6.3710 | 25000 | 0.1661 |
| 6.4985 | 25500 | 0.1674 |
| 6.6259 | 26000 | 0.1651 |
| 6.7533 | 26500 | 0.1707 |
| 6.8807 | 27000 | 0.1619 |
| 7.0082 | 27500 | 0.1639 |
| 7.1356 | 28000 | 0.1431 |
| 7.2630 | 28500 | 0.1525 |
| 7.3904 | 29000 | 0.1479 |
| 7.5178 | 29500 | 0.1450 |
| 7.6453 | 30000 | 0.1430 |
| 7.7727 | 30500 | 0.1424 |
| 7.9001 | 31000 | 0.1467 |
| 8.0275 | 31500 | 0.1416 |
| 8.1549 | 32000 | 0.1287 |
| 8.2824 | 32500 | 0.1345 |
| 8.4098 | 33000 | 0.1349 |
| 8.5372 | 33500 | 0.1372 |
| 8.6646 | 34000 | 0.1344 |
| 8.7920 | 34500 | 0.1294 |
| 8.9195 | 35000 | 0.1324 |
| 9.0469 | 35500 | 0.1312 |
| 9.1743 | 36000 | 0.1295 |
| 9.3017 | 36500 | 0.1259 |
| 9.4292 | 37000 | 0.1316 |
| 9.5566 | 37500 | 0.1228 |
| 9.6840 | 38000 | 0.1277 |
| 9.8114 | 38500 | 0.1279 |
| 9.9388 | 39000 | 0.1228 |
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{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}