---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: I need some modern design assets
- text: Reduce the letter spacing
- text: Group the menu items
- text: Create a photo of a delicious pizza
- text: Mirror the icon horizontally
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
base_model: nomic-ai/nomic-embed-text-v1.5
model-index:
- name: SetFit with nomic-ai/nomic-embed-text-v1.5
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: Unknown
type: unknown
split: test
metrics:
- type: accuracy
value: 0.4163860830527497
name: Accuracy
---
# SetFit with nomic-ai/nomic-embed-text-v1.5
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [nomic-ai/nomic-embed-text-v1.5](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
2. Training a classification head with features from the fine-tuned Sentence Transformer.
## Model Details
### Model Description
- **Model Type:** SetFit
- **Sentence Transformer body:** [nomic-ai/nomic-embed-text-v1.5](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 8192 tokens
- **Number of Classes:** 63 classes
### Model Sources
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
### Model Labels
| Label | Examples |
|:------|:--------------------------------------------------------------------------------------------------------------------|
| 0 |
- 'Add a corporate presentation background'
- 'Insert a modern icon set for the design'
|
| 1 | - 'Show me some background options for my design'
- 'I need some modern design assets'
|
| 2 | - 'Add a footer with contact information'
- 'Insert a descriptive caption for the image'
|
| 3 | - 'Align the shapes to the top'
- 'Right align the buttons'
|
| 4 | - 'Make the image slide from left'
- 'Make the image bounce in'
|
| 5 | - 'Add a spiral animation to the page'
- 'Make the page bounce in from the top'
|
| 6 | - 'Take out the cat and put a dog in the image'
- "Add glasses to the person's face"
|
| 7 | - 'Delete the test element'
- 'Remove the unused icon'
|
| 8 | - 'How do I change the font size?'
- 'How can I duplicate elements?'
|
| 9 | - 'Distribute the buttons around the center image'
- 'Arrange the shapes in a circle pattern'
|
| 10 | - 'Create a variation of this design'
- 'Make a copy for editing'
|
| 11 | - 'Duplicate the shape and change its color'
- 'Copy the image and make it smaller'
|
| 12 | - 'Copy the text to the last page'
- 'Duplicate the footer to page 2'
|
| 13 | - 'Fix the text layout'
- 'Improve the overall typography'
|
| 14 | - 'Mirror the icon horizontally'
- 'Flip the shape vertically'
|
| 15 | - 'Create a photo of a beautiful garden'
- 'Create a photo of a delicious pizza'
|
| 16 | - 'Generate an Instagram post for a birthday'
- 'Generate a Facebook post for a birthday'
|
| 17 | - 'Group the icons together'
- 'Group the menu items'
|
| 18 | - 'Position the image at the top right'
- 'Move the image to the center'
|
| 19 | - 'Add a dreamy effect'
- 'Make the image pop with color'
|
| 20 | - 'Suggest some shape designs'
- 'Suggest some button designs'
|
| 21 | - 'Redo the filter effect'
- 'Bring back the original position'
|
| 22 | - 'Remove the background from the icon'
- 'Remove the background from the logo'
|
| 23 | - 'Delete the watermark'
- 'Remove the graffiti'
|
| 24 | - 'Change the decorative element'
- 'Change the background image'
|
| 25 | - 'Update the body text'
- 'Change the subtitle'
|
| 26 | - 'Remove all filters from the image'
- 'Restore the original brightness'
|
| 27 | - 'Reduce the shape size'
- 'Increase the image size'
|
| 28 | - 'Change to poster size'
- 'Resize to Facebook post dimensions'
|
| 29 | - 'Rotate the element 60 degrees'
- 'Rotate the image 90 degrees'
|
| 30 | - 'Randomly place the icons on the page'
- 'Randomly place the shapes on the page'
|
| 31 | - 'Select the decorative elements'
- 'Choose the heading text'
|
| 32 | - 'Make the background transparent'
- 'Change to a dark background'
|
| 33 | - 'Change the blend mode to screen'
- 'Set the blend mode to darken'
|
| 34 | - 'Add a gaussian blur'
- 'Blur the background elements'
|
| 35 | - 'Add a gradient border'
- 'Change the border opacity'
|
| 36 | - 'Make the image more brilliant'
- 'Increase the brightness contrast'
|
| 37 | - 'Send the background to the back'
- 'Send the watermark to the back'
|
| 38 | - 'Make the image more dramatic'
- 'Make the image more defined'
|
| 39 | - 'Make the image square'
- 'Crop the image to a circle'
|
| 40 | - 'Add a directional shadow'
- 'Create a floating shadow'
|
| 41 | - 'Change the color to silver'
- 'Change the button color to purple'
|
| 42 | - 'Increase the body text size'
- 'Increase the heading size'
|
| 43 | - 'Add strikethrough to the text'
- 'Add strikethrough to the label'
|
| 44 | - 'Use a serif font for the heading'
- 'Change to a clean font'
|
| 45 | - 'Brighten the light areas'
- 'Enhance the bright spots'
|
| 46 | - 'Set the image as full-page background'
- 'Make the image the background layer'
|
| 47 | - 'Reduce the letter spacing'
- 'Add more space between letters'
|
| 48 | - 'Make the text more compact'
- 'Reduce the line height'
|
| 49 | - 'Increase the transparency of the element'
- 'Make the element semi-transparent'
|
| 50 | - 'Add spacing between text blocks'
- 'Make the paragraphs more compact'
|
| 51 | - 'Reduce the color richness'
- 'Reduce the color vibrancy'
|
| 52 | - 'Make the shadows more prominent'
- 'Increase the shadow intensity'
|
| 53 | - 'Increase the image resolution'
- 'Make the details more sharp'
|
| 54 | - 'Right align the caption'
- 'Center the button text'
|
| 55 | - 'Create a decorative border'
- 'Create a border around the text'
|
| 56 | - 'Make the text flow in an arc'
- 'Create text that follows a circle'
|
| 57 | - 'Convert the text to a list format'
- 'Make the text into a numbered sequence'
|
| 58 | - 'Add a dramatic text shadow'
- 'Add a colored glow to the text'
|
| 59 | - 'Make the image more amber'
- 'Increase the warm color balance'
|
| 60 | - 'Open the file upload dialog'
- 'I need to upload a logo'
|
| 61 | - 'Go back to the original position'
- 'Go back to the original text'
|
| 62 | - 'Separate the combined elements'
- 'Ungroup the merged elements'
|
## Evaluation
### Metrics
| Label | Accuracy |
|:--------|:---------|
| **all** | 0.4164 |
## Uses
### Direct Use for Inference
First install the SetFit library:
```bash
pip install setfit
```
Then you can load this model and run inference.
```python
from setfit import SetFitModel
# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("setfit_model_id")
# Run inference
preds = model("Group the menu items")
```
## Training Details
### Training Set Metrics
| Training set | Min | Median | Max |
|:-------------|:----|:-------|:----|
| Word count | 3 | 5.2302 | 11 |
| Label | Training Sample Count |
|:------|:----------------------|
| 0 | 2 |
| 1 | 2 |
| 2 | 2 |
| 3 | 2 |
| 4 | 2 |
| 5 | 2 |
| 6 | 2 |
| 7 | 2 |
| 8 | 2 |
| 9 | 2 |
| 10 | 2 |
| 11 | 2 |
| 12 | 2 |
| 13 | 2 |
| 14 | 2 |
| 15 | 2 |
| 16 | 2 |
| 17 | 2 |
| 18 | 2 |
| 19 | 2 |
| 20 | 2 |
| 21 | 2 |
| 22 | 2 |
| 23 | 2 |
| 24 | 2 |
| 25 | 2 |
| 26 | 2 |
| 27 | 2 |
| 28 | 2 |
| 29 | 2 |
| 30 | 2 |
| 31 | 2 |
| 32 | 2 |
| 33 | 2 |
| 34 | 2 |
| 35 | 2 |
| 36 | 2 |
| 37 | 2 |
| 38 | 2 |
| 39 | 2 |
| 40 | 2 |
| 41 | 2 |
| 42 | 2 |
| 43 | 2 |
| 44 | 2 |
| 45 | 2 |
| 46 | 2 |
| 47 | 2 |
| 48 | 2 |
| 49 | 2 |
| 50 | 2 |
| 51 | 2 |
| 52 | 2 |
| 53 | 2 |
| 54 | 2 |
| 55 | 2 |
| 56 | 2 |
| 57 | 2 |
| 58 | 2 |
| 59 | 2 |
| 60 | 2 |
| 61 | 2 |
| 62 | 2 |
### Training Hyperparameters
- batch_size: (64, 64)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- body_learning_rate: (2e-05, 1e-05)
- head_learning_rate: 0.01
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False
### Training Results
| Epoch | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0041 | 1 | 0.1097 | - |
| 0.2041 | 50 | 0.0477 | - |
| 0.4082 | 100 | 0.0106 | - |
| 0.6122 | 150 | 0.0045 | - |
| 0.8163 | 200 | 0.0032 | - |
### Framework Versions
- Python: 3.12.11
- SetFit: 1.1.3
- Sentence Transformers: 5.1.0
- Transformers: 4.54.1
- PyTorch: 2.7.1
- Datasets: 4.0.0
- Tokenizers: 0.21.4
## Citation
### BibTeX
```bibtex
@article{https://doi.org/10.48550/arxiv.2209.11055,
doi = {10.48550/ARXIV.2209.11055},
url = {https://arxiv.org/abs/2209.11055},
author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {Efficient Few-Shot Learning Without Prompts},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}
```