Update README.md
Browse files
README.md
CHANGED
@@ -1,206 +1,190 @@
|
|
1 |
-
---
|
2 |
-
tags:
|
3 |
-
- setfit
|
4 |
-
- sentence-transformers
|
5 |
-
- text-classification
|
6 |
-
- generated_from_setfit_trainer
|
7 |
-
widget:
|
8 |
-
- text: poopchute
|
9 |
-
- text: Made
|
10 |
-
- text: prox
|
11 |
-
- text: What happens, uncle, everything in order?
|
12 |
-
- text: I need Maritima Avenue to reduce congestion
|
13 |
-
metrics:
|
14 |
-
- accuracy
|
15 |
-
pipeline_tag: text-classification
|
16 |
-
library_name: setfit
|
17 |
-
inference: true
|
18 |
-
base_model: sentence-transformers/all-MiniLM-L6-v2
|
19 |
-
---
|
20 |
-
|
21 |
-
# SetFit with sentence-transformers/all-MiniLM-L6-v2
|
22 |
-
|
23 |
-
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-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.
|
24 |
-
|
25 |
-
The model has been trained using an efficient few-shot learning technique that involves:
|
26 |
-
|
27 |
-
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
|
28 |
-
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
29 |
-
|
30 |
-
## Model Details
|
31 |
-
|
32 |
-
### Model Description
|
33 |
-
- **Model Type:** SetFit
|
34 |
-
- **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
|
35 |
-
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
36 |
-
- **Maximum Sequence Length:** 256 tokens
|
37 |
-
- **Number of Classes:** 4 classes
|
38 |
-
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
39 |
-
<!-- - **Language:** Unknown -->
|
40 |
-
<!-- - **License:** Unknown -->
|
41 |
-
|
42 |
-
### Model Sources
|
43 |
-
|
44 |
-
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
|
45 |
-
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
46 |
-
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
47 |
-
|
48 |
-
### Model Labels
|
49 |
-
| Label | Examples |
|
50 |
-
|:-------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
51 |
-
| request | <ul><li>'necessary lingerie'</li><li>'necessary material for today'</li><li>'I finished the room 234'</li></ul> |
|
52 |
-
| conversation | <ul><li>"What's up, uncle, all good?"</li><li>'Good, how is the thing going?!'</li><li>'Hello how are you'</li></ul> |
|
53 |
-
| help | <ul><li>'Please help'</li><li>"Help I don't know what I can do"</li><li>'Hello, what can I do'</li></ul> |
|
54 |
-
| censorship | <ul><li>'You are a useless complete, you are useless'</li><li>'Always saying stupidities, better shut up'</li><li>'Your single existence is a shame'</li></ul> |
|
55 |
-
|
56 |
-
## Uses
|
57 |
-
|
58 |
-
### Direct Use for Inference
|
59 |
-
|
60 |
-
First install the SetFit library:
|
61 |
-
|
62 |
-
```bash
|
63 |
-
pip install setfit
|
64 |
-
```
|
65 |
-
|
66 |
-
Then you can load this model and run inference.
|
67 |
-
|
68 |
-
```python
|
69 |
-
from setfit import SetFitModel
|
70 |
-
|
71 |
-
# Download from the 🤗 Hub
|
72 |
-
model = SetFitModel.from_pretrained("monentiadev/en-input-classifier")
|
73 |
-
# Run inference
|
74 |
-
preds = model("
|
75 |
-
```
|
76 |
-
|
77 |
-
<!--
|
78 |
-
### Downstream Use
|
79 |
-
|
80 |
-
*List how someone could finetune this model on their own dataset.*
|
81 |
-
-->
|
82 |
-
|
83 |
-
<!--
|
84 |
-
### Out-of-Scope Use
|
85 |
-
|
86 |
-
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
87 |
-
-->
|
88 |
-
|
89 |
-
<!--
|
90 |
-
## Bias, Risks and Limitations
|
91 |
-
|
92 |
-
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
93 |
-
-->
|
94 |
-
|
95 |
-
<!--
|
96 |
-
### Recommendations
|
97 |
-
|
98 |
-
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
99 |
-
-->
|
100 |
-
|
101 |
-
## Training Details
|
102 |
-
|
103 |
-
### Training Set Metrics
|
104 |
-
| Training set | Min | Median | Max |
|
105 |
-
|:-------------|:----|:-------|:----|
|
106 |
-
| Word count | 1 | 5.1483 | 40 |
|
107 |
-
|
108 |
-
| Label | Training Sample Count |
|
109 |
-
|:-------------|:----------------------|
|
110 |
-
| censorship | 576 |
|
111 |
-
| conversation | 123 |
|
112 |
-
| help | 204 |
|
113 |
-
| request | 520 |
|
114 |
-
|
115 |
-
### Training Hyperparameters
|
116 |
-
- batch_size: (128, 128)
|
117 |
-
- num_epochs: (3, 3)
|
118 |
-
- max_steps: -1
|
119 |
-
- sampling_strategy: oversampling
|
120 |
-
- num_iterations: 20
|
121 |
-
- body_learning_rate: (2e-05, 1e-05)
|
122 |
-
- head_learning_rate: 0.01
|
123 |
-
- loss: CosineSimilarityLoss
|
124 |
-
- distance_metric: cosine_distance
|
125 |
-
- margin: 0.25
|
126 |
-
- end_to_end: False
|
127 |
-
- use_amp: False
|
128 |
-
- warmup_proportion: 0.1
|
129 |
-
- l2_weight: 0.01
|
130 |
-
- seed: 42
|
131 |
-
- eval_max_steps: -1
|
132 |
-
- load_best_model_at_end: False
|
133 |
-
|
134 |
-
### Training Results
|
135 |
-
| Epoch | Step | Training Loss | Validation Loss |
|
136 |
-
|:------:|:----:|:-------------:|:---------------:|
|
137 |
-
| 0.0022 | 1 | 0.3104 | - |
|
138 |
-
| 0.1124 | 50 | 0.3267 | - |
|
139 |
-
| 0.2247 | 100 | 0.2008 | - |
|
140 |
-
| 0.3371 | 150 | 0.0842 | - |
|
141 |
-
| 0.4494 | 200 | 0.0218 | - |
|
142 |
-
| 0.5618 | 250 | 0.0103 | - |
|
143 |
-
| 0.6742 | 300 | 0.0052 | - |
|
144 |
-
| 0.7865 | 350 | 0.0034 | - |
|
145 |
-
| 0.8989 | 400 | 0.0025 | - |
|
146 |
-
| 1.0112 | 450 | 0.0019 | - |
|
147 |
-
| 1.1236 | 500 | 0.0019 | - |
|
148 |
-
| 1.2360 | 550 | 0.0017 | - |
|
149 |
-
| 1.3483 | 600 | 0.001 | - |
|
150 |
-
| 1.4607 | 650 | 0.001 | - |
|
151 |
-
| 1.5730 | 700 | 0.0011 | - |
|
152 |
-
| 1.6854 | 750 | 0.0009 | - |
|
153 |
-
| 1.7978 | 800 | 0.001 | - |
|
154 |
-
| 1.9101 | 850 | 0.0007 | - |
|
155 |
-
| 2.0225 | 900 | 0.0008 | - |
|
156 |
-
| 2.1348 | 950 | 0.0007 | - |
|
157 |
-
| 2.2472 | 1000 | 0.0007 | - |
|
158 |
-
| 2.3596 | 1050 | 0.0006 | - |
|
159 |
-
| 2.4719 | 1100 | 0.0006 | - |
|
160 |
-
| 2.5843 | 1150 | 0.0006 | - |
|
161 |
-
| 2.6966 | 1200 | 0.0006 | - |
|
162 |
-
| 2.8090 | 1250 | 0.0006 | - |
|
163 |
-
| 2.9213 | 1300 | 0.0006 | - |
|
164 |
-
|
165 |
-
### Framework Versions
|
166 |
-
- Python: 3.10.0
|
167 |
-
- SetFit: 1.1.2
|
168 |
-
- Sentence Transformers: 5.0.0
|
169 |
-
- Transformers: 4.53.1
|
170 |
-
- PyTorch: 2.7.1+cu126
|
171 |
-
- Datasets: 2.19.2
|
172 |
-
- Tokenizers: 0.21.2
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
<!--
|
191 |
-
## Glossary
|
192 |
-
|
193 |
-
*Clearly define terms in order to be accessible across audiences.*
|
194 |
-
-->
|
195 |
-
|
196 |
-
<!--
|
197 |
-
## Model Card Authors
|
198 |
-
|
199 |
-
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
200 |
-
-->
|
201 |
-
|
202 |
-
<!--
|
203 |
-
## Model Card Contact
|
204 |
-
|
205 |
-
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
206 |
-->
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- setfit
|
4 |
+
- sentence-transformers
|
5 |
+
- text-classification
|
6 |
+
- generated_from_setfit_trainer
|
7 |
+
widget:
|
8 |
+
- text: poopchute
|
9 |
+
- text: Made
|
10 |
+
- text: prox
|
11 |
+
- text: What happens, uncle, everything in order?
|
12 |
+
- text: I need Maritima Avenue to reduce congestion
|
13 |
+
metrics:
|
14 |
+
- accuracy
|
15 |
+
pipeline_tag: text-classification
|
16 |
+
library_name: setfit
|
17 |
+
inference: true
|
18 |
+
base_model: sentence-transformers/all-MiniLM-L6-v2
|
19 |
+
---
|
20 |
+
|
21 |
+
# SetFit with sentence-transformers/all-MiniLM-L6-v2
|
22 |
+
|
23 |
+
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-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.
|
24 |
+
|
25 |
+
The model has been trained using an efficient few-shot learning technique that involves:
|
26 |
+
|
27 |
+
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
|
28 |
+
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
29 |
+
|
30 |
+
## Model Details
|
31 |
+
|
32 |
+
### Model Description
|
33 |
+
- **Model Type:** SetFit
|
34 |
+
- **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
|
35 |
+
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
36 |
+
- **Maximum Sequence Length:** 256 tokens
|
37 |
+
- **Number of Classes:** 4 classes
|
38 |
+
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
39 |
+
<!-- - **Language:** Unknown -->
|
40 |
+
<!-- - **License:** Unknown -->
|
41 |
+
|
42 |
+
### Model Sources
|
43 |
+
|
44 |
+
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
|
45 |
+
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
46 |
+
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
47 |
+
|
48 |
+
### Model Labels
|
49 |
+
| Label | Examples |
|
50 |
+
|:-------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
51 |
+
| request | <ul><li>'necessary lingerie'</li><li>'necessary material for today'</li><li>'I finished the room 234'</li></ul> |
|
52 |
+
| conversation | <ul><li>"What's up, uncle, all good?"</li><li>'Good, how is the thing going?!'</li><li>'Hello how are you'</li></ul> |
|
53 |
+
| help | <ul><li>'Please help'</li><li>"Help I don't know what I can do"</li><li>'Hello, what can I do'</li></ul> |
|
54 |
+
| censorship | <ul><li>'You are a useless complete, you are useless'</li><li>'Always saying stupidities, better shut up'</li><li>'Your single existence is a shame'</li></ul> |
|
55 |
+
|
56 |
+
## Uses
|
57 |
+
|
58 |
+
### Direct Use for Inference
|
59 |
+
|
60 |
+
First install the SetFit library:
|
61 |
+
|
62 |
+
```bash
|
63 |
+
pip install setfit
|
64 |
+
```
|
65 |
+
|
66 |
+
Then you can load this model and run inference.
|
67 |
+
|
68 |
+
```python
|
69 |
+
from setfit import SetFitModel
|
70 |
+
|
71 |
+
# Download from the 🤗 Hub
|
72 |
+
model = SetFitModel.from_pretrained("monentiadev/en-input-classifier")
|
73 |
+
# Run inference
|
74 |
+
preds = model("Hello")
|
75 |
+
```
|
76 |
+
|
77 |
+
<!--
|
78 |
+
### Downstream Use
|
79 |
+
|
80 |
+
*List how someone could finetune this model on their own dataset.*
|
81 |
+
-->
|
82 |
+
|
83 |
+
<!--
|
84 |
+
### Out-of-Scope Use
|
85 |
+
|
86 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
87 |
+
-->
|
88 |
+
|
89 |
+
<!--
|
90 |
+
## Bias, Risks and Limitations
|
91 |
+
|
92 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
93 |
+
-->
|
94 |
+
|
95 |
+
<!--
|
96 |
+
### Recommendations
|
97 |
+
|
98 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
99 |
+
-->
|
100 |
+
|
101 |
+
## Training Details
|
102 |
+
|
103 |
+
### Training Set Metrics
|
104 |
+
| Training set | Min | Median | Max |
|
105 |
+
|:-------------|:----|:-------|:----|
|
106 |
+
| Word count | 1 | 5.1483 | 40 |
|
107 |
+
|
108 |
+
| Label | Training Sample Count |
|
109 |
+
|:-------------|:----------------------|
|
110 |
+
| censorship | 576 |
|
111 |
+
| conversation | 123 |
|
112 |
+
| help | 204 |
|
113 |
+
| request | 520 |
|
114 |
+
|
115 |
+
### Training Hyperparameters
|
116 |
+
- batch_size: (128, 128)
|
117 |
+
- num_epochs: (3, 3)
|
118 |
+
- max_steps: -1
|
119 |
+
- sampling_strategy: oversampling
|
120 |
+
- num_iterations: 20
|
121 |
+
- body_learning_rate: (2e-05, 1e-05)
|
122 |
+
- head_learning_rate: 0.01
|
123 |
+
- loss: CosineSimilarityLoss
|
124 |
+
- distance_metric: cosine_distance
|
125 |
+
- margin: 0.25
|
126 |
+
- end_to_end: False
|
127 |
+
- use_amp: False
|
128 |
+
- warmup_proportion: 0.1
|
129 |
+
- l2_weight: 0.01
|
130 |
+
- seed: 42
|
131 |
+
- eval_max_steps: -1
|
132 |
+
- load_best_model_at_end: False
|
133 |
+
|
134 |
+
### Training Results
|
135 |
+
| Epoch | Step | Training Loss | Validation Loss |
|
136 |
+
|:------:|:----:|:-------------:|:---------------:|
|
137 |
+
| 0.0022 | 1 | 0.3104 | - |
|
138 |
+
| 0.1124 | 50 | 0.3267 | - |
|
139 |
+
| 0.2247 | 100 | 0.2008 | - |
|
140 |
+
| 0.3371 | 150 | 0.0842 | - |
|
141 |
+
| 0.4494 | 200 | 0.0218 | - |
|
142 |
+
| 0.5618 | 250 | 0.0103 | - |
|
143 |
+
| 0.6742 | 300 | 0.0052 | - |
|
144 |
+
| 0.7865 | 350 | 0.0034 | - |
|
145 |
+
| 0.8989 | 400 | 0.0025 | - |
|
146 |
+
| 1.0112 | 450 | 0.0019 | - |
|
147 |
+
| 1.1236 | 500 | 0.0019 | - |
|
148 |
+
| 1.2360 | 550 | 0.0017 | - |
|
149 |
+
| 1.3483 | 600 | 0.001 | - |
|
150 |
+
| 1.4607 | 650 | 0.001 | - |
|
151 |
+
| 1.5730 | 700 | 0.0011 | - |
|
152 |
+
| 1.6854 | 750 | 0.0009 | - |
|
153 |
+
| 1.7978 | 800 | 0.001 | - |
|
154 |
+
| 1.9101 | 850 | 0.0007 | - |
|
155 |
+
| 2.0225 | 900 | 0.0008 | - |
|
156 |
+
| 2.1348 | 950 | 0.0007 | - |
|
157 |
+
| 2.2472 | 1000 | 0.0007 | - |
|
158 |
+
| 2.3596 | 1050 | 0.0006 | - |
|
159 |
+
| 2.4719 | 1100 | 0.0006 | - |
|
160 |
+
| 2.5843 | 1150 | 0.0006 | - |
|
161 |
+
| 2.6966 | 1200 | 0.0006 | - |
|
162 |
+
| 2.8090 | 1250 | 0.0006 | - |
|
163 |
+
| 2.9213 | 1300 | 0.0006 | - |
|
164 |
+
|
165 |
+
### Framework Versions
|
166 |
+
- Python: 3.10.0
|
167 |
+
- SetFit: 1.1.2
|
168 |
+
- Sentence Transformers: 5.0.0
|
169 |
+
- Transformers: 4.53.1
|
170 |
+
- PyTorch: 2.7.1+cu126
|
171 |
+
- Datasets: 2.19.2
|
172 |
+
- Tokenizers: 0.21.2
|
173 |
+
|
174 |
+
<!--
|
175 |
+
## Glossary
|
176 |
+
|
177 |
+
*Clearly define terms in order to be accessible across audiences.*
|
178 |
+
-->
|
179 |
+
|
180 |
+
<!--
|
181 |
+
## Model Card Authors
|
182 |
+
|
183 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
184 |
+
-->
|
185 |
+
|
186 |
+
<!--
|
187 |
+
## Model Card Contact
|
188 |
+
|
189 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
-->
|