Francesco-A commited on
Commit
be47e72
·
verified ·
1 Parent(s): 1d70d98

Push model using huggingface_hub.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
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,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: sentence-transformers/all-mpnet-base-v2
3
+ library_name: setfit
4
+ metrics:
5
+ - accuracy
6
+ pipeline_tag: text-classification
7
+ tags:
8
+ - setfit
9
+ - sentence-transformers
10
+ - text-classification
11
+ - generated_from_setfit_trainer
12
+ widget:
13
+ - text: The transformation of production systems towards more sustainable models must
14
+ be accompanied by social policies aimed at reducing inequalities and promoting
15
+ social cohesion.
16
+ - text: The protection of protected areas and nature reserves is essential to conserve
17
+ biodiversity and preserve wild habitats.
18
+ - text: Immigration and asylum policies are at the center of political debate, with
19
+ divergent opinions on how to manage migratory flows and the integration of new
20
+ arrivals.
21
+ - text: The transition towards renewable energy sources requires a concrete commitment
22
+ to combat the climate emergency and guarantee a sustainable future for generations
23
+ to come.
24
+ - text: Promoting social justice and the redistribution of resources is essential
25
+ to ensure a fair transition to a sustainable economy.
26
+ inference: true
27
+ model-index:
28
+ - name: SetFit with sentence-transformers/all-mpnet-base-v2
29
+ results:
30
+ - task:
31
+ type: text-classification
32
+ name: Text Classification
33
+ dataset:
34
+ name: Unknown
35
+ type: unknown
36
+ split: test
37
+ metrics:
38
+ - type: accuracy
39
+ value: 0.9375
40
+ name: Accuracy
41
+ ---
42
+
43
+ # SetFit with sentence-transformers/all-mpnet-base-v2
44
+
45
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-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.
46
+
47
+ The model has been trained using an efficient few-shot learning technique that involves:
48
+
49
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
50
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
51
+
52
+ ## Model Details
53
+
54
+ ### Model Description
55
+ - **Model Type:** SetFit
56
+ - **Sentence Transformer body:** [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2)
57
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
58
+ - **Maximum Sequence Length:** 384 tokens
59
+ - **Number of Classes:** 2 classes
60
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
61
+ <!-- - **Language:** Unknown -->
62
+ <!-- - **License:** Unknown -->
63
+
64
+ ### Model Sources
65
+
66
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
67
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
68
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
69
+
70
+ ### Model Labels
71
+ | Label | Examples |
72
+ |:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
73
+ | 1 | <ul><li>'Does that mean that a fair transition must be ensured through taxation, including with a capital tax for the most wealthy?'</li><li>'In fact, there are alternatives, there is a need for motivation to create reasonable parallel opportunities for job creation during a gradual transition.'</li><li>'We show that it is possible to combine ecological sustainability with welfare, justice and development.'</li></ul> |
74
+ | 0 | <ul><li>'As a representative of the Center Party, I am convinced that a transition to a fossil-independent transport sector and the fleet of vehicles is both necessary and possible.'</li><li>'Natural solutions supporting the green digital transition aim to mitigate and adapt to climate change.'</li><li>'Such a project is at the heart of the ecological transition: the Government, as well as parliamentarians and all the actors involved in this concession, have shown their commitment to this model, which is very innovative, and their ambition to accompany projects at the crossroads of these various issues.'</li></ul> |
75
+
76
+ ## Evaluation
77
+
78
+ ### Metrics
79
+ | Label | Accuracy |
80
+ |:--------|:---------|
81
+ | **all** | 0.9375 |
82
+
83
+ ## Uses
84
+
85
+ ### Direct Use for Inference
86
+
87
+ First install the SetFit library:
88
+
89
+ ```bash
90
+ pip install setfit
91
+ ```
92
+
93
+ Then you can load this model and run inference.
94
+
95
+ ```python
96
+ from setfit import SetFitModel
97
+
98
+ # Download from the 🤗 Hub
99
+ model = SetFitModel.from_pretrained("Francesco-A/setfit-all-mpnet-base-v2-non-augmented_dataset-133-shot-just_transition-v1.4.1")
100
+ # Run inference
101
+ preds = model("The protection of protected areas and nature reserves is essential to conserve biodiversity and preserve wild habitats.")
102
+ ```
103
+
104
+ <!--
105
+ ### Downstream Use
106
+
107
+ *List how someone could finetune this model on their own dataset.*
108
+ -->
109
+
110
+ <!--
111
+ ### Out-of-Scope Use
112
+
113
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
114
+ -->
115
+
116
+ <!--
117
+ ## Bias, Risks and Limitations
118
+
119
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
120
+ -->
121
+
122
+ <!--
123
+ ### Recommendations
124
+
125
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
126
+ -->
127
+
128
+ ## Training Details
129
+
130
+ ### Training Set Metrics
131
+ | Training set | Min | Median | Max |
132
+ |:-------------|:----|:--------|:----|
133
+ | Word count | 5 | 31.4436 | 120 |
134
+
135
+ | Label | Training Sample Count |
136
+ |:------|:----------------------|
137
+ | 0 | 133 |
138
+ | 1 | 133 |
139
+
140
+ ### Training Hyperparameters
141
+ - batch_size: (16, 16)
142
+ - num_epochs: (3, 3)
143
+ - max_steps: -1
144
+ - sampling_strategy: oversampling
145
+ - body_learning_rate: (2e-05, 1e-05)
146
+ - head_learning_rate: 0.01
147
+ - loss: CosineSimilarityLoss
148
+ - distance_metric: cosine_distance
149
+ - margin: 0.25
150
+ - end_to_end: False
151
+ - use_amp: False
152
+ - warmup_proportion: 0.1
153
+ - l2_weight: 0.01
154
+ - seed: 1234
155
+ - eval_max_steps: -1
156
+ - load_best_model_at_end: True
157
+
158
+ ### Training Results
159
+ | Epoch | Step | Training Loss | Validation Loss |
160
+ |:------:|:----:|:-------------:|:---------------:|
161
+ | 0.0009 | 1 | 0.2933 | - |
162
+ | 0.0449 | 50 | 0.2605 | - |
163
+ | 0.0898 | 100 | 0.2551 | - |
164
+ | 0.1346 | 150 | 0.2467 | - |
165
+ | 0.1795 | 200 | 0.233 | - |
166
+ | 0.2244 | 250 | 0.1117 | - |
167
+ | 0.2693 | 300 | 0.0049 | - |
168
+ | 0.3142 | 350 | 0.0007 | - |
169
+ | 0.3591 | 400 | 0.0004 | - |
170
+ | 0.4039 | 450 | 0.0003 | - |
171
+ | 0.4488 | 500 | 0.0002 | - |
172
+ | 0.4937 | 550 | 0.0002 | - |
173
+ | 0.5386 | 600 | 0.0002 | - |
174
+ | 0.5835 | 650 | 0.0002 | - |
175
+ | 0.6284 | 700 | 0.0001 | - |
176
+ | 0.6732 | 750 | 0.0001 | - |
177
+ | 0.7181 | 800 | 0.0001 | - |
178
+ | 0.7630 | 850 | 0.0001 | - |
179
+ | 0.8079 | 900 | 0.0001 | - |
180
+ | 0.8528 | 950 | 0.0001 | - |
181
+ | 0.8977 | 1000 | 0.0001 | - |
182
+ | 0.9425 | 1050 | 0.0001 | - |
183
+ | 0.9874 | 1100 | 0.0001 | - |
184
+ | 1.0 | 1114 | - | 0.0938 |
185
+ | 1.0323 | 1150 | 0.0001 | - |
186
+ | 1.0772 | 1200 | 0.0001 | - |
187
+ | 1.1221 | 1250 | 0.0001 | - |
188
+ | 1.1670 | 1300 | 0.0001 | - |
189
+ | 1.2118 | 1350 | 0.0001 | - |
190
+ | 1.2567 | 1400 | 0.0001 | - |
191
+ | 1.3016 | 1450 | 0.0001 | - |
192
+ | 1.3465 | 1500 | 0.0001 | - |
193
+ | 1.3914 | 1550 | 0.0001 | - |
194
+ | 1.4363 | 1600 | 0.0 | - |
195
+ | 1.4811 | 1650 | 0.0 | - |
196
+ | 1.5260 | 1700 | 0.0 | - |
197
+ | 1.5709 | 1750 | 0.0 | - |
198
+ | 1.6158 | 1800 | 0.0 | - |
199
+ | 1.6607 | 1850 | 0.0 | - |
200
+ | 1.7056 | 1900 | 0.0 | - |
201
+ | 1.7504 | 1950 | 0.0 | - |
202
+ | 1.7953 | 2000 | 0.0 | - |
203
+ | 1.8402 | 2050 | 0.0 | - |
204
+ | 1.8851 | 2100 | 0.0 | - |
205
+ | 1.9300 | 2150 | 0.0 | - |
206
+ | 1.9749 | 2200 | 0.0 | - |
207
+ | 2.0 | 2228 | - | 0.0951 |
208
+ | 2.0197 | 2250 | 0.0003 | - |
209
+ | 2.0646 | 2300 | 0.0012 | - |
210
+ | 2.1095 | 2350 | 0.0005 | - |
211
+ | 2.1544 | 2400 | 0.001 | - |
212
+ | 2.1993 | 2450 | 0.0001 | - |
213
+ | 2.2442 | 2500 | 0.0001 | - |
214
+ | 2.2890 | 2550 | 0.0001 | - |
215
+ | 2.3339 | 2600 | 0.0001 | - |
216
+ | 2.3788 | 2650 | 0.0001 | - |
217
+ | 2.4237 | 2700 | 0.0001 | - |
218
+ | 2.4686 | 2750 | 0.0001 | - |
219
+ | 2.5135 | 2800 | 0.0 | - |
220
+ | 2.5583 | 2850 | 0.0001 | - |
221
+ | 2.6032 | 2900 | 0.0 | - |
222
+ | 2.6481 | 2950 | 0.0 | - |
223
+ | 2.6930 | 3000 | 0.0 | - |
224
+ | 2.7379 | 3050 | 0.0 | - |
225
+ | 2.7828 | 3100 | 0.0 | - |
226
+ | 2.8276 | 3150 | 0.0 | - |
227
+ | 2.8725 | 3200 | 0.0 | - |
228
+ | 2.9174 | 3250 | 0.0 | - |
229
+ | 2.9623 | 3300 | 0.0 | - |
230
+ | 3.0 | 3342 | - | 0.0964 |
231
+
232
+ ### Framework Versions
233
+ - Python: 3.10.14
234
+ - SetFit: 1.1.0
235
+ - Sentence Transformers: 3.3.1
236
+ - Transformers: 4.44.0
237
+ - PyTorch: 2.4.0
238
+ - Datasets: 2.21.0
239
+ - Tokenizers: 0.19.1
240
+
241
+ ## Citation
242
+
243
+ ### BibTeX
244
+ ```bibtex
245
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
246
+ doi = {10.48550/ARXIV.2209.11055},
247
+ url = {https://arxiv.org/abs/2209.11055},
248
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
249
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
250
+ title = {Efficient Few-Shot Learning Without Prompts},
251
+ publisher = {arXiv},
252
+ year = {2022},
253
+ copyright = {Creative Commons Attribution 4.0 International}
254
+ }
255
+ ```
256
+
257
+ <!--
258
+ ## Glossary
259
+
260
+ *Clearly define terms in order to be accessible across audiences.*
261
+ -->
262
+
263
+ <!--
264
+ ## Model Card Authors
265
+
266
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
267
+ -->
268
+
269
+ <!--
270
+ ## Model Card Contact
271
+
272
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
273
+ -->
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "sentence-transformers/all-mpnet-base-v2",
3
+ "architectures": [
4
+ "MPNetModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-05,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "mpnet",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 1,
20
+ "relative_attention_num_buckets": 32,
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.44.0",
23
+ "vocab_size": 30527
24
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.3.1",
4
+ "transformers": "4.44.0",
5
+ "pytorch": "2.4.0"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
config_setfit.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": false,
3
+ "labels": null
4
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:badfe528a2a9f96b526831b97a3fe3c3d12556d8295f3984787cd67fa689d787
3
+ size 437967672
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27285c7023f13bb81b156c6663a32dc4a820d70eb52111004ac4895a83b5cfdf
3
+ size 7007
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": 384,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "[UNK]",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "104": {
36
+ "content": "[UNK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "30526": {
44
+ "content": "<mask>",
45
+ "lstrip": true,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ }
51
+ },
52
+ "bos_token": "<s>",
53
+ "clean_up_tokenization_spaces": true,
54
+ "cls_token": "<s>",
55
+ "do_lower_case": true,
56
+ "eos_token": "</s>",
57
+ "mask_token": "<mask>",
58
+ "max_length": 128,
59
+ "model_max_length": 384,
60
+ "pad_to_multiple_of": null,
61
+ "pad_token": "<pad>",
62
+ "pad_token_type_id": 0,
63
+ "padding_side": "right",
64
+ "sep_token": "</s>",
65
+ "stride": 0,
66
+ "strip_accents": null,
67
+ "tokenize_chinese_chars": true,
68
+ "tokenizer_class": "MPNetTokenizer",
69
+ "truncation_side": "right",
70
+ "truncation_strategy": "longest_first",
71
+ "unk_token": "[UNK]"
72
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff