weizhou03's picture
Push model using huggingface_hub.
2c71a9a verified
|
raw
history blame
16 kB
---
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
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->
### 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 | <ul><li>'Add a corporate presentation background'</li><li>'Insert a modern icon set for the design'</li></ul> |
| 1 | <ul><li>'Show me some background options for my design'</li><li>'I need some modern design assets'</li></ul> |
| 2 | <ul><li>'Add a footer with contact information'</li><li>'Insert a descriptive caption for the image'</li></ul> |
| 3 | <ul><li>'Align the shapes to the top'</li><li>'Right align the buttons'</li></ul> |
| 4 | <ul><li>'Make the image slide from left'</li><li>'Make the image bounce in'</li></ul> |
| 5 | <ul><li>'Add a spiral animation to the page'</li><li>'Make the page bounce in from the top'</li></ul> |
| 6 | <ul><li>'Take out the cat and put a dog in the image'</li><li>"Add glasses to the person's face"</li></ul> |
| 7 | <ul><li>'Delete the test element'</li><li>'Remove the unused icon'</li></ul> |
| 8 | <ul><li>'How do I change the font size?'</li><li>'How can I duplicate elements?'</li></ul> |
| 9 | <ul><li>'Distribute the buttons around the center image'</li><li>'Arrange the shapes in a circle pattern'</li></ul> |
| 10 | <ul><li>'Create a variation of this design'</li><li>'Make a copy for editing'</li></ul> |
| 11 | <ul><li>'Duplicate the shape and change its color'</li><li>'Copy the image and make it smaller'</li></ul> |
| 12 | <ul><li>'Copy the text to the last page'</li><li>'Duplicate the footer to page 2'</li></ul> |
| 13 | <ul><li>'Fix the text layout'</li><li>'Improve the overall typography'</li></ul> |
| 14 | <ul><li>'Mirror the icon horizontally'</li><li>'Flip the shape vertically'</li></ul> |
| 15 | <ul><li>'Create a photo of a beautiful garden'</li><li>'Create a photo of a delicious pizza'</li></ul> |
| 16 | <ul><li>'Generate an Instagram post for a birthday'</li><li>'Generate a Facebook post for a birthday'</li></ul> |
| 17 | <ul><li>'Group the icons together'</li><li>'Group the menu items'</li></ul> |
| 18 | <ul><li>'Position the image at the top right'</li><li>'Move the image to the center'</li></ul> |
| 19 | <ul><li>'Add a dreamy effect'</li><li>'Make the image pop with color'</li></ul> |
| 20 | <ul><li>'Suggest some shape designs'</li><li>'Suggest some button designs'</li></ul> |
| 21 | <ul><li>'Redo the filter effect'</li><li>'Bring back the original position'</li></ul> |
| 22 | <ul><li>'Remove the background from the icon'</li><li>'Remove the background from the logo'</li></ul> |
| 23 | <ul><li>'Delete the watermark'</li><li>'Remove the graffiti'</li></ul> |
| 24 | <ul><li>'Change the decorative element'</li><li>'Change the background image'</li></ul> |
| 25 | <ul><li>'Update the body text'</li><li>'Change the subtitle'</li></ul> |
| 26 | <ul><li>'Remove all filters from the image'</li><li>'Restore the original brightness'</li></ul> |
| 27 | <ul><li>'Reduce the shape size'</li><li>'Increase the image size'</li></ul> |
| 28 | <ul><li>'Change to poster size'</li><li>'Resize to Facebook post dimensions'</li></ul> |
| 29 | <ul><li>'Rotate the element 60 degrees'</li><li>'Rotate the image 90 degrees'</li></ul> |
| 30 | <ul><li>'Randomly place the icons on the page'</li><li>'Randomly place the shapes on the page'</li></ul> |
| 31 | <ul><li>'Select the decorative elements'</li><li>'Choose the heading text'</li></ul> |
| 32 | <ul><li>'Make the background transparent'</li><li>'Change to a dark background'</li></ul> |
| 33 | <ul><li>'Change the blend mode to screen'</li><li>'Set the blend mode to darken'</li></ul> |
| 34 | <ul><li>'Add a gaussian blur'</li><li>'Blur the background elements'</li></ul> |
| 35 | <ul><li>'Add a gradient border'</li><li>'Change the border opacity'</li></ul> |
| 36 | <ul><li>'Make the image more brilliant'</li><li>'Increase the brightness contrast'</li></ul> |
| 37 | <ul><li>'Send the background to the back'</li><li>'Send the watermark to the back'</li></ul> |
| 38 | <ul><li>'Make the image more dramatic'</li><li>'Make the image more defined'</li></ul> |
| 39 | <ul><li>'Make the image square'</li><li>'Crop the image to a circle'</li></ul> |
| 40 | <ul><li>'Add a directional shadow'</li><li>'Create a floating shadow'</li></ul> |
| 41 | <ul><li>'Change the color to silver'</li><li>'Change the button color to purple'</li></ul> |
| 42 | <ul><li>'Increase the body text size'</li><li>'Increase the heading size'</li></ul> |
| 43 | <ul><li>'Add strikethrough to the text'</li><li>'Add strikethrough to the label'</li></ul> |
| 44 | <ul><li>'Use a serif font for the heading'</li><li>'Change to a clean font'</li></ul> |
| 45 | <ul><li>'Brighten the light areas'</li><li>'Enhance the bright spots'</li></ul> |
| 46 | <ul><li>'Set the image as full-page background'</li><li>'Make the image the background layer'</li></ul> |
| 47 | <ul><li>'Reduce the letter spacing'</li><li>'Add more space between letters'</li></ul> |
| 48 | <ul><li>'Make the text more compact'</li><li>'Reduce the line height'</li></ul> |
| 49 | <ul><li>'Increase the transparency of the element'</li><li>'Make the element semi-transparent'</li></ul> |
| 50 | <ul><li>'Add spacing between text blocks'</li><li>'Make the paragraphs more compact'</li></ul> |
| 51 | <ul><li>'Reduce the color richness'</li><li>'Reduce the color vibrancy'</li></ul> |
| 52 | <ul><li>'Make the shadows more prominent'</li><li>'Increase the shadow intensity'</li></ul> |
| 53 | <ul><li>'Increase the image resolution'</li><li>'Make the details more sharp'</li></ul> |
| 54 | <ul><li>'Right align the caption'</li><li>'Center the button text'</li></ul> |
| 55 | <ul><li>'Create a decorative border'</li><li>'Create a border around the text'</li></ul> |
| 56 | <ul><li>'Make the text flow in an arc'</li><li>'Create text that follows a circle'</li></ul> |
| 57 | <ul><li>'Convert the text to a list format'</li><li>'Make the text into a numbered sequence'</li></ul> |
| 58 | <ul><li>'Add a dramatic text shadow'</li><li>'Add a colored glow to the text'</li></ul> |
| 59 | <ul><li>'Make the image more amber'</li><li>'Increase the warm color balance'</li></ul> |
| 60 | <ul><li>'Open the file upload dialog'</li><li>'I need to upload a logo'</li></ul> |
| 61 | <ul><li>'Go back to the original position'</li><li>'Go back to the original text'</li></ul> |
| 62 | <ul><li>'Separate the combined elements'</li><li>'Ungroup the merged elements'</li></ul> |
## 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")
```
<!--
### Downstream Use
*List how someone could finetune this model on their own dataset.*
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
<!--
## Bias, Risks and Limitations
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->
<!--
### Recommendations
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->
## 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}
}
```
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->