SentenceTransformer based on sentence-transformers/all-mpnet-base-v2

This is a sentence-transformers model finetuned from sentence-transformers/all-mpnet-base-v2. 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
  • Base model: sentence-transformers/all-mpnet-base-v2
  • Maximum Sequence Length: 384 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 384, 'do_lower_case': False}) with Transformer model: MPNetModel 
  (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})
  (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("GPTasty/TastyRecipesEmbedderV2")
# Run inference
sentences = [
    'NAME: Lemon-Limeade Concentrate\n\nCATEGORY: Beverages\n\nKEYWORDS: Lemon, Lime, Citrus, Fruit, Canadian, Low Protein, Low Cholesterol, Healthy, Summer, < 15 Mins, Refrigerator, Beginner Cook, Stove Top, Easy, Beverages\n\nTOOLS: pot, fridge\n\nINGREDIENTS: sugar, water, lemon juice, lime juice\n\nINSTRUCTIONS: \nCombine sugar and water.\nBring to a boil, stirring occasionally.\nBoil 5 minutes, stirring occasionally.\nLet cool.\nStir in lemon and lime juices.\nPut in a jar with a tight fitting lid.\nSeal and refrigerate at least 6 hours before using.\nThis can be kept in the fridge for up to 2 weeks.',
    "NAME: Party Punch Ice Ring\n\nCATEGORY: Punch Beverage\n\nKEYWORDS: Beverages, Fruit, Low Protein, Low Cholesterol, Healthy, Free Of..., Potluck, Spring, Summer, Winter, Christmas, Hanukkah, Ramadan, Weeknight, St. Patrick's Day, Freezer, < 4 Hours, Easy, Punch Beverage\n\nTOOLS: punch bowl\n\nINGREDIENTS: ginger ale, lemon juice\n\nINSTRUCTIONS: \nDecoration suggestions:\nApricot halves.\nmint leaves.\norange peel.\ngreen grapes.\nstrawberries.\nMix ginger ale with lemon juice.\nPour 2 1/2 cups of the mixture into a 1 quart ring.\nFreeze.\nArrange desired decorations on top of the ice.\nSlowly, pour remaining juice mixture over the top so that you don't disturb your decorations.\nFreeze -- To unmold, run cold water over the bottom; it will then slip out.\nFloat in the top of your punch bowl for a very pretty presentation.",
    'NAME: Crock Pot Cream of Spinach Soup\n\nCATEGORY: Spinach\n\nKEYWORDS: Cheese, Greens, Vegetable, Very Low Carbs, Winter, Brunch, < 15 Mins, Beginner Cook, Easy, Inexpensive, Spinach\n\nTOOLS: to crock pot, pan\n\nINGREDIENTS: frozen spinach, cream cheese, milk, chicken broth, onion, cayenne pepper, paprika\n\nINSTRUCTIONS: \nDrain the spinach and add to crock pot.\nDump all the other ingredients into the crock pot.\nCook on low for 6-8 hours.\nENJOY!',
]
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]

Evaluation

Metrics

Triplet

Metric Value
cosine_accuracy 0.9025

Training Details

Training Dataset

