File size: 13,756 Bytes
253f5d5
 
 
 
 
 
 
 
 
 
 
72c9dcf
 
 
 
 
253f5d5
 
 
 
 
 
 
 
 
 
 
 
 
 
72c9dcf
253f5d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72c9dcf
 
 
 
253f5d5
 
 
 
 
 
72c9dcf
253f5d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72c9dcf
253f5d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72c9dcf
253f5d5
 
 
72c9dcf
 
253f5d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72c9dcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253f5d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
library_name: setfit
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
base_model: BAAI/bge-small-en-v1.5
metrics:
- accuracy
widget:
- text: sales affects ceo pay
- text: time affects entrepreneurship intention
- text: operations planning affects entrepreneurship intention
- text: entrepreneurial self-efficacy affects entrepreneurship intention
- text: empirical training affects entrepreneurship intention
pipeline_tag: text-classification
inference: true
model-index:
- name: SetFit with BAAI/bge-small-en-v1.5
  results:
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      name: Unknown
      type: unknown
      split: test
    metrics:
    - type: accuracy
      value: 0.9058823529411765
      name: Accuracy
---

# SetFit with BAAI/bge-small-en-v1.5

This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-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:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
- **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                                                                                                                                                                                   |
|:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1     | <ul><li>'board diversity affects ceo pay'</li><li>'perceptions of formal learning affects entrepreneurship intention'</li><li>'proactiveness affects entrepreneurship intention'</li></ul> |
| 0     | <ul><li>'sales and takeovers affects entrepreneurship intention'</li><li>'uk affects entrepreneurship intention'</li><li>'economics affects entrepreneurship intention'</li></ul>          |

## Evaluation

### Metrics
| Label   | Accuracy |
|:--------|:---------|
| **all** | 0.9059   |

## 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("abehandlerorg/setfit")
# Run inference
preds = model("sales affects ceo pay")
```

<!--
### 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   | 4   | 5.4307 | 12  |

| Label | Training Sample Count |
|:------|:----------------------|
| 0     | 168                   |
| 1     | 171                   |

### Training Hyperparameters
- batch_size: (32, 32)
- num_epochs: (4, 4)
- 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
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False

### Training Results
| Epoch  | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0006 | 1    | 0.3133        | -               |
| 0.0277 | 50   | 0.289         | -               |
| 0.0553 | 100  | 0.2506        | -               |
| 0.0830 | 150  | 0.2243        | -               |
| 0.1107 | 200  | 0.2388        | -               |
| 0.1384 | 250  | 0.2084        | -               |
| 0.1660 | 300  | 0.1316        | -               |
| 0.1937 | 350  | 0.0142        | -               |
| 0.2214 | 400  | 0.0065        | -               |
| 0.2490 | 450  | 0.0037        | -               |
| 0.2767 | 500  | 0.003         | -               |
| 0.3044 | 550  | 0.002         | -               |
| 0.3320 | 600  | 0.0018        | -               |
| 0.3597 | 650  | 0.0026        | -               |
| 0.3874 | 700  | 0.0013        | -               |
| 0.4151 | 750  | 0.0012        | -               |
| 0.4427 | 800  | 0.0284        | -               |
| 0.4704 | 850  | 0.0145        | -               |
| 0.4981 | 900  | 0.0053        | -               |
| 0.5257 | 950  | 0.0075        | -               |
| 0.5534 | 1000 | 0.005         | -               |
| 0.5811 | 1050 | 0.0008        | -               |
| 0.6087 | 1100 | 0.0008        | -               |
| 0.6364 | 1150 | 0.0008        | -               |
| 0.6641 | 1200 | 0.0007        | -               |
| 0.6918 | 1250 | 0.0008        | -               |
| 0.7194 | 1300 | 0.0009        | -               |
| 0.7471 | 1350 | 0.0007        | -               |
| 0.7748 | 1400 | 0.0008        | -               |
| 0.8024 | 1450 | 0.0006        | -               |
| 0.8301 | 1500 | 0.0006        | -               |
| 0.8578 | 1550 | 0.0192        | -               |
| 0.8854 | 1600 | 0.0005        | -               |
| 0.9131 | 1650 | 0.002         | -               |
| 0.9408 | 1700 | 0.0204        | -               |
| 0.9685 | 1750 | 0.0039        | -               |
| 0.9961 | 1800 | 0.0007        | -               |
| 1.0238 | 1850 | 0.0005        | -               |
| 1.0515 | 1900 | 0.0004        | -               |
| 1.0791 | 1950 | 0.0005        | -               |
| 1.1068 | 2000 | 0.0006        | -               |
| 1.1345 | 2050 | 0.0004        | -               |
| 1.1621 | 2100 | 0.0006        | -               |
| 1.1898 | 2150 | 0.0004        | -               |
| 1.2175 | 2200 | 0.0004        | -               |
| 1.2452 | 2250 | 0.0018        | -               |
| 1.2728 | 2300 | 0.0041        | -               |
| 1.3005 | 2350 | 0.0004        | -               |
| 1.3282 | 2400 | 0.0107        | -               |
| 1.3558 | 2450 | 0.0005        | -               |
| 1.3835 | 2500 | 0.0004        | -               |
| 1.4112 | 2550 | 0.0004        | -               |
| 1.4388 | 2600 | 0.0167        | -               |
| 1.4665 | 2650 | 0.0068        | -               |
| 1.4942 | 2700 | 0.0004        | -               |
| 1.5219 | 2750 | 0.0064        | -               |
| 1.5495 | 2800 | 0.0041        | -               |
| 1.5772 | 2850 | 0.0004        | -               |
| 1.6049 | 2900 | 0.0003        | -               |
| 1.6325 | 2950 | 0.0004        | -               |
| 1.6602 | 3000 | 0.0004        | -               |
| 1.6879 | 3050 | 0.0003        | -               |
| 1.7156 | 3100 | 0.0057        | -               |
| 1.7432 | 3150 | 0.0044        | -               |
| 1.7709 | 3200 | 0.0004        | -               |
| 1.7986 | 3250 | 0.0166        | -               |
| 1.8262 | 3300 | 0.0004        | -               |
| 1.8539 | 3350 | 0.0032        | -               |
| 1.8816 | 3400 | 0.0133        | -               |
| 1.9092 | 3450 | 0.0003        | -               |
| 1.9369 | 3500 | 0.0003        | -               |
| 1.9646 | 3550 | 0.0052        | -               |
| 1.9923 | 3600 | 0.0004        | -               |
| 2.0199 | 3650 | 0.004         | -               |
| 2.0476 | 3700 | 0.0003        | -               |
| 2.0753 | 3750 | 0.0054        | -               |
| 2.1029 | 3800 | 0.0057        | -               |
| 2.1306 | 3850 | 0.0004        | -               |
| 2.1583 | 3900 | 0.0272        | -               |
| 2.1859 | 3950 | 0.0003        | -               |
| 2.2136 | 4000 | 0.006         | -               |
| 2.2413 | 4050 | 0.0044        | -               |
| 2.2690 | 4100 | 0.0003        | -               |
| 2.2966 | 4150 | 0.0167        | -               |
| 2.3243 | 4200 | 0.0048        | -               |
| 2.3520 | 4250 | 0.0086        | -               |
| 2.3796 | 4300 | 0.0051        | -               |
| 2.4073 | 4350 | 0.0003        | -               |
| 2.4350 | 4400 | 0.0037        | -               |
| 2.4626 | 4450 | 0.0003        | -               |
| 2.4903 | 4500 | 0.0021        | -               |
| 2.5180 | 4550 | 0.0003        | -               |
| 2.5457 | 4600 | 0.004         | -               |
| 2.5733 | 4650 | 0.0025        | -               |
| 2.6010 | 4700 | 0.0003        | -               |
| 2.6287 | 4750 | 0.0003        | -               |
| 2.6563 | 4800 | 0.0003        | -               |
| 2.6840 | 4850 | 0.0031        | -               |
| 2.7117 | 4900 | 0.0168        | -               |
| 2.7393 | 4950 | 0.0019        | -               |
| 2.7670 | 5000 | 0.004         | -               |
| 2.7947 | 5050 | 0.0003        | -               |
| 2.8224 | 5100 | 0.0003        | -               |
| 2.8500 | 5150 | 0.003         | -               |
| 2.8777 | 5200 | 0.0003        | -               |
| 2.9054 | 5250 | 0.0003        | -               |
| 2.9330 | 5300 | 0.0171        | -               |
| 2.9607 | 5350 | 0.0003        | -               |
| 2.9884 | 5400 | 0.0162        | -               |
| 3.0160 | 5450 | 0.0143        | -               |
| 3.0437 | 5500 | 0.0134        | -               |
| 3.0714 | 5550 | 0.0133        | -               |
| 3.0991 | 5600 | 0.0003        | -               |
| 3.1267 | 5650 | 0.0003        | -               |
| 3.1544 | 5700 | 0.0093        | -               |
| 3.1821 | 5750 | 0.0003        | -               |
| 3.2097 | 5800 | 0.0003        | -               |
| 3.2374 | 5850 | 0.0003        | -               |
| 3.2651 | 5900 | 0.0003        | -               |
| 3.2928 | 5950 | 0.0003        | -               |
| 3.3204 | 6000 | 0.0029        | -               |
| 3.3481 | 6050 | 0.0126        | -               |
| 3.3758 | 6100 | 0.0003        | -               |
| 3.4034 | 6150 | 0.0002        | -               |
| 3.4311 | 6200 | 0.0003        | -               |
| 3.4588 | 6250 | 0.0062        | -               |
| 3.4864 | 6300 | 0.0002        | -               |
| 3.5141 | 6350 | 0.0002        | -               |
| 3.5418 | 6400 | 0.0003        | -               |
| 3.5695 | 6450 | 0.0002        | -               |
| 3.5971 | 6500 | 0.0041        | -               |
| 3.6248 | 6550 | 0.0465        | -               |
| 3.6525 | 6600 | 0.0148        | -               |
| 3.6801 | 6650 | 0.0181        | -               |
| 3.7078 | 6700 | 0.0037        | -               |
| 3.7355 | 6750 | 0.0002        | -               |
| 3.7631 | 6800 | 0.0003        | -               |
| 3.7908 | 6850 | 0.0003        | -               |
| 3.8185 | 6900 | 0.0034        | -               |
| 3.8462 | 6950 | 0.0002        | -               |
| 3.8738 | 7000 | 0.0148        | -               |
| 3.9015 | 7050 | 0.0002        | -               |
| 3.9292 | 7100 | 0.0003        | -               |
| 3.9568 | 7150 | 0.0002        | -               |
| 3.9845 | 7200 | 0.0003        | -               |

### Framework Versions
- Python: 3.10.12
- SetFit: 1.0.3
- Sentence Transformers: 2.7.0
- Transformers: 4.40.1
- 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.*
-->