---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: Cheers, sololander!
- text: At least it’s not anything worse, and that you are still close to that person
:)
- text: It's crazy how far Photoshop has come. Underwater bridges?!! NEVER!!!
- text: My favourite food is anything I didn't have to cook myself.
- text: You are going to do the dishes now
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
base_model: sentence-transformers/paraphrase-mpnet-base-v2
model-index:
- name: SetFit with sentence-transformers/paraphrase-mpnet-base-v2
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: Unknown
type: unknown
split: test
metrics:
- type: accuracy
value: 0.3
name: Accuracy
---
# SetFit with sentence-transformers/paraphrase-mpnet-base-v2
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2) 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:** [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 512 tokens
- **Number of Classes:** 23 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 |
|:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 27 |
- 'that is what retardation looks like'
- "Don't kiss your doorbell! Or anyone else's for that matter..."
- 'Hello everyone. Im from Toronto as well. Can call and visit in personal if needed.'
|
| 2 | - "Troll, bro. They know they're saying stupid shit. The motherfucker does nothing but stink up libertarian subs talking shit"
- 'Ok, then what the actual fuck is your plan?'
- 'Stupidly stubborn / stubbornly stupid'
|
| 4 | - 'Pay you for what, just standing there? Done.'
- "Sometimes life actually hands you lemons. We're just lucky that we have a proverbial phrase that gives us an idea of what we can do with them."
- "true I am a troll, but fortunately for me I'm not emotionally invested in it."
|
| 3 | - 'Dirty Southern Wankers'
- 'Shit, I guess I accidentally bought a Pay-Per-View boxing match'
- 'The republicans are the military. You are an idiot.'
|
| 0 | - 'Awesome! I’m a cradle [RELIGION], so really interesting to hear your experience. Thanks for sharing.'
- 'What a wonderful world'
- 'Twilight... STILL a better love story than The Last Jedi!'
|
| 6 | - "All sounds possible except the key, I can't see how it was missed in the first search. "
- 'What does FPTP have to do with the referendum?'
- 'Maybe that’s what happened to the great white at Houston zoo'
|
| 10 | - "This isn't really wholesome"
|
| 16 | - 'I read on a different post that he died shortly after of internal injuries.'
- 'I miss them being alive'
|
| 7 | - 'I think the 90 day rule applies to increases over 5%?'
- 'So this means the people who have debt can see those that don’t. Am I sensing an easier target for muggings and such?'
|
| 1 | - "Aww... she'll probably come around eventually, I'm sure she was just jealous of [NAME]... I mean, what woman wouldn't be! lol "
- 'And then they say, “HAHAHAHHA IT WAS RIGHT THERE WOW!”'
- 'just noticed, lol. damn pervert foreigners.'
|
| 25 | - 'my brain hurts...'
- 'Pretty sure I’ve seen this. He swings away with the harness he is wearing. Still looks painful but I think he lives'
- 'sorry [NAME]! 😘😘😘'
|
| 15 | - 'Super, thanks'
- 'Thank you friend'
- 'Yes I heard abt the f bombs! That has to be why. Thanks for your reply:) until then hubby and I will anxiously wait 😝'
|
| 18 | - 'I love Rocket Love and Blasted. I just wonder who the songs were written for because these are all reference tracks except Acura Intergul'
|
| 26 | - "OmG pEyToN iSn'T gOoD eNoUgH tO hElP uS iN tHe PlAyOfFs! Dumbass Broncos fans circa December 2015."
|
| 17 | - 'Happy to be able to help.'
|
| 8 | - 'We need more boards and to create a bit more space for [NAME]. Then we’ll be good.'
|
| 5 | - "R/sleeptrain Might be time for some sleep training. Take a look and try to feel out what's right for your family."
|
| 14 | - 'To make her feel threatened'
|
| 13 | - 'Very interesting. Thx'
- 'This...has 9k upvotes. Wow.'
|
| 20 | - "It's true though. He either gets no shirt and freezes to death or wears a stupid looking butchers cape. I hope he gets something better next season"
|
| 12 | - "I just shit my pants. Then walk away. Embarrassing enough he won't press or follow you."
- 'i got a bump and a bald spot. i feel dumb <3'
|
| 9 | - 'He was off by 5 minutes, not impressed. '
|
| 24 | - 'Apologies, I take it all back as I’ve just seen his latest effort'
|
## Evaluation
### Metrics
| Label | Accuracy |
|:--------|:---------|
| **all** | 0.3 |
## 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("Cheers, sololander!")
```
## Training Details
### Training Set Metrics
| Training set | Min | Median | Max |
|:-------------|:----|:-------|:----|
| Word count | 2 | 10.6 | 27 |
| Label | Training Sample Count |
|:------|:----------------------|
| 0 | 10 |
| 1 | 3 |
| 2 | 5 |
| 3 | 4 |
| 4 | 5 |
| 5 | 1 |
| 6 | 4 |
| 7 | 2 |
| 8 | 1 |
| 9 | 1 |
| 10 | 1 |
| 12 | 2 |
| 13 | 2 |
| 14 | 1 |
| 15 | 5 |
| 16 | 2 |
| 17 | 1 |
| 18 | 1 |
| 20 | 1 |
| 24 | 1 |
| 25 | 3 |
| 26 | 1 |
| 27 | 33 |
### Training Hyperparameters
- batch_size: (32, 32)
- 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.0047 | 1 | 0.2551 | - |
| 0.2358 | 50 | 0.2056 | - |
| 0.4717 | 100 | 0.0522 | - |
| 0.7075 | 150 | 0.0206 | - |
| 0.9434 | 200 | 0.0154 | - |
### Framework Versions
- Python: 3.12.12
- SetFit: 1.1.3
- Sentence Transformers: 5.1.2
- Transformers: 4.57.1
- PyTorch: 2.8.0+cu126
- Datasets: 4.0.0
- Tokenizers: 0.22.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}
}
```