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("Mercity/memory-retrieval-minilm-l6-v2")
5# Run inference
6sentences = [
7 'Provide the amortization schedule difference for CC1 under both prioritization schemas.',
8 "Mark's primary long-term goal is to start his own small business within the next four years, requiring significant capital savings to begin operations.",
9 "Last spring, Dr. Vasquez received high praise from the Dean for successfully transitioning her entire curriculum to align with a newly adopted, highly structured 'Systems Thinking Framework' mandated by the university board.",
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.9104, -0.3007],
19# [ 0.9104, 1.0000, -0.2945],
20# [-0.3007, -0.2945, 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 |
|---|---|---|
Yoga by the sea for Nina's soul? Add scenic drives that whisper sweet nothings. | Nina developed a strong, vocal aversion to driving manual transmission cars after a stressful rental experience in Tuscany in 2018. | Sofia recently shared that her grandmother, who is a major influencer in the family, is recovering from a minor surgery and requires quiet, low-stress environments for the next few months. |
Targeting analysis of 200 sites to sway city green space policies; realistic under these limits? | Dr. Patel has a strong, established working relationship with the City Planning Department head, who is personally invested in seeing the pollinator data incorporated into the 2026 municipal budget review. | Alex reviewed the seed funding agreement which stipulated that 10% ($50,000) of the capital must be reserved solely for executive bonuses upon Series A closing. |
Gluten-free options avoiding cross-contamination in our small kitchen? I truly value this. | Lisa has a very close relationship with her neighbor, Sarah, who is a professional chef specializing in South American cuisine and often offers to help prep on Sundays. | Alex's agent advised varying sentence structure with occasional future tense projections during character betrayals to heighten emotional stakes in the plot. |
TripletLoss with these parameters:
1{
2 "distance_metric": "TripletDistanceMetric.COSINE",
3 "triplet_margin": 0.5
4}eval_strategy: stepsper_device_train_batch_size: 32per_device_eval_batch_size: 32multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_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: Falsefp16_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 |
|---|---|---|
| 0.0432 | 500 | 0.3372 |
| 0.0865 | 1000 | 0.1651 |
| 0.1297 | 1500 | 0.1505 |
| 0.1730 | 2000 | 0.1367 |
| 0.2162 | 2500 | 0.128 |
| 0.2594 | 3000 | 0.1213 |
| 0.3027 | 3500 | 0.1167 |
| 0.3459 | 4000 | 0.1087 |
| 0.3891 | 4500 | 0.1017 |
| 0.4324 | 5000 | 0.1019 |
| 0.4756 | 5500 | 0.096 |
| 0.5189 | 6000 | 0.0963 |
| 0.5621 | 6500 | 0.0883 |
| 0.6053 | 7000 | 0.0879 |
| 0.6486 | 7500 | 0.0865 |
| 0.6918 | 8000 | 0.0822 |
| 0.7350 | 8500 | 0.0815 |
| 0.7783 | 9000 | 0.0784 |
| 0.8215 | 9500 | 0.0754 |
| 0.8648 | 10000 | 0.0767 |
| 0.9080 | 10500 | 0.0732 |
| 0.9512 | 11000 | 0.0713 |
| 0.9945 | 11500 | 0.0677 |
| 1.0 | 11564 | - |
| 1.0377 | 12000 | 0.0611 |
| 1.0809 | 12500 | 0.0572 |
| 1.1242 | 13000 | 0.0596 |
| 1.1674 | 13500 | 0.0576 |
| 1.2107 | 14000 | 0.0562 |
| 1.2539 | 14500 | 0.0544 |
| 1.2971 | 15000 | 0.0543 |
| 1.3404 | 15500 | 0.0544 |
| 1.3836 | 16000 | 0.0533 |
| 1.4268 | 16500 | 0.0515 |
| 1.4701 | 17000 | 0.0501 |
| 1.5133 | 17500 | 0.0515 |
| 1.5566 | 18000 | 0.0494 |
| 1.5998 | 18500 | 0.0495 |
| 1.6430 | 19000 | 0.0477 |
| 1.6863 | 19500 | 0.0471 |
| 1.7295 | 20000 | 0.0478 |
| 1.7727 | 20500 | 0.0453 |
| 1.8160 | 21000 | 0.0447 |
| 1.8592 | 21500 | 0.0463 |
| 1.9025 | 22000 | 0.0462 |
| 1.9457 | 22500 | 0.0445 |
| 1.9889 | 23000 | 0.0436 |
| 2.0 | 23128 | - |
| 2.0322 | 23500 | 0.0376 |
| 2.0754 | 24000 | 0.0377 |
| 2.1186 | 24500 | 0.0364 |
| 2.1619 | 25000 | 0.0381 |
| 2.2051 | 25500 | 0.0382 |
| 2.2484 | 26000 | 0.0359 |
| 2.2916 | 26500 | 0.036 |
| 2.3348 | 27000 | 0.0365 |
| 2.3781 | 27500 | 0.0362 |
| 2.4213 | 28000 | 0.036 |
| 2.4645 | 28500 | 0.0359 |
| 2.5078 | 29000 | 0.0364 |
| 2.5510 | 29500 | 0.0355 |
| 2.5943 | 30000 | 0.0354 |
| 2.6375 | 30500 | 0.0348 |
| 2.6807 | 31000 | 0.0362 |
| 2.7240 | 31500 | 0.0345 |
| 2.7672 | 32000 | 0.0351 |
| 2.8104 | 32500 | 0.0345 |
| 2.8537 | 33000 | 0.0351 |
| 2.8969 | 33500 | 0.0339 |
| 2.9402 | 34000 | 0.0354 |
| 2.9834 | 34500 | 0.0356 |
| 3.0 | 34692 | - |
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}