File size: 16,345 Bytes
f729712
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
---
library_name: setfit
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
metrics:
- accuracy
widget:
- text: is completely right on this. carnildo’s comment is just a waste of space.
    176.12.107.140
- text: '"   please do not vandalize pages, as you did with this edit to bella swan.
    if you continue to do so, you will be blocked from editing.   (talk) "'
- text: ipv6   mirc doesn't natively supports ipv6 protocols. it could be enabled
    by adding a external dll plugin who will enable a special protocol for dns and
    connecting to ipv6 servers.
- text: '"   link   thanks for fixing that disambiguation link on usher''s album )
    flash; "'
- text: '|b-class-1= yes  |b-class-2= yes  |b-class-3= yes  |b-class-4= yes  |b-class-5=
    yes'
pipeline_tag: text-classification
inference: true
base_model: sentence-transformers/paraphrase-mpnet-base-v2
---

# 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:** 2 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>', metal unless it was 70s oldskool'</li><li>"do whichever you think would be best then: if you rename the account, just let me know, and i'll go over there to recreate it; but if you'd prefer to rename the account, recreate it, and send me the password which i can then change, that's fine with me."</li><li>'" no, it was a far-too-much-of-an-in-joke on the fact that principle→principal is usually one of the first things the fa regulars jump on (along with the dreaded spaced em dash)\xa0–\xa0scent "'</li></ul>                                             |
| 1     | <ul><li>"oh, no! i just read the vile diatribe you left for me on my user page. no, you get no respect you ass little shit fuck you, you're an unhappy little dick puller!"</li><li>'fuck you   youfuckingidiot'</li><li>"hey , you are a chicken shit coward i told you that everytime you had one of your administrator buddies block me, i would quickly be back on with a new ip address editing your vandalism of this article. i meant it!!! why don't you stop masturbating to wikipedia and get a real life? i told you that you don't know who you're fuck with!!!"</li></ul> |

## 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("waterabbit114/my-setfit-classifier_obscene")
# Run inference
preds = model("\"   link   thanks for fixing that disambiguation link on usher's album ) flash; \"")
```

<!--
### 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   | 57.2   | 426 |

| Label | Training Sample Count |
|:------|:----------------------|
| 0     | 10                    |
| 1     | 10                    |

### Training Hyperparameters
- batch_size: (1, 1)
- num_epochs: (10, 10)
- 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.0013 | 1    | 0.1758        | -               |
| 0.0625 | 50   | 0.0036        | -               |
| 0.125  | 100  | 0.1383        | -               |
| 0.1875 | 150  | 0.0148        | -               |
| 0.25   | 200  | 0.0216        | -               |
| 0.3125 | 250  | 0.0001        | -               |
| 0.375  | 300  | 0.0021        | -               |
| 0.4375 | 350  | 0.001         | -               |
| 0.5    | 400  | 0.0015        | -               |
| 0.5625 | 450  | 0.0004        | -               |
| 0.625  | 500  | 0.0           | -               |
| 0.6875 | 550  | 0.0003        | -               |
| 0.75   | 600  | 0.0           | -               |
| 0.8125 | 650  | 0.0           | -               |
| 0.875  | 700  | 0.0           | -               |
| 0.9375 | 750  | 0.0001        | -               |
| 1.0    | 800  | 0.0           | -               |
| 1.0625 | 850  | 0.0           | -               |
| 1.125  | 900  | 0.0002        | -               |
| 1.1875 | 950  | 0.0           | -               |
| 1.25   | 1000 | 0.0008        | -               |
| 1.3125 | 1050 | 0.0002        | -               |
| 1.375  | 1100 | 0.0           | -               |
| 1.4375 | 1150 | 0.0           | -               |
| 1.5    | 1200 | 0.0           | -               |
| 1.5625 | 1250 | 0.0001        | -               |
| 1.625  | 1300 | 0.0           | -               |
| 1.6875 | 1350 | 0.0           | -               |
| 1.75   | 1400 | 0.0           | -               |
| 1.8125 | 1450 | 0.0           | -               |
| 1.875  | 1500 | 0.0           | -               |
| 1.9375 | 1550 | 0.0           | -               |
| 2.0    | 1600 | 0.0           | -               |
| 2.0625 | 1650 | 0.0001        | -               |
| 2.125  | 1700 | 0.0001        | -               |
| 2.1875 | 1750 | 0.0           | -               |
| 2.25   | 1800 | 0.0001        | -               |
| 2.3125 | 1850 | 0.0001        | -               |
| 2.375  | 1900 | 0.0002        | -               |
| 2.4375 | 1950 | 0.0           | -               |
| 2.5    | 2000 | 0.0001        | -               |
| 2.5625 | 2050 | 0.0001        | -               |
| 2.625  | 2100 | 0.0           | -               |
| 2.6875 | 2150 | 0.0001        | -               |
| 2.75   | 2200 | 0.0003        | -               |
| 2.8125 | 2250 | 0.0001        | -               |
| 2.875  | 2300 | 0.0           | -               |
| 2.9375 | 2350 | 0.0           | -               |
| 3.0    | 2400 | 0.0003        | -               |
| 3.0625 | 2450 | 0.0           | -               |
| 3.125  | 2500 | 0.0           | -               |
| 3.1875 | 2550 | 0.0           | -               |
| 3.25   | 2600 | 0.0           | -               |
| 3.3125 | 2650 | 0.0           | -               |
| 3.375  | 2700 | 0.0001        | -               |
| 3.4375 | 2750 | 0.0           | -               |
| 3.5    | 2800 | 0.0           | -               |
| 3.5625 | 2850 | 0.0           | -               |
| 3.625  | 2900 | 0.0001        | -               |
| 3.6875 | 2950 | 0.0           | -               |
| 3.75   | 3000 | 0.0001        | -               |
| 3.8125 | 3050 | 0.0           | -               |
| 3.875  | 3100 | 0.0           | -               |
| 3.9375 | 3150 | 0.0           | -               |
| 4.0    | 3200 | 0.0           | -               |
| 4.0625 | 3250 | 0.0           | -               |
| 4.125  | 3300 | 0.0           | -               |
| 4.1875 | 3350 | 0.0           | -               |
| 4.25   | 3400 | 0.0           | -               |
| 4.3125 | 3450 | 0.0           | -               |
| 4.375  | 3500 | 0.0001        | -               |
| 4.4375 | 3550 | 0.0001        | -               |
| 4.5    | 3600 | 0.0           | -               |
| 4.5625 | 3650 | 0.0           | -               |
| 4.625  | 3700 | 0.0           | -               |
| 4.6875 | 3750 | 0.0           | -               |
| 4.75   | 3800 | 0.0001        | -               |
| 4.8125 | 3850 | 0.0           | -               |
| 4.875  | 3900 | 0.0           | -               |
| 4.9375 | 3950 | 0.0           | -               |
| 5.0    | 4000 | 0.0           | -               |
| 5.0625 | 4050 | 0.0           | -               |
| 5.125  | 4100 | 0.0           | -               |
| 5.1875 | 4150 | 0.0           | -               |
| 5.25   | 4200 | 0.0           | -               |
| 5.3125 | 4250 | 0.0           | -               |
| 5.375  | 4300 | 0.0001        | -               |
| 5.4375 | 4350 | 0.0           | -               |
| 5.5    | 4400 | 0.0           | -               |
| 5.5625 | 4450 | 0.0           | -               |
| 5.625  | 4500 | 0.0           | -               |
| 5.6875 | 4550 | 0.0           | -               |
| 5.75   | 4600 | 0.0           | -               |
| 5.8125 | 4650 | 0.0           | -               |
| 5.875  | 4700 | 0.0           | -               |
| 5.9375 | 4750 | 0.0           | -               |
| 6.0    | 4800 | 0.0           | -               |
| 6.0625 | 4850 | 0.0           | -               |
| 6.125  | 4900 | 0.0           | -               |
| 6.1875 | 4950 | 0.0           | -               |
| 6.25   | 5000 | 0.0           | -               |
| 6.3125 | 5050 | 0.0           | -               |
| 6.375  | 5100 | 0.0           | -               |
| 6.4375 | 5150 | 0.0001        | -               |
| 6.5    | 5200 | 0.0           | -               |
| 6.5625 | 5250 | 0.0           | -               |
| 6.625  | 5300 | 0.0           | -               |
| 6.6875 | 5350 | 0.0           | -               |
| 6.75   | 5400 | 0.0           | -               |
| 6.8125 | 5450 | 0.0           | -               |
| 6.875  | 5500 | 0.0           | -               |
| 6.9375 | 5550 | 0.0           | -               |
| 7.0    | 5600 | 0.0001        | -               |
| 7.0625 | 5650 | 0.0           | -               |
| 7.125  | 5700 | 0.0           | -               |
| 7.1875 | 5750 | 0.0           | -               |
| 7.25   | 5800 | 0.0           | -               |
| 7.3125 | 5850 | 0.0           | -               |
| 7.375  | 5900 | 0.0001        | -               |
| 7.4375 | 5950 | 0.0           | -               |
| 7.5    | 6000 | 0.0           | -               |
| 7.5625 | 6050 | 0.0           | -               |
| 7.625  | 6100 | 0.0           | -               |
| 7.6875 | 6150 | 0.0           | -               |
| 7.75   | 6200 | 0.0           | -               |
| 7.8125 | 6250 | 0.0           | -               |
| 7.875  | 6300 | 0.0           | -               |
| 7.9375 | 6350 | 0.0           | -               |
| 8.0    | 6400 | 0.0           | -               |
| 8.0625 | 6450 | 0.0           | -               |
| 8.125  | 6500 | 0.0           | -               |
| 8.1875 | 6550 | 0.0           | -               |
| 8.25   | 6600 | 0.0           | -               |
| 8.3125 | 6650 | 0.0           | -               |
| 8.375  | 6700 | 0.0           | -               |
| 8.4375 | 6750 | 0.0           | -               |
| 8.5    | 6800 | 0.0           | -               |
| 8.5625 | 6850 | 0.0           | -               |
| 8.625  | 6900 | 0.0           | -               |
| 8.6875 | 6950 | 0.0           | -               |
| 8.75   | 7000 | 0.0           | -               |
| 8.8125 | 7050 | 0.0           | -               |
| 8.875  | 7100 | 0.0           | -               |
| 8.9375 | 7150 | 0.0           | -               |
| 9.0    | 7200 | 0.0           | -               |
| 9.0625 | 7250 | 0.0           | -               |
| 9.125  | 7300 | 0.0           | -               |
| 9.1875 | 7350 | 0.0           | -               |
| 9.25   | 7400 | 0.0           | -               |
| 9.3125 | 7450 | 0.0           | -               |
| 9.375  | 7500 | 0.0           | -               |
| 9.4375 | 7550 | 0.0           | -               |
| 9.5    | 7600 | 0.0           | -               |
| 9.5625 | 7650 | 0.0           | -               |
| 9.625  | 7700 | 0.0           | -               |
| 9.6875 | 7750 | 0.0           | -               |
| 9.75   | 7800 | 0.0           | -               |
| 9.8125 | 7850 | 0.0           | -               |
| 9.875  | 7900 | 0.0           | -               |
| 9.9375 | 7950 | 0.0           | -               |
| 10.0   | 8000 | 0.0           | -               |

### Framework Versions
- Python: 3.11.7
- SetFit: 1.0.3
- Sentence Transformers: 2.2.2
- Transformers: 4.35.2
- PyTorch: 2.1.1+cu121
- Datasets: 2.14.5
- Tokenizers: 0.15.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.*
-->