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: Plasta
|
9 |
-
- text: 203 terminada
|
10 |
-
- text: habitación 294 limpia
|
11 |
-
- text: ¡Hola, cómo va todo!
|
12 |
-
- text: Quiero ver el estado de la incidencia que reporté en la Calle Mayor de Triana
|
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 |
-
| 0.
|
139 |
-
| 0.
|
140 |
-
| 0.
|
141 |
-
| 0.
|
142 |
-
| 0.
|
143 |
-
| 0.
|
144 |
-
| 0.
|
145 |
-
| 0.
|
146 |
-
|
|
147 |
-
| 1.
|
148 |
-
| 1.
|
149 |
-
| 1.
|
150 |
-
| 1.
|
151 |
-
| 1.
|
152 |
-
| 1.
|
153 |
-
| 1.
|
154 |
-
| 1.
|
155 |
-
|
|
156 |
-
| 2.
|
157 |
-
| 2.
|
158 |
-
| 2.
|
159 |
-
| 2.
|
160 |
-
| 2.
|
161 |
-
| 2.
|
162 |
-
| 2.
|
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 |
-
## 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: Plasta
|
9 |
+
- text: 203 terminada
|
10 |
+
- text: habitación 294 limpia
|
11 |
+
- text: ¡Hola, cómo va todo!
|
12 |
+
- text: Quiero ver el estado de la incidencia que reporté en la Calle Mayor de Triana.
|
13 |
+
metrics:
|
14 |
+
- accuracy
|
15 |
+
pipeline_tag: text-classification
|
16 |
+
library_name: setfit
|
17 |
+
inference: true
|
18 |
+
base_model: jaimevera1107/all-MiniLM-L6-v2-similarity-es
|
19 |
+
---
|
20 |
+
|
21 |
+
# Input Classifier
|
22 |
+
|
23 |
+
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [jaimevera1107/all-MiniLM-L6-v2-similarity-es](https://huggingface.co/jaimevera1107/all-MiniLM-L6-v2-similarity-es) 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:** [jaimevera1107/all-MiniLM-L6-v2-similarity-es](https://huggingface.co/jaimevera1107/all-MiniLM-L6-v2-similarity-es)
|
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>'lencería necesaria'</li><li>'material necesario para hoy'</li><li>'terminé la habitación 234'</li></ul> |
|
52 |
+
| conversation | <ul><li>'buena noche'</li><li>'Qué pasa, tío, ¿todo bien?'</li><li>'Buenas, ¿cómo va la cosa?!'</li></ul> |
|
53 |
+
| help | <ul><li>'ayuda por favor'</li><li>'Ayuda que no sé que puedo hacer'</li><li>'Hola, que puedo hacer'</li></ul> |
|
54 |
+
| censorship | <ul><li>'Eres un completo inútil, no sirves para nada'</li><li>'Siempre diciendo estupideces, mejor cállate'</li><li>'Tu sola existencia es una vergüenza'</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/es-input-classifier")
|
73 |
+
# Run inference
|
74 |
+
preds = model("Hola")
|
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.0723 | 38 |
|
107 |
+
|
108 |
+
| Label | Training Sample Count |
|
109 |
+
|:-------------|:----------------------|
|
110 |
+
| censorship | 407 |
|
111 |
+
| conversation | 137 |
|
112 |
+
| help | 274 |
|
113 |
+
| request | 552 |
|
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.0023 | 1 | 0.3161 | - |
|
138 |
+
| 0.1166 | 50 | 0.2857 | - |
|
139 |
+
| 0.2331 | 100 | 0.2158 | - |
|
140 |
+
| 0.3497 | 150 | 0.1581 | - |
|
141 |
+
| 0.4662 | 200 | 0.0878 | - |
|
142 |
+
| 0.5828 | 250 | 0.0299 | - |
|
143 |
+
| 0.6993 | 300 | 0.0124 | - |
|
144 |
+
| 0.8159 | 350 | 0.0083 | - |
|
145 |
+
| 0.9324 | 400 | 0.006 | - |
|
146 |
+
| 1.0490 | 450 | 0.0038 | - |
|
147 |
+
| 1.1655 | 500 | 0.0027 | - |
|
148 |
+
| 1.2821 | 550 | 0.0027 | - |
|
149 |
+
| 1.3986 | 600 | 0.0017 | - |
|
150 |
+
| 1.5152 | 650 | 0.0016 | - |
|
151 |
+
| 1.6317 | 700 | 0.0013 | - |
|
152 |
+
| 1.7483 | 750 | 0.0012 | - |
|
153 |
+
| 1.8648 | 800 | 0.0012 | - |
|
154 |
+
| 1.9814 | 850 | 0.001 | - |
|
155 |
+
| 2.0979 | 900 | 0.001 | - |
|
156 |
+
| 2.2145 | 950 | 0.0011 | - |
|
157 |
+
| 2.3310 | 1000 | 0.0009 | - |
|
158 |
+
| 2.4476 | 1050 | 0.0008 | - |
|
159 |
+
| 2.5641 | 1100 | 0.0009 | - |
|
160 |
+
| 2.6807 | 1150 | 0.0008 | - |
|
161 |
+
| 2.7972 | 1200 | 0.0008 | - |
|
162 |
+
| 2.9138 | 1250 | 0.0007 | - |
|
163 |
+
|
164 |
+
### Framework Versions
|
165 |
+
- Python: 3.10.0
|
166 |
+
- SetFit: 1.1.2
|
167 |
+
- Sentence Transformers: 5.0.0
|
168 |
+
- Transformers: 4.53.1
|
169 |
+
- PyTorch: 2.7.1+cu126
|
170 |
+
- Datasets: 2.19.2
|
171 |
+
- Tokenizers: 0.21.2
|
172 |
+
```
|
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 |
-->
|