monentiadev commited on
Commit
a6326fe
·
verified ·
1 Parent(s): b9e36c3

Push model using huggingface_hub.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 384,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": true,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": false,
9
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,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
+ 25.
14
+ metrics:
15
+ - accuracy
16
+ pipeline_tag: text-classification
17
+ library_name: setfit
18
+ inference: true
19
+ base_model: jaimevera1107/all-MiniLM-L6-v2-similarity-es
20
+ ---
21
+
22
+ # SetFit with jaimevera1107/all-MiniLM-L6-v2-similarity-es
23
+
24
+ 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.
25
+
26
+ The model has been trained using an efficient few-shot learning technique that involves:
27
+
28
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
29
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
30
+
31
+ ## Model Details
32
+
33
+ ### Model Description
34
+ - **Model Type:** SetFit
35
+ - **Sentence Transformer body:** [jaimevera1107/all-MiniLM-L6-v2-similarity-es](https://huggingface.co/jaimevera1107/all-MiniLM-L6-v2-similarity-es)
36
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
37
+ - **Maximum Sequence Length:** 256 tokens
38
+ - **Number of Classes:** 4 classes
39
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
40
+ <!-- - **Language:** Unknown -->
41
+ <!-- - **License:** Unknown -->
42
+
43
+ ### Model Sources
44
+
45
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
46
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
47
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
48
+
49
+ ### Model Labels
50
+ | Label | Examples |
51
+ |:-------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
52
+ | request | <ul><li>'lencería necesaria'</li><li>'material necesario para hoy'</li><li>'terminé la habitación 234'</li></ul> |
53
+ | conversation | <ul><li>'buena noche'</li><li>'Qué pasa, tío, ¿todo bien?'</li><li>'Buenas, ¿cómo va la cosa?!'</li></ul> |
54
+ | help | <ul><li>'ayuda por favor'</li><li>'Ayuda que no sé que puedo hacer'</li><li>'Hola, que puedo hacer'</li></ul> |
55
+ | 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> |
56
+
57
+ ## Uses
58
+
59
+ ### Direct Use for Inference
60
+
61
+ First install the SetFit library:
62
+
63
+ ```bash
64
+ pip install setfit
65
+ ```
66
+
67
+ Then you can load this model and run inference.
68
+
69
+ ```python
70
+ from setfit import SetFitModel
71
+
72
+ # Download from the 🤗 Hub
73
+ model = SetFitModel.from_pretrained("monentiadev/es-input-classifier")
74
+ # Run inference
75
+ preds = model("Plasta")
76
+ ```
77
+
78
+ <!--
79
+ ### Downstream Use
80
+
81
+ *List how someone could finetune this model on their own dataset.*
82
+ -->
83
+
84
+ <!--
85
+ ### Out-of-Scope Use
86
+
87
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
88
+ -->
89
+
90
+ <!--
91
+ ## Bias, Risks and Limitations
92
+
93
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
94
+ -->
95
+
96
+ <!--
97
+ ### Recommendations
98
+
99
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
100
+ -->
101
+
102
+ ## Training Details
103
+
104
+ ### Training Set Metrics
105
+ | Training set | Min | Median | Max |
106
+ |:-------------|:----|:-------|:----|
107
+ | Word count | 1 | 5.0723 | 38 |
108
+
109
+ | Label | Training Sample Count |
110
+ |:-------------|:----------------------|
111
+ | censorship | 407 |
112
+ | conversation | 137 |
113
+ | help | 274 |
114
+ | request | 552 |
115
+
116
+ ### Training Hyperparameters
117
+ - batch_size: (128, 128)
118
+ - num_epochs: (3, 3)
119
+ - max_steps: -1
120
+ - sampling_strategy: oversampling
121
+ - num_iterations: 20
122
+ - body_learning_rate: (2e-05, 1e-05)
123
+ - head_learning_rate: 0.01
124
+ - loss: CosineSimilarityLoss
125
+ - distance_metric: cosine_distance
126
+ - margin: 0.25
127
+ - end_to_end: False
128
+ - use_amp: False
129
+ - warmup_proportion: 0.1
130
+ - l2_weight: 0.01
131
+ - seed: 42
132
+ - eval_max_steps: -1
133
+ - load_best_model_at_end: False
134
+
135
+ ### Training Results
136
+ | Epoch | Step | Training Loss | Validation Loss |
137
+ |:------:|:----:|:-------------:|:---------------:|
138
+ | 0.0023 | 1 | 0.3161 | - |
139
+ | 0.1166 | 50 | 0.2857 | - |
140
+ | 0.2331 | 100 | 0.2158 | - |
141
+ | 0.3497 | 150 | 0.1581 | - |
142
+ | 0.4662 | 200 | 0.0878 | - |
143
+ | 0.5828 | 250 | 0.0299 | - |
144
+ | 0.6993 | 300 | 0.0124 | - |
145
+ | 0.8159 | 350 | 0.0083 | - |
146
+ | 0.9324 | 400 | 0.006 | - |
147
+ | 1.0490 | 450 | 0.0038 | - |
148
+ | 1.1655 | 500 | 0.0027 | - |
149
+ | 1.2821 | 550 | 0.0027 | - |
150
+ | 1.3986 | 600 | 0.0017 | - |
151
+ | 1.5152 | 650 | 0.0016 | - |
152
+ | 1.6317 | 700 | 0.0013 | - |
153
+ | 1.7483 | 750 | 0.0012 | - |
154
+ | 1.8648 | 800 | 0.0012 | - |
155
+ | 1.9814 | 850 | 0.001 | - |
156
+ | 2.0979 | 900 | 0.001 | - |
157
+ | 2.2145 | 950 | 0.0011 | - |
158
+ | 2.3310 | 1000 | 0.0009 | - |
159
+ | 2.4476 | 1050 | 0.0008 | - |
160
+ | 2.5641 | 1100 | 0.0009 | - |
161
+ | 2.6807 | 1150 | 0.0008 | - |
162
+ | 2.7972 | 1200 | 0.0008 | - |
163
+ | 2.9138 | 1250 | 0.0007 | - |
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
+ ## Citation
175
+
176
+ ### BibTeX
177
+ ```bibtex
178
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
179
+ doi = {10.48550/ARXIV.2209.11055},
180
+ url = {https://arxiv.org/abs/2209.11055},
181
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
182
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
183
+ title = {Efficient Few-Shot Learning Without Prompts},
184
+ publisher = {arXiv},
185
+ year = {2022},
186
+ copyright = {Creative Commons Attribution 4.0 International}
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
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "gradient_checkpointing": false,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 384,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 1536,
13
+ "layer_norm_eps": 1e-12,
14
+ "max_position_embeddings": 512,
15
+ "model_type": "bert",
16
+ "num_attention_heads": 12,
17
+ "num_hidden_layers": 6,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.53.1",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "5.0.0",
4
+ "transformers": "4.53.1",
5
+ "pytorch": "2.7.1+cu126"
6
+ },
7
+ "model_type": "SentenceTransformer",
8
+ "prompts": {
9
+ "query": "",
10
+ "document": ""
11
+ },
12
+ "default_prompt_name": null,
13
+ "similarity_fn_name": "cosine"
14
+ }
config_setfit.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "labels": [
3
+ "censorship",
4
+ "conversation",
5
+ "help",
6
+ "request"
7
+ ],
8
+ "normalize_embeddings": false
9
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2206485b62499d199f5a48a6c31b3c758a854c7d69a545902c31c1b4e029e8b
3
+ size 90864192
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5914e3dc6667d2d8a62b313f34c1eb51566e6216695f8e1e93fb7340fab13c1a
3
+ size 13351
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 256,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": false,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "max_length": 256,
51
+ "model_max_length": 256,
52
+ "never_split": null,
53
+ "pad_to_multiple_of": null,
54
+ "pad_token": "[PAD]",
55
+ "pad_token_type_id": 0,
56
+ "padding_side": "right",
57
+ "sep_token": "[SEP]",
58
+ "stride": 0,
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "BertTokenizer",
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "[UNK]"
65
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff