Views
No views yet
SentenceTransformer(
(0): CLIPModel()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("sentence_transformers_model_id")
5# Run inference
6sentences = [
7 'The Hugging Face Transformers Library | Example Code + Chatbot UI with Gradio',
8 'How to Evaluate (and Improve) Your LLM Apps',
9 'How to Improve LLMs with Tools (ft. OpenAI Agents SDK)',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 1024]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities.shape)
18# [3, 3]yt-title-thumbnail-train and yt-title-thumbnail-validTripletEvaluator| Metric | yt-title-thumbnail-train | yt-title-thumbnail-valid |
|---|---|---|
| cosine_accuracy | 1.0 | 0.9375 |
anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | PIL.JpegImagePlugin.JpegImageFile | string | string |
| details |
|
|
| anchor | positive | negative |
|---|---|---|
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x350EB2A90> | A Practical Introduction to Large Language Models (LLMs) | Prompt Engineering: How to Trick AI into Solving Your Problems |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x350EB3810> | How to Build a Notion AI Agent (in 18 minutes) | 4 Ways to Measure Fat Tails with Python (+ Example Code) |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x350EB3650> | Context Engineering Explained (5 Practical Tips) | Why I Quit My $150,000 Data Science Job |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | PIL.JpegImagePlugin.JpegImageFile | string | string |
| details |
|
|
| anchor | positive | negative |
|---|---|---|
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x3AEE5D850> | Principal Component Analysis (PCA) | Introduction & Example (Python) Code |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x3AEE5EA10> | 5 Reasons Why Every Data Scientist Should Consider Freelancing | Text Embeddings, Classification, and Semantic Search (w/ Python Code) |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x3AEE5DF50> | 5 AI Projects You Can Build This Weekend (with Python) | The Wavelet Transform |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}eval_strategy: epochper_device_train_batch_size: 4per_device_eval_batch_size: 4learning_rate: 1e-05num_train_epochs: 4overwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 4per_device_eval_batch_size: 4per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 1e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 4max_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: 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: proportional| Epoch | Step | Training Loss | Validation Loss | yt-title-thumbnail-train_cosine_accuracy | yt-title-thumbnail-valid_cosine_accuracy |
|---|---|---|---|---|---|
| 0 | 0 | - | - | 1.0 | 0.9375 |
| 0.2 | 1 | 0.5678 | - | - | - |
| 0.4 | 2 | 0.8427 | - | - | - |
| 0.6 | 3 | 0.8475 | - | - | - |
| 0.8 | 4 | 0.9326 | - | - | - |
| 1.0 | 5 | 0.9615 | 1.7712 | 1.0 | 0.9375 |
| 0.1 | 1 | 0.1598 | - | - | - |
| 0.2 | 2 | 0.084 | - | - | - |
| 0.3 | 3 | 0.2701 | - | - | - |
| 0.4 | 4 | 0.4036 | - | - | - |
| 0.5 | 5 | 0.3907 | - | - | - |
| 0.6 | 6 | 0.4165 | - | - | - |
| 0.7 | 7 | 0.6304 | - | - | - |
| 0.8 | 8 | 0.3674 | - | - | - |
| 0.9 | 9 | 0.7016 | - | - | - |
| 1.0 | 10 | 0.2821 | 1.2305 | - | - |
| 1.1 | 11 | 0.2749 | - | - | - |
| 1.2 | 12 | 0.4927 | - | - | - |
| 1.3 | 13 | 0.2579 | - | - | - |
| 1.4 | 14 | 0.5595 | - | - | - |
| 1.5 | 15 | 0.5023 | - | - | - |
| 1.6 | 16 | 0.2853 | - | - | - |
| 1.7 | 17 | 0.44 | - | - | - |
| 1.8 | 18 | 0.5634 | - | - | - |
| 1.9 | 19 | 0.4209 | - | - | - |
| 2.0 | 20 | 0.0825 | 1.2300 | - | - |
| 0.0526 | 1 | 0.0705 | - | - | - |
| 0.1053 | 2 | 0.0566 | - | - | - |
| 0.1579 | 3 | 0.0493 | - | - | - |
| 0.2105 | 4 | 0.0315 | - | - | - |
| 0.2632 | 5 | 0.0866 | - | - | - |
| 0.3158 | 6 | 0.069 | - | - | - |
| 0.3684 | 7 | 0.3537 | - | - | - |
| 0.4211 | 8 | 0.122 | - | - | - |
| 0.4737 | 9 | 0.1622 | - | - | - |
| 0.5263 | 10 | 0.1299 | - | - | - |
| 0.5789 | 11 | 0.2733 | - | - | - |
| 0.6316 | 12 | 0.1462 | - | - | - |
| 0.6842 | 13 | 0.3868 | - | - | - |
| 0.7368 | 14 | 0.2076 | - | - | - |
| 0.7895 | 15 | 0.1524 | - | - | - |
| 0.8421 | 16 | 0.2408 | - | - | - |
| 0.8947 | 17 | 0.3624 | - | - | - |
| 0.9474 | 18 | 0.3834 | - | - | - |
| 1.0 | 19 | 0.2456 | 0.7823 | - | - |
| 1.0526 | 20 | 0.1087 | - | - | - |
| 1.1053 | 21 | 0.1406 | - | - | - |
| 1.1579 | 22 | 0.1029 | - | - | - |
| 1.2105 | 23 | 0.1475 | - | - | - |
| 1.2632 | 24 | 0.1049 | - | - | - |
| 1.3158 | 25 | 0.053 | - | - | - |
| 1.3684 | 26 | 0.3995 | - | - | - |
| 1.4211 | 27 | 0.1227 | - | - | - |
| 1.4737 | 28 | 0.2695 | - | - | - |
| 1.5263 | 29 | 0.2224 | - | - | - |
| 1.5789 | 30 | 0.0945 | - | - | - |
| 1.6316 | 31 | 0.1475 | - | - | - |
| 1.6842 | 32 | 0.4774 | - | - | - |
| 1.7368 | 33 | 0.0315 | - | - | - |
| 1.7895 | 34 | 0.1688 | - | - | - |
| 1.8421 | 35 | 0.3641 | - | - | - |
| 1.8947 | 36 | 0.1004 | - | - | - |
| 1.9474 | 37 | 0.1414 | - | - | - |
| 2.0 | 38 | 0.067 | 0.7837 | - | - |
| 2.0526 | 39 | 0.1435 | - | - | - |
| 2.1053 | 40 | 0.2146 | - | - | - |
| 2.1579 | 41 | 0.2392 | - | - | - |
| 2.2105 | 42 | 0.1392 | - | - | - |
| 2.2632 | 43 | 0.3378 | - | - | - |
| 2.3158 | 44 | 0.0715 | - | - | - |
| 2.3684 | 45 | 0.1154 | - | - | - |
| 2.4211 | 46 | 0.2249 | - | - | - |
| 2.4737 | 47 | 0.0407 | - | - | - |
| 2.5263 | 48 | 0.0414 | - | - | - |
| 2.5789 | 49 | 0.1295 | - | - | - |
| 2.6316 | 50 | 0.0922 | - | - | - |
| 2.6842 | 51 | 0.077 | - | - | - |
| 2.7368 | 52 | 0.4554 | - | - | - |
| 2.7895 | 53 | 0.0699 | - | - | - |
| 2.8421 | 54 | 0.0663 | - | - | - |
| 2.8947 | 55 | 0.2612 | - | - | - |
| 2.9474 | 56 | 0.1907 | - | - | - |
| 3.0 | 57 | 0.1049 | 0.7811 | - | - |
| 3.0526 | 58 | 0.1027 | - | - | - |
| 3.1053 | 59 | 0.2408 | - | - | - |
| 3.1579 | 60 | 0.0248 | - | - | - |
| 3.2105 | 61 | 0.2142 | - | - | - |
| 3.2632 | 62 | 0.1579 | - | - | - |
| 3.3158 | 63 | 0.0789 | - | - | - |
| 3.3684 | 64 | 0.0668 | - | - | - |
| 3.4211 | 65 | 0.1484 | - | - | - |
| 3.4737 | 66 | 0.3956 | - | - | - |
| 3.5263 | 67 | 0.1063 | - | - | - |
| 3.5789 | 68 | 0.4022 | - | - | - |
| 3.6316 | 69 | 0.5607 | - | - | - |
| 3.6842 | 70 | 0.0283 | - | - | - |
| 3.7368 | 71 | 0.0781 | - | - | - |
| 3.7895 | 72 | 0.248 | - | - | - |
| 3.8421 | 73 | 0.08 | - | - | - |
| 3.8947 | 74 | 0.2495 | - | - | - |
| 3.9474 | 75 | 0.1528 | - | - | - |
| 4.0 | 76 | 0.2234 | - | - | - |
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{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 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},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}