Views
No views yet
SentenceTransformer(
(0): CLIPModel()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("hwang2006/clip-title-thumbnail-embeddings")
5# Run inference
6sentences = [
7 'My $100,000+ Data Science Resume (what got me hired)',
8 'The Mapper Algorithm | Overview & Python Example Code',
9 'How to Build Data Pipelines for ML Projects (w/ Python Code)',
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)
18# tensor([[1.0000, 0.2549, 0.3967],
19# [0.2549, 1.0000, 0.2753],
20# [0.3967, 0.2753, 1.0000]])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 0x2AAEDA0F6690> | Multimodal RAG: A Beginner-friendly Guide (with Python Code) | What Nature Can Teach Us About Business... |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x2AAEDA0F5EE0> | Detecting Power Laws in Real-world Data | w/ Python Code | I Have 90 Days to Make $10k/mo—Here's my plan |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x2AAEDA0F54F0> | I Quit My Job… Here’s How Much I Made 1 Year Later | Persistent Homology | Introduction & Python Example Code |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false
5}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 0x2AAEDA0F44A0> | I Was Wrong About AI Consulting (what I learned) | How to Make a Data Science Portfolio With GitHub Pages (2024) |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x2AAEDA0F5C10> | My $100,000+ Data Science Resume (what got me hired) | The Mapper Algorithm | Overview & Python Example Code |
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=480x360 at 0x2AAEDA0F63F0> | 4 Skills You Need to Be a Full-Stack Data Scientist | Fine-Tuning Text Embeddings For Domain-specific Search (w/ Python) |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false
5}eval_strategy: epochlearning_rate: 1e-05num_train_epochs: 2use_cpu: Truedataloader_pin_memory: Falseoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_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: 1e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 2max_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: Trueuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: 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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Falsedataloader_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: Falsehub_revision: Nonegradient_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.1429 | 1 | 1.4044 | - |
| 0.2857 | 2 | 1.4737 | - |
| 0.4286 | 3 | 1.015 | - |
| 0.5714 | 4 | 1.0862 | - |
| 0.7143 | 5 | 0.5453 | - |
| 0.8571 | 6 | 0.8977 | - |
| 1.0 | 7 | 0.4673 | 0.9324 |
| 1.1429 | 8 | 0.1536 | - |
| 1.2857 | 9 | 0.3095 | - |
| 1.4286 | 10 | 0.1654 | - |
| 1.5714 | 11 | 0.2522 | - |
| 1.7143 | 12 | 0.1947 | - |
| 1.8571 | 13 | 0.1257 | - |
| 2.0 | 14 | 0.1009 | 0.9172 |
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}