Unnamed Dataset

  • Size: 108,121 training samples
  • Columns: sentence_0, sentence_1, and sentence_2
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1 sentence_2
    type string string string
    details
    • min: 46 tokens
    • mean: 180.14 tokens
    • max: 384 tokens
    • min: 44 tokens
    • mean: 182.29 tokens
    • max: 384 tokens
    • min: 54 tokens
    • mean: 204.96 tokens
    • max: 384 tokens
  • Samples:
    sentence_0 sentence_1 sentence_2
    NAME: Cupcake Cream Cheese Frosting

    CATEGORY: Dessert

    KEYWORDS: < 15 Mins, Easy, Dessert

    TOOLS:

    INGREDIENTS: cream cheese, butter, vanilla, powdered sugar

    INSTRUCTIONS:
    Blend all ingredients until smooth.
    NAME: Creamy Caramel Apple Cider

    CATEGORY: Beverages

    KEYWORDS: Thanksgiving, Halloween, Sweet, < 30 Mins, Easy, Beverages

    TOOLS: medium saucepan, steamer, small chilled bowl

    INGREDIENTS: heavy cream, brown sugar, apple cider, water, heavy cream, brown sugar

    INSTRUCTIONS:
    First, bring the cream and brown sugar to a boil in a medium saucepan over medium heat. Stir in the cider and the water and raise the heat to medium high, heating just until the cider begins to steam, about 4 minutes.
    Divide among 4 mugs, top each one with 2 tablespoons of caramel whipped cream (recipe follows) and serve immediately.
    Caramel Whipped Cream: In a small chilled bowl, whip the heavy cream with the brown sugar until soft peaks form.
    NAME: My Mom's Burger Soup

    CATEGORY: Potato

    KEYWORDS: Vegetable, Meat, Kid Friendly, < 60 Mins, Easy, Potato

    TOOLS: large pot, pan

    INGREDIENTS: lean ground beef, onion, corn, tomato sauce, potato, water

    INSTRUCTIONS:
    Put ground beef and onion in a large pot, break up beef as it browns over medium heat.
    When meat is browned, add corn, tomato sauce, then potatoes.
    Add enough water to fill pot almost to the top (I use a 6qt. pot).
    Bring to a boil, reduce heat and simmer until the potatoes are cooked.
    Season with salt and pepper.
    Serve with crusty bread and butter.
    NAME: Green Bean & Bacon Wraps

    CATEGORY: Beans

    KEYWORDS: Low Protein, Low Cholesterol, < 60 Mins, Easy, Beans

    TOOLS: baking dish, oven

    INGREDIENTS: green bean, bacon

    INSTRUCTIONS:
    Drain water off of green beans.
    Take five green beans and wrap with bacon end to end.
    Lay in shallow baking dish.
    Bake for 35 min at 375 degrees or until bacon is done.
    Add salt and pepper to taste.
    NAME: German Warm Cabbage Salad (Krautsalat)

    CATEGORY: Vegetable

    KEYWORDS: German, European, Low Protein, Low Cholesterol, Free Of..., Savory, < 60 Mins, Easy, Inexpensive, Vegetable

    TOOLS: frying pan, knife

    INGREDIENTS: cabbage, bacon, onion, cider vinegar, garlic

    INSTRUCTIONS:
    Cut the bacon into tiny bits.
    Fry it in a big deep frying pan and fish out all the bits after they are crisp.
    Cut up the onion and garlic and fry them in the bacon fat.
    When they are brown, pour in the vinegar.
    Bring it just up to a simmer, add all the cabbage and bacon, toss it as you would a salad, and serve it.
    The cabbage doesn't cook, but it wilts a little under the hot vinegar.
    NAME: Scandinavian Christmas Crispy Krumkake

    CATEGORY: Dessert

    KEYWORDS: Cookie & Brownie, Scandinavian, European, Christmas, < 30 Mins, Dessert

    TOOLS: oven, knife, mixer, spoon, medium bowl

    INGREDIENTS: sugar, butter, egg, milk, purpose flour, water

    INSTRUCTIONS:
    In a medium bowl, cream the sugar with the butter. Beat in the eggs until mixture is light and lemon colored. Beat in the milk and flour until blended and smooth. Let stand 30 minutes.
    Preheat krumkake iron over medium heat on top of range until a drop of water sizzles when dropped on top.
    Open iron; lightly brush inside top and bottom with shortening, oil or melted butter. Spoon 1 tablespoon batter onto center of hot iron. Close iron. Bake about 1 minute on each side until cookie is lightly browned. Insert tip of a knife under cookie to remove from iron; roll hot cookie into a cigar or cone shape. Cool on rack. Cookies become crisp as they cool. Repeat with remaining batter. Batter will thicken as you use it...
    NAME: Orlando Bloom's Pasta Au Pistou

    CATEGORY: Lunch/Snacks

    KEYWORDS: Vegetable, Caribbean, Low Cholesterol, Healthy, < 30 Mins, Small Appliance, Lunch/Snacks

    TOOLS: blender, saucepan, food processor

    INGREDIENTS: spaghetti, parsley, basil, garlic clove, parmesan cheese, salt, olive oil, onion, tomato, brown sugar

    INSTRUCTIONS:
    Cook the pasta according to directions until al dente, then drain and rinse. Pour the pasta back into the saucepan, and replace the lid to keep warm.
    In a blender or food processor, combine the parsley, basil, garlic, Parmesan, salt and 1 tablespoon of the oil. Process to a smooth paste.
    Heat the remaining tablespoon of oil in a medium frying pan. Add the onion and cook, stirring occasionally, for about 7 minutes or until soft.
    Add the tomatoes and cook for about 5 minutes. Reduce the heat and season, adding the brown sugar and cook for about 5 minutes.
    Remove from the heat and stir in the herb mixture. Toss the pasta with the sauce and serve immediately.
    NAME: Tomato and Basil Pasta

    CATEGORY: Penne

    KEYWORDS: Vegetable, European, Low Cholesterol, Toddler Friendly, Healthy, Kid Friendly, < 30 Mins, Beginner Cook, Easy, Inexpensive, Penne

    TOOLS: knife, cooking pot, pan, potato masher, fork

    INGREDIENTS: olive oil, garlic clove, basil, crushed red pepper flake, chopped tomato, pasta, parmesan cheese, romano cheese

    INSTRUCTIONS:
    Cook pasta as per box instructions.
    While pasta is cooking, heat oil with copped garlic.
    Add a handful of chopped FRESH basil.
    Heat five minutes.
    Slowly stir in chopped tomatoes, juice and all.
    Add as much crushed red pepper flakes as you like, no more than 1 table.
    Cook until tomatoes are soft enough to crush, about 20 minutes on med-low.
    Crush tomatoes in pan with fork or potato masher.
    Drain pasta and return to cooking pot.
    Slowly add sauce and mix together.
    It will look like not enough sauce to cover pasta, but this is a lite sauce and not to overpowering.
    Add fresh grated parmasiano cheese or fresh romano ...
    NAME: Spaghetti Kugel

    CATEGORY: < 60 Mins

    KEYWORDS: < 60 Mins

    TOOLS: pan, baking dish

    INGREDIENTS: cream cheese, butter, margarine, egg, sour cream, sugar, salt, vanilla, golden raisin, cinnamon

    INSTRUCTIONS:
    Cream cheese and butter, mixing until well blended.
    Blend in eggs, sour cream, sugar, vanilla, and salt.
    Add cooked spaghetti and raisins. Mix well.
    Pour mixture into a 2 1/2 quart baking dish.
    Sprinkle with cinnamon.
    Bake at 375 degrees for 30 to 35 minutes or until set.
  • Loss: TripletLoss with these parameters:
    {
        "distance_metric": "TripletDistanceMetric.EUCLIDEAN",
        "triplet_margin": 5
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • num_train_epochs: 1
  • fp16: True
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 8
  • per_device_eval_batch_size: 8
  • 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.0
  • num_train_epochs: 1
  • 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: True
  • 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}
  • tp_size: 0
  • 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: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • 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
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

