bhaskars113's picture
Add SetFit model
7260e4a verified
---
library_name: setfit
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
base_model: sentence-transformers/all-mpnet-base-v2
datasets:
- bhaskars113/toyota-paint-attributes
metrics:
- accuracy
widget:
- text: Hey guys, I'm buying a 2004 Mach 1 Mustang and I'm super excited! It's in
great condition and has only had one owner. Only thing is the grill mustang ornament
was stolen years ago he said and he never bothered to replace it. After searching
online I cannot find anything that's at least a reliable source. I am in Canada
by the way. If anyone knows how to search one down I would be very appreciative!
Thanks!
- text: Mine is actually gold! I think the official paint name is harvest gold. It's
nice but I'd rather something like the two-tone paints of the 2nd gen. The dull
metallic gold reminds me of boring grey old corollas lol
- text: Arrgh. Click to expand... Welcome to owning a Jeep/Dodge product. in 150,000km
of ownership of our Jeep, we have replaced everything in the suspension 2 times,
throttle body, 3 sets of plugs, various electrical things, stereo pooped the bed,
I could go on and on. The most reliable dodge/jeep product I owned was my 2011
Wrangler Once I removed all the dumb design features jeep put there, like freaking
plastic in the ball joints. Move to another brand and be MUCH happier. We have
179k on our Ford F150 5.0 and all that's been replaced is one set of plugs and
one ball joint.
- text: The car is from Utah and garage kept, so the paint is still in very good condition
- text: I've seen wonders done by a good paintless dent repair professional. The right
person with the right tools could make this look brand new, or at least better
than slightly mismatched paint.
pipeline_tag: text-classification
inference: false
---
# SetFit with sentence-transformers/all-mpnet-base-v2
This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [bhaskars113/toyota-paint-attributes](https://huggingface.co/datasets/bhaskars113/toyota-paint-attributes) dataset that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) as the Sentence Transformer embedding model. A OneVsRestClassifier 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:** [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2)
- **Classification head:** a OneVsRestClassifier instance
- **Maximum Sequence Length:** 384 tokens
<!-- - **Number of Classes:** Unknown -->
- **Training Dataset:** [bhaskars113/toyota-paint-attributes](https://huggingface.co/datasets/bhaskars113/toyota-paint-attributes)
<!-- - **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)
## 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("bhaskars113/toyota-paint-attribute-1.1")
# Run inference
preds = model("The car is from Utah and garage kept, so the paint is still in very good condition")
```
<!--
### 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 | 5 | 33.8098 | 155 |
### Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 20
- body_learning_rate: (2e-05, 2e-05)
- head_learning_rate: 2e-05
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False
### Training Results
| Epoch | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0004 | 1 | 0.1664 | - |
| 0.0196 | 50 | 0.2377 | - |
| 0.0392 | 100 | 0.1178 | - |
| 0.0588 | 150 | 0.0577 | - |
| 0.0784 | 200 | 0.0163 | - |
| 0.0980 | 250 | 0.0265 | - |
| 0.1176 | 300 | 0.0867 | - |
| 0.1373 | 350 | 0.0181 | - |
| 0.1569 | 400 | 0.0153 | - |
| 0.1765 | 450 | 0.0411 | - |
| 0.1961 | 500 | 0.0308 | - |
| 0.2157 | 550 | 0.0258 | - |
| 0.2353 | 600 | 0.0062 | - |
| 0.2549 | 650 | 0.0036 | - |
| 0.2745 | 700 | 0.0087 | - |
| 0.2941 | 750 | 0.0025 | - |
| 0.3137 | 800 | 0.004 | - |
| 0.3333 | 850 | 0.0025 | - |
| 0.3529 | 900 | 0.0044 | - |
| 0.3725 | 950 | 0.0031 | - |
| 0.3922 | 1000 | 0.0018 | - |
| 0.4118 | 1050 | 0.0046 | - |
| 0.4314 | 1100 | 0.0013 | - |
| 0.4510 | 1150 | 0.0014 | - |
| 0.4706 | 1200 | 0.002 | - |
| 0.4902 | 1250 | 0.0015 | - |
| 0.5098 | 1300 | 0.0039 | - |
| 0.5294 | 1350 | 0.0019 | - |
| 0.5490 | 1400 | 0.0011 | - |
| 0.5686 | 1450 | 0.0008 | - |
| 0.5882 | 1500 | 0.0015 | - |
| 0.6078 | 1550 | 0.0012 | - |
| 0.6275 | 1600 | 0.0011 | - |
| 0.6471 | 1650 | 0.0008 | - |
| 0.6667 | 1700 | 0.0016 | - |
| 0.6863 | 1750 | 0.0009 | - |
| 0.7059 | 1800 | 0.0008 | - |
| 0.7255 | 1850 | 0.0008 | - |
| 0.7451 | 1900 | 0.0008 | - |
| 0.7647 | 1950 | 0.0011 | - |
| 0.7843 | 2000 | 0.0008 | - |
| 0.8039 | 2050 | 0.001 | - |
| 0.8235 | 2100 | 0.001 | - |
| 0.8431 | 2150 | 0.0009 | - |
| 0.8627 | 2200 | 0.0067 | - |
| 0.8824 | 2250 | 0.0008 | - |
| 0.9020 | 2300 | 0.0009 | - |
| 0.9216 | 2350 | 0.0009 | - |
| 0.9412 | 2400 | 0.0007 | - |
| 0.9608 | 2450 | 0.0006 | - |
| 0.9804 | 2500 | 0.0007 | - |
| 1.0 | 2550 | 0.0006 | - |
### Framework Versions
- Python: 3.10.12
- SetFit: 1.0.3
- Sentence Transformers: 2.7.0
- Transformers: 4.40.2
- PyTorch: 2.2.1+cu121
- Datasets: 2.19.1
- Tokenizers: 0.19.1
## 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.*
-->