Views
No views yet
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 128, 'pooling_mode': 'mean', 'include_prompt': True})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("swardiantara/bert-tiny-yelp-k1-adaptive-euclidean")
5# Run inference
6sentences = [
7 "What a great time! This place was awesome! I wish I lived right down the road, because I could see myself being a regular here.\\n\\nHonestly, these guys have got some talent, like real talent. They can play the piano, sing, play guitar, and the drums. Did I mention that they are all pretty hilarious, too. I'd easily pay the $7 cover to get in here any day because it really is worth it. \\n\\nI am sure I will be back in no time at all. Next time, I am bringing a big group of friends.",
8 "While we were out in Tempe, the husband and I were at a complete loss as to where we should eat. I did a little yelping and sheepishly mentioned this place. Now, we like country music and all, but I steer very clear of Toby Keith stuff. I don't care for the in your face American Pride type stuff. Anyway, we made out way to the restaurant, with entrances in front and back, and smelled the delicious bbq aroma floating in the air.\\n\\nThis place is HUGE! I noticed that the capacity is just about 1000 people. That is nuts. there is a huge bar running down the middle and a ton of TV's spaced no more than 4 feet apart running all along the bar and all along the roof. It's a good place to watch a game or the music videos. I feel like I should also add that there is apparently a dress code for the servers. All the girls are supposed to wear jingly black cowboy boots, super short denim shorts or skirts, skimpy tops that sometimes show too much skin on a less that perfectly built body, and a super sparkly rhinestoned out belt with a big ol buckle.\\n\\nAs far as the menu goes, the layout and look of it kind of suck. I heard from our waitress that they are re-doing it, so let's hope that it will be for the better. Almost everything on the menu actually looks like something I would order. It's all pretty simple BBQ style stuff with some sandwiches and salads and some pricier entrees. The appetizer menu looked delicious all around. I laughed out loud when I read that there were deep fried twinkies on the dessert menu. Classic. I ordered the Oklahoma BBQ Beef sandwich with coleslaw as my side. The sandwich was very filling and tasty. The meat was juicy and the sauce was sweet and tangy. The bun could have been more substantial but it was more than made up for with the yummy fried onion strings. The coleslaw was just blah but I sampled the husband's potato salad and it was delicious! Simple and tasty.\\n\\nOverall experience was pretty good. Our waitress was nice and gave an honest opinion when we asked for one. The atmosphere was kind of dull but that would probably be because we were there at such an odd time. In case you were wondering, in the 30-45 minutes we were there, I counted 6 Toby Keith songs. If I were into guns and in your face patriotism I would probably give this place 4 stars.",
9 "First Watch on Black Canyon Hwy in Phoenix has amazing service and very good food! They're worth the drive. You won't be disappointed. Coincidentally, I went there b/c it was right next door to the Courtyard Marriott. I have been back several times and continue to receive excellent customer service and delicious food. \\n\\nMy favorite breakfast is their Tri-Athlete omelette; which I hesitatingly tried b/c it was a healthy choice but fell in love with it! Wonderfully roasted vegetables in an egg-white only omelette topped with salsa...muahhh, magnifico!!\\n\\nFor lunch I had their Pecan Dijon chicken salad...wow, another amazing dish full of flavors...good to the last drop!\\n\\nAnd lastly, their customer service...always SPOT ON! Once we had only 15 minutes. Informed the always-welcoming staff and VOILA, an excellent breakfast in exactly 15 minutes. I'll be back soon! \\n\\nThank you First Watch on Black Canyon Hwy!! You're awesome :)",
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 128]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.9970, 0.9999],
19# [0.9970, 1.0000, 0.9960],
20# [0.9999, 0.9960, 1.0000]])text_a, text_b, and label| text_a | text_b | label | |
|---|---|---|---|
| type | string | string | list |
| modality | text | text | |
| details |
|
|
|
| text_a | text_b | label |
|---|---|---|
dr. goldberg offers everything i look for in a general practitioner. he's nice and easy to talk to without being patronizing; he's always on time in seeing his patients; he's affiliated with a top-notch hospital (nyu) which my parents have explained to me is very important in case something happens and you need surgery; and you can get referrals to see specialists without having to see him first. really, what more do you need? i'm sitting here trying to think of any complaints i have about him, but i'm really drawing a blank. | First Watch on Black Canyon Hwy in Phoenix has amazing service and very good food! They're worth the drive. You won't be disappointed. Coincidentally, I went there b/c it was right next door to the Courtyard Marriott. I have been back several times and continue to receive excellent customer service and delicious food. \n\nMy favorite breakfast is their Tri-Athlete omelette; which I hesitatingly tried b/c it was a healthy choice but fell in love with it! Wonderfully roasted vegetables in an egg-white only omelette topped with salsa...muahhh, magnifico!!\n\nFor lunch I had their Pecan Dijon chicken salad...wow, another amazing dish full of flavors...good to the last drop!\n\nAnd lastly, their customer service...always SPOT ON! Once we had only 15 minutes. Informed the always-welcoming staff and VOILA, an excellent breakfast in exactly 15 minutes. I'll be back soon! \n\nThank you First Watch on Black Canyon Hwy!! You're awesome :) | [1.0, 0.0] |
dr. goldberg offers everything i look for in a general practitioner. he's nice and easy to talk to without being patronizing; he's always on time in seeing his patients; he's affiliated with a top-notch hospital (nyu) which my parents have explained to me is very important in case something happens and you need surgery; and you can get referrals to see specialists without having to see him first. really, what more do you need? i'm sitting here trying to think of any complaints i have about him, but i'm really drawing a blank. | No, it's not worth it! Bellagio overcharged me and their accounting department never got back to me (I asked them for an itemized receipt 2 weeks ago). When I called them, I was (twice!) put on this music-less "dead" hold for 30-40 minutes. They're so full of themselves, they don't provide good customer service. Their wi-fi needed fixing when I stayed there. And by the way, the woman at the buffet was super rude to me. Finally, the famous waterworks never happened while I was standing outside in the cold waiting (though i asked the staff and they said they're up and running). No, don't waste your money! I won't and won't let my family and friends do that either. | [0.0, 1.0] |
dr. goldberg offers everything i look for in a general practitioner. he's nice and easy to talk to without being patronizing; he's always on time in seeing his patients; he's affiliated with a top-notch hospital (nyu) which my parents have explained to me is very important in case something happens and you need surgery; and you can get referrals to see specialists without having to see him first. really, what more do you need? i'm sitting here trying to think of any complaints i have about him, but i'm really drawing a blank. | Really, I should know better...\n\nIt was late at night, we didn't feel like fast food burger places, and I have driven past this place millions of times. \n\nIt's in a dark scary lot too close for comfort to Greenway square. Probably not the best place for a woman to go by herself late at night, but luckily I had the husband with me.\n\nAfter looking at the extensive menu, I ordered the chili relleno plate and my husband ordered a chicken burrito, beef taco, and a horchata. \n\nI couldn't finish my chili relleno plate. (Quick lesson in Mexican cooking- when preparing anything with chilis, its a good idea to remove the majority of the seeds. Not just because of the heat, but because its NOT fun to have a mouthful of seeds.) Besides the hundreds of chewy seeds in my mouth, the chili rellenos were lukewarm. The whole plate was pretty bland, and with every bite I took I knew my stomach would be paying for it later. So I only ate half, then popped 3 tums and hoped for the best. I ended not... | [0.0, 0.75] |
[object Object].OrdinalProxyContrastiveLossper_device_train_batch_size: 1024num_train_epochs: 10learning_rate: 2e-05load_best_model_at_end: Trueper_device_train_batch_size: 1024num_train_epochs: 10max_steps: -1learning_rate: 2e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torchoptim_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: 1.0label_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: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 8prediction_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: Trueignore_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_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.1750 | 500 | 0.3660 |
| 0.3500 | 1000 | 0.0880 |
| 0.5250 | 1500 | 0.0750 |
| 0.7000 | 2000 | 0.0694 |
| 0.8750 | 2500 | 0.0651 |
| 1.0 | 2857 | - |
| 1.0501 | 3000 | 0.0630 |
| 1.2251 | 3500 | 0.0601 |
| 1.4001 | 4000 | 0.0587 |
| 1.5751 | 4500 | 0.0568 |
| 1.7501 | 5000 | 0.0554 |
| 1.9251 | 5500 | 0.0542 |
| 2.0 | 5714 | - |
| 2.1001 | 6000 | 0.0528 |
| 2.2751 | 6500 | 0.0521 |
| 2.4501 | 7000 | 0.0517 |
| 2.6251 | 7500 | 0.0509 |
| 2.8001 | 8000 | 0.0508 |
| 2.9751 | 8500 | 0.0500 |
| 3.0 | 8571 | - |
| 3.1502 | 9000 | 0.0494 |
| 3.3252 | 9500 | 0.0487 |
| 3.5002 | 10000 | 0.0485 |
| 3.6752 | 10500 | 0.0484 |
| 3.8502 | 11000 | 0.0481 |
| 4.0 | 11428 | - |
| 4.0252 | 11500 | 0.0475 |
| 4.2002 | 12000 | 0.0472 |
| 4.3752 | 12500 | 0.0469 |
| 4.5502 | 13000 | 0.0464 |
| 4.7252 | 13500 | 0.0463 |
| 4.9002 | 14000 | 0.0463 |
| 5.0 | 14285 | - |
| 5.0753 | 14500 | 0.0459 |
| 5.2503 | 15000 | 0.0456 |
| 5.4253 | 15500 | 0.0455 |
| 5.6003 | 16000 | 0.0452 |
| 5.7753 | 16500 | 0.0452 |
| 5.9503 | 17000 | 0.0449 |
| 6.0 | 17142 | - |
| 6.1253 | 17500 | 0.0444 |
| 6.3003 | 18000 | 0.0444 |
| 6.4753 | 18500 | 0.0444 |
| 6.6503 | 19000 | 0.0444 |
| 6.8253 | 19500 | 0.0439 |
| 7.0 | 19999 | - |
| 7.0004 | 20000 | 0.0439 |
| 7.1754 | 20500 | 0.0435 |
| 7.3504 | 21000 | 0.0437 |
| 7.5254 | 21500 | 0.0436 |
| 7.7004 | 22000 | 0.0433 |
| 7.8754 | 22500 | 0.0437 |
| 8.0 | 22856 | - |
| 8.0504 | 23000 | 0.0434 |
| 8.2254 | 23500 | 0.0432 |
| 8.4004 | 24000 | 0.0429 |
| 8.5754 | 24500 | 0.0431 |
| 8.7504 | 25000 | 0.0431 |
| 8.9254 | 25500 | 0.0430 |
| 9.0 | 25713 | - |
| 9.1005 | 26000 | 0.0429 |
| 9.2755 | 26500 | 0.0429 |
| 9.4505 | 27000 | 0.0428 |
| 9.6255 | 27500 | 0.0428 |
| 9.8005 | 28000 | 0.0426 |
| 9.9755 | 28500 | 0.0427 |
| 10.0 | 28570 | - |
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}