Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 13
How to use knguyennguyen/mpnet_jacket4k_adjustedv2 with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("knguyennguyen/mpnet_jacket4k_adjustedv2")
sentences = [
"women's winter coat with a soft texture, a relaxed fit, and a zipper closure.",
"Title: Karen Scott Women's Plus Size Zip-Front Jacket Black Size 2X Descripion: Look and feel as cozy as can be in this plus size zip-front jacket from Karen Scott. polyester Imported front closure Approx. 28-1/2\" from center back neck to hem Point collar; zipper-front closure Zipper pockets at hips Unlined Polyester",
"Title: Obermeyer Girls' Stormy Jacket (Toddler/Little Big Kids) Descripion: There's no better place a child wants to be than outside. Exploring the backyard, creating make-believe friends, or anticipating the unknown, or the wonder of discovery. It has always been our intention to fuel and care for this unspoken youthful innocence. Throwing an ill-formed snowball in the excitement of loving the wonder of snow is to be applauded, regardless of our unexpected shock - refreshing as it may be. The stormy is all of that and more. For parent and child alike. With fleece-warmed chin, neck, hands and ear-warmers she is reassured to be toasty and daring to move about freely. We recognize the value of play. 100% Polyester Imported Zipper closure Hand Wash Only Fleece earwarmers;\"i-grow\" Extended wear system; full-motion articulation; sleeve pockets); integrated clips to retain mittens/gloves; adjustable, water-resistant powder skirt; working compass; 10K/10K 220gm body, 160gm sleeve, 80gm hood",
"Title: Tbaok Women's 2022 Fashion Winter Coat Long Sleeve Lapel Zip Up Faux Shearling Shaggy Loose Shacket Jacket Descripion: Womens Ladies Warm Faux Furry Coat Jacket Winter Solid Turn Down Collar Zipper Outerwear 🌟Features: 1.lightweight soft fabric for a comfortable feminine ,easy to wear,no wrinkles. 2.It is made of high quality materials,durable enought for your daily wearing. 3.Special design make you more attractive. 4.Choose it,show your energy. 🌟Product information: ★Gender:Women ★Occasion:Daily,Casual,Party ★Material:Polyester ★Clothing Length:Long ★Pattern Type:Solid ★Style:Fashion ★Collar:Turn down Collar ★Sleeve Length:Short 🌟Package include:1PC Women Coat 🌟Note: Please compare the detail sizes with yours before you buy!!! Colors may be slightly different depending on computer and monitor settings Please allow 1-3cm differs due to manual measurement, thanks (All measurement in cm and please note 1cm=0.39inch ❤Black Fridays Deals 2022 ❤ 🎄🎄 New Releases Women's 2022 Fashion Winter Lapel Coat Deals of the Day Clearance On Sale.🐾WE USE ASIAN SIZING AND RUN SMALL! WE RECOMMEND ORDERING ONE SIZE UP!🐾 If you have any questions, please contact us and we will get back to you within 24 hours! 30 day free return policy.❤❤ Imported Zipper closure Hand Wash Only ♛MATERIAL: This Sherpa Jacket Is Made Of Super-Soft And Double-Fleeced Fabric, Bringing You Ultimate Cozy Wearing Experience, Perfect Choice For Fall Or Winter ♛FEATURES DESIGN: Long Sleeve Sherpa Jackets/ Lapel Zipper Winter Coats/ Double-Side Faux Fur Coat/ Two Side Pockets Jacktes/ Womens Fall Fashion 2022/ Boyfriend Style Oversized Jackets/ Fuzzy Fleece Shearling Coats/ Fluffy And Shaggy Sherpa Jacket/ Collared Teddy Bear Coat/ Winter Clothes For Women/ Shacket Jacket Women ♛MATCH TIPS And OCCASIONS: This Faux Shearling Coat Is Easy To Match, You Can Match With T-Shirt, Jeans, Leggings, Dress For Graceful Looks. The Fuzzy Faux Fur Teddy Jacket Suits For Any Outdoor And Indoor Activities ♛UNIQUE HIGHLIGHT: The Fuzzy Teddy Bear Fall Jackets Keep You Away From Cold While Looks More Chic. The Faux Fur Winter Coat Has Stand Collar, Cool And Stylish. The Womens Shacket Jacket Always Trendy, The Fashion Outfit In This Fall And Winter ♛FASHION STYLE: This Baggy Sherpa Shacket Jacket Has Two Side Pockets, Enough To Carry Phone Or More. The Fleeced Material Let You Enjoy Comfy Touch, Friendly To Skin. The Classic Lapel Zipper Design Make You Easily Put On And Take Off. The Shearling Fluffy Winter Shacket Jacket Looks More Gorgeous"
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]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.
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, '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})
)
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("knguyennguyen/mpnet_jacket4k_adjustedv2")
# Run inference
sentences = [
"women's cropped puffer jacket featuring a solid color, long sleeves, and a stand collar with a zipper closure.",
"Title: Women's Zip Up Cropped Puffer Jacket Winter Long Sleeve Quilted Drawstring Short Down Coats Warm Outerwear Descripion: Women's Winter Warm Short Down Coat Solid Color Long Sleeve Stand Collar Zipper Puffer Jacket Outerwear Size(inch) S Length: 18.90 Bust: 44.09 Sleeve: 22.05 Shoulder: 19.69 M Length: 19.29 Bust: 45.67 Sleeve: 22.44 Shoulder: 20.08 L Length: 19.69 Bust: 47.24 Sleeve: 22.83 Shoulder: 20.47 Specification: Material: Polyester Sleeve Length: Long Pattern Type: Solid Color Gender: Women Item Type: Coat Package Included: 1 x coat 100% Polyester Imported Zipper closure Machine Wash Material: Wome cropped puffer jacket winter coat is made of high quality polyester material, lightweight, safe to skin and easy to wash, thick and warm, comfortable and soft to wear. This quilted short down jacket is a must have this winter! Design: Women's winter casual warm puffer coat, solid color, long sleeve, stand collar, full zipper closure, quilted design, drop shoulder, crop length, elastic drawstring design on the hem, very all-match and is a timeless and ideal companion on cold days! Occasion: Womens windproof short down coats suitable for casual daily wear, outdoor activity, school, streetwear, working, office, holiday, club, friends party, photography outfit and so on. Perfect addition to your winter chic and fashionable look. Match: This relax fit quilted puffer jacket can pair with crop tops, blouses, basic t-shirts,sweaters, skinny jeans, casual pants, leggings, skirts, boots, sneakers for a winter trendy look. Package&Size: 1 x coat. If the product has any quality problems, please feel free to contact us, we will help you solve the problem as quickly as possible. S, M, L. Please check the size chart carefully before buying to get the clothes that fit your size.",
'Title: My Little Pony Hoodie for Girls, Zip Up Friendship Jacket with 3D Ears, Mane and Wings, Gray, Size 5 Descripion: SWEATER WEATHER OUTFIT TOPPER Include our fun and cute 3D zip up jacket in your list of must have outfit for your child for cold and chilly seasons. Its versatile gray color can complement other outfit colors, can be worn to school, for jogging, or hanging out with friends and family! FEATURES: Lined Hood3D Ears and ManeDetachable WingsRainbow Ribbed CuffsSoft-touch PrintsFull-Zip Closure LONG LASTING QUALITY Super soft and lightweight fabric that provides insulation without the added bulk. Won’t weigh your child down and provides ample freedom of motion while protecting her the cold and chill. Its double lined hood provides extra protection from the wind and moisture. Fleece Zip Up closure Hand Wash Only FUN AND COMFY. Keep your child fashionably warm with this My Little Pony hoodie for girls. Made with soft fleece fabric and brushed interior for added plushness. This zip up hoodie is comfortable without being bulky. Its lightweight design does not compromise its quality, a perfect jacket for your precious one! FRIENDSHIP IS MAGIC. Celebrate the magic of friendship with the stars of Equestria! Featuring the super friendly Twilight Sparkle, the loyal and dependable Rainbow Dash and the funniest pony, Pinkie Pie! Join their adventure and explore the true meaning of friendship along the way. EASY TO WEAR HOODIE. Our My Little Pony 3D hoodie jacket features a zip front, cuffed sleeves and bottom cuffs. This hooded jacket is easy to wear and its cuffed sleeves and bottom design keeps its form and helps the jacket stay in place. Pair with your child’s favorite shirt or blouse, skirt, shorts, jeans, this hoodie will bring your child’s usual outfit to another level! ITS ALL IN THE DETAILS. Girls will surely be thrilled to wear our hoodie jacket with 3D details and design. With My Little Pony characters printed in front, FRIENDSHIP written on the sleeve, 3D ears, rainbow Mohawk style mane and adorable detachable wings at the back. With rainbow ribbed cuffs that adds an extra colorful accent to this fun and magical 3D My Little Pony hoodie MACHINE WASHABLE. Machine wash / hand wash in cold water with like colors, tumble dry low.',
]
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]
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
a hoodie for daily wear and cosplay events for anime fans |
Title: DAVIKO Boku No Hero Academia Shoto Todoroki Midoriya Izuku Hoodie Deku Hoodies Pullover Sweatshirt Jacket Cospaly Costume (3, Small) Yellow Descripion: Small(Chest:104cm/42.1inch, Shoulder:43cm/17.0inch, Sleeve:60cm/23.6inch, Length:62.5cm/24.6inch); Medium(Chest:112cm/44.3inch, Shoulder:53cm/17.8inch, Sleeve:64.5cm/25.4inch, Length:68.8cm/27.1inch); Large(Chest:115cm/45.6inch, Shoulder:45.9cm/18.1inch, Sleeve:67.8cm/26.7inch, Length:70.8cm/27.9inch); X-Large(Chest:119cm/46.8inch, Shoulder:46.9cm/18.5inch, Sleeve:69.9cm/27.55inch, Length:71.5cm/28.7inch); XX-Large(Chest:125cm/49.21inch, Shoulder:48.9cm/19.29inch, Sleeve:73.9cm/29.13inch, Length:74.5cm/29.3inch). Cloth,Polyester,Spandex Pull On closure 1. Our material is:90% polyester / 10%Spandex Healthy cloth,breathable, soft and smooth,very comfortable to wear. 2. My Hero Academia hoodie cosplay costume hoodies are perfect for daily wear, Halloween, theme party, cosplay, on the stage,etc. It's also a great gift for friends and Anime lovers. 3. Deku hoodie Material: polyster and design with Advance 3D technology printed. Soft and comfortable. 4.There are lots of anime cosplay costume hoodies in our shop, welcome to visit our store. 5.After-sale Services: If you have any problem, please feel free to contact us, we will help you as best we could! |
a fleece jacket for girls to keep warm during winter |
Title: Disney Elsa and Anna Zip Fleece Jacket for Girls – Frozen 2 Descripion: Keep warm during icy Arendelle winters when you zip up in our Elsa and Anna jacket. Featuring a solid fleece body adorned with an Elsa and Anna appliqué, this comfy cover-up will keep you looking cool while staying cozy. Fleece Zipper closure Hand Wash Only Genuine, Original, Authentic Disney Store Elsa and Anna appliqué on chest with glittering embroidered snowflakes Details include stand collar and full front zip Additional details include contrast trim and seam pockets Inspired by Frozen 2 |
a leather jacket for casual weekend rides and social gatherings for men |
Title: Molluska Apparel Men’s Vintage Café Racer Premium Leather Jacket |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
per_device_train_batch_size: 128per_device_eval_batch_size: 128num_train_epochs: 5multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 128per_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: 5max_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: 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}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: Falsehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseeval_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: Falsebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin@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",
}
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
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},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Base model
sentence-transformers/all-mpnet-base-v2