Training Logs

Epoch Step Training Loss dev_cosine_accuracy
0 0 - 0.9943
0.0370 500 4.1105 0.9579
0.0740 1000 3.6849 0.9568
0.1110 1500 3.7002 0.9688
0.1480 2000 3.6835 0.9553
0.1850 2500 3.6524 0.9438
0.2220 3000 3.647 0.9512
0.2590 3500 3.6126 0.9459
0.2959 4000 3.5819 0.9468
0.3329 4500 3.608 0.9456
0.3699 5000 3.6183 0.9493
0.4069 5500 3.6224 0.9166
0.4439 6000 3.6505 0.9380
0.4809 6500 3.5647 0.9055
0.5179 7000 3.578 0.9109
0.5549 7500 3.5536 0.9250
0.5919 8000 3.5693 0.9340
0.6289 8500 3.5777 0.9241
0.6659 9000 3.5123 0.9003
0.7029 9500 3.5304 0.9094
0.7399 10000 3.5692 0.9126
0.7769 10500 3.5485 0.8999
0.8139 11000 3.5491 0.9145
0.8508 11500 3.5322 0.9135
0.8878 12000 3.5212 0.9034
0.9248 12500 3.5389 0.9024
0.9618 13000 3.5122 0.9002
0.9988 13500 3.5146 0.9018
1.0 13516 - 0.9025

Framework Versions

  • Python: 3.11.3
  • Sentence Transformers: 3.4.1
  • Transformers: 4.50.0
  • PyTorch: 2.6.0+cu126
  • Accelerate: 1.5.2
  • Datasets: 3.4.1
  • Tokenizers: 0.21.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",
}

TripletLoss

@misc{hermans2017defense,
    title={In Defense of the Triplet Loss for Person Re-Identification},
    author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
    year={2017},
    eprint={1703.07737},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}
Downloads last month
130
Safetensors
Model size
109M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for GPTasty/TastyRecipesEmbedderV2

Finetuned
(278)
this model

Evaluation results