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
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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
- Dataset:
dev
- Evaluated with
TripletEvaluator
Metric | Value |
---|---|
cosine_accuracy | 0.9025 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 108,121 training samples
- Columns:
sentence_0
,sentence_1
, andsentence_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
: stepsnum_train_epochs
: 1fp16
: Truemulti_dataset_batch_sampler
: round_robin
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 8per_device_eval_batch_size
: 8per_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
: 1.0num_train_epochs
: 1max_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
: Falseuse_ipex
: Falsebf16
: Falsefp16
: Truefp16_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}tp_size
: 0fsdp_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}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_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
: Falsegradient_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
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: batch_samplermulti_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
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for GPTasty/TastyRecipesEmbedderV2
Base model
sentence-transformers/all-mpnet-base-v2