---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:53
- loss:MultipleNegativesRankingLoss
base_model: sentence-transformers/clip-ViT-L-14
widget:
- source_sentence: The Hugging Face Transformers Library | Example Code + Chatbot
UI with Gradio
sentences:
- Shit Happens, Stay Solution Oriented
- 3 Ways to Make a Custom AI Assistant | RAG, Tools, & Fine-tuning
- How to Manage Data Science Projects
- source_sentence: 5 Questions Every Data Scientist Should Hardcode into Their Brain
sentences:
- 5 AI Projects You Can Build This Weekend (with Python)
- An Introduction to Decision Trees | Gini Impurity & Python Code
- How to Deploy ML Solutions with FastAPI, Docker, & AWS
- source_sentence: My $100,000+ Data Science Resume (what got me hired)
sentences:
- The Mapper Algorithm | Overview & Python Example Code
- How to Build Data Pipelines for ML Projects (w/ Python Code)
- How to Make a Data Science Portfolio With GitHub Pages (2024)
datasets:
- shawhin/yt-title-thumbnail-pairs
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy
model-index:
- name: SentenceTransformer based on sentence-transformers/clip-ViT-L-14
results:
- task:
type: triplet
name: Triplet
dataset:
name: yt title thumbnail train
type: yt-title-thumbnail-train
metrics:
- type: cosine_accuracy
value: 1.0
name: Cosine Accuracy
- task:
type: triplet
name: Triplet
dataset:
name: yt title thumbnail valid
type: yt-title-thumbnail-valid
metrics:
- type: cosine_accuracy
value: 1.0
name: Cosine Accuracy
---
# SentenceTransformer based on sentence-transformers/clip-ViT-L-14
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/clip-ViT-L-14](https://huggingface.co/sentence-transformers/clip-ViT-L-14) on the [yt-title-thumbnail-pairs](https://huggingface.co/datasets/shawhin/yt-title-thumbnail-pairs) dataset. It maps sentences & paragraphs to a None-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
A YouTube video and blog post walking through the model training are linked below.
Links:
- [Video link](https://youtu.be/W4s6b2ZM6kI)
- [Blog link](https://medium.com/towards-data-science/fine-tuning-multimodal-embedding-models-bf007b1c5da5)
- [Fine-tuned Model](https://huggingface.co/shawhin/clip-title-thumbnail-embeddings)
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [sentence-transformers/clip-ViT-L-14](https://huggingface.co/sentence-transformers/clip-ViT-L-14)
- **Maximum Sequence Length:** None tokens
- **Output Dimensionality:** None dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [yt-title-thumbnail-pairs](https://huggingface.co/datasets/shawhin/yt-title-thumbnail-pairs)
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): CLIPModel()
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("shawhin/clip-title-thumbnail-embeddings")
# Run inference
sentences = [
'My $100,000+ Data Science Resume (what got me hired)',
'The Mapper Algorithm | Overview & Python Example Code',
'How to Build Data Pipelines for ML Projects (w/ Python Code)',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Triplet
* Datasets: `yt-title-thumbnail-train` and `yt-title-thumbnail-valid`
* Evaluated with [TripletEvaluator](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.TripletEvaluator)
| Metric | yt-title-thumbnail-train | yt-title-thumbnail-valid |
|:--------------------|:-------------------------|:-------------------------|
| **cosine_accuracy** | **1.0** | **1.0** |
## Training Details
### Training Dataset
#### yt-title-thumbnail-pairs
* Dataset: [yt-title-thumbnail-pairs](https://huggingface.co/datasets/shawhin/yt-title-thumbnail-pairs) at [f97327c](https://huggingface.co/datasets/shawhin/yt-title-thumbnail-pairs/tree/f97327c11b7ddca68b7cfa4c9a225ac8fd987866)
* Size: 53 training samples
* Columns: anchor, positive, and negative
* Approximate statistics based on the first 53 samples:
| | anchor | positive | negative |
|:--------|:----------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | PIL.JpegImagePlugin.JpegImageFile | string | string |
| details |
| Multimodal RAG: A Beginner-friendly Guide (with Python Code) | What Nature Can Teach Us About Business... |
| | Detecting Power Laws in Real-world Data | w/ Python Code | I Have 90 Days to Make $10k/mo—Here's my plan |
| | I Quit My Job… Here’s How Much I Made 1 Year Later | Persistent Homology | Introduction & Python Example Code |
* Loss: [MultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Evaluation Dataset
#### yt-title-thumbnail-pairs
* Dataset: [yt-title-thumbnail-pairs](https://huggingface.co/datasets/shawhin/yt-title-thumbnail-pairs) at [f97327c](https://huggingface.co/datasets/shawhin/yt-title-thumbnail-pairs/tree/f97327c11b7ddca68b7cfa4c9a225ac8fd987866)
* Size: 11 evaluation samples
* Columns: anchor, positive, and negative
* Approximate statistics based on the first 11 samples:
| | anchor | positive | negative |
|:--------|:----------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | PIL.JpegImagePlugin.JpegImageFile | string | string |
| details | | I Was Wrong About AI Consulting (what I learned) | How to Make a Data Science Portfolio With GitHub Pages (2024) |
| | My $100,000+ Data Science Resume (what got me hired) | The Mapper Algorithm | Overview & Python Example Code |
| | 4 Skills You Need to Be a Full-Stack Data Scientist | Fine-Tuning Text Embeddings For Domain-specific Search (w/ Python) |
* Loss: [MultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: epoch
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `learning_rate`: 0.0001
- `num_train_epochs`: 2
#### All Hyperparameters