super-cinnamon commited on
Commit
b2bafa7
1 Parent(s): 3910f8a

Push model using huggingface_hub.

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
1_Pooling/config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
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
+ }
README.md ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: setfit
3
+ tags:
4
+ - setfit
5
+ - sentence-transformers
6
+ - text-classification
7
+ - generated_from_setfit_trainer
8
+ metrics:
9
+ - accuracy
10
+ widget:
11
+ - text: Quels sont les recours possibles en cas de conflit entre un employeur et un
12
+ employé ?
13
+ - text: Comment déclarer mes impôts et taxes ?
14
+ - text: Quelles sont les règles de tenue de la comptabilité ?
15
+ - text: Quels sont les frais associés à cette procédure ?
16
+ - text: Quelles sont les procédures de recours possibles contre une décision administrative
17
+ ?
18
+ pipeline_tag: text-classification
19
+ inference: true
20
+ base_model: intfloat/multilingual-e5-small
21
+ model-index:
22
+ - name: SetFit with intfloat/multilingual-e5-small
23
+ results:
24
+ - task:
25
+ type: text-classification
26
+ name: Text Classification
27
+ dataset:
28
+ name: Unknown
29
+ type: unknown
30
+ split: test
31
+ metrics:
32
+ - type: accuracy
33
+ value: 0.9473684210526315
34
+ name: Accuracy
35
+ ---
36
+
37
+ # SetFit with intfloat/multilingual-e5-small
38
+
39
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) 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.
40
+
41
+ The model has been trained using an efficient few-shot learning technique that involves:
42
+
43
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
44
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
45
+
46
+ ## Model Details
47
+
48
+ ### Model Description
49
+ - **Model Type:** SetFit
50
+ - **Sentence Transformer body:** [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small)
51
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
52
+ - **Maximum Sequence Length:** 512 tokens
53
+ - **Number of Classes:** 2 classes
54
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
55
+ <!-- - **Language:** Unknown -->
56
+ <!-- - **License:** Unknown -->
57
+
58
+ ### Model Sources
59
+
60
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
61
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
62
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
63
+
64
+ ### Model Labels
65
+ | Label | Examples |
66
+ |:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
67
+ | follow_up | <ul><li>'Quels sont les régimes matrimoniaux possibles ?'</li><li>'Quelles sont les conséquences économiques ou sociales de cette loi ?'</li><li>"Est-ce que cette loi s'applique à mon cas particulier ?"</li></ul> |
68
+ | independent | <ul><li>'Quelles sont les règles en matière de temps de travail et de congés ?'</li><li>"Quels sont les types de structures d'entreprise autorisés en Algérie ?"</li><li>'Quels sont les droits et obligations des travailleurs en Algérie ?'</li></ul> |
69
+
70
+ ## Evaluation
71
+
72
+ ### Metrics
73
+ | Label | Accuracy |
74
+ |:--------|:---------|
75
+ | **all** | 0.9474 |
76
+
77
+ ## Uses
78
+
79
+ ### Direct Use for Inference
80
+
81
+ First install the SetFit library:
82
+
83
+ ```bash
84
+ pip install setfit
85
+ ```
86
+
87
+ Then you can load this model and run inference.
88
+
89
+ ```python
90
+ from setfit import SetFitModel
91
+
92
+ # Download from the 🤗 Hub
93
+ model = SetFitModel.from_pretrained("super-cinnamon/fewshot-followup-multi-e5")
94
+ # Run inference
95
+ preds = model("Comment déclarer mes impôts et taxes ?")
96
+ ```
97
+
98
+ <!--
99
+ ### Downstream Use
100
+
101
+ *List how someone could finetune this model on their own dataset.*
102
+ -->
103
+
104
+ <!--
105
+ ### Out-of-Scope Use
106
+
107
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
108
+ -->
109
+
110
+ <!--
111
+ ## Bias, Risks and Limitations
112
+
113
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
114
+ -->
115
+
116
+ <!--
117
+ ### Recommendations
118
+
119
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
120
+ -->
121
+
122
+ ## Training Details
123
+
124
+ ### Training Set Metrics
125
+ | Training set | Min | Median | Max |
126
+ |:-------------|:----|:-------|:----|
127
+ | Word count | 2 | 9.76 | 16 |
128
+
129
+ | Label | Training Sample Count |
130
+ |:------------|:----------------------|
131
+ | independent | 39 |
132
+ | follow_up | 36 |
133
+
134
+ ### Training Hyperparameters
135
+ - batch_size: (8, 8)
136
+ - num_epochs: (10, 10)
137
+ - max_steps: -1
138
+ - sampling_strategy: oversampling
139
+ - body_learning_rate: (2e-05, 1e-05)
140
+ - head_learning_rate: 0.01
141
+ - loss: CosineSimilarityLoss
142
+ - distance_metric: cosine_distance
143
+ - margin: 0.25
144
+ - end_to_end: False
145
+ - use_amp: False
146
+ - warmup_proportion: 0.1
147
+ - seed: 42
148
+ - eval_max_steps: -1
149
+ - load_best_model_at_end: False
150
+
151
+ ### Training Results
152
+ | Epoch | Step | Training Loss | Validation Loss |
153
+ |:------:|:----:|:-------------:|:---------------:|
154
+ | 0.0028 | 1 | 0.3779 | - |
155
+ | 0.1381 | 50 | 0.3395 | - |
156
+ | 0.2762 | 100 | 0.1385 | - |
157
+ | 0.4144 | 150 | 0.1179 | - |
158
+ | 0.5525 | 200 | 0.0172 | - |
159
+ | 0.6906 | 250 | 0.0006 | - |
160
+ | 0.8287 | 300 | 0.0014 | - |
161
+ | 0.9669 | 350 | 0.0004 | - |
162
+ | 1.1050 | 400 | 0.0002 | - |
163
+ | 1.2431 | 450 | 0.0002 | - |
164
+ | 1.3812 | 500 | 0.0002 | - |
165
+ | 1.5193 | 550 | 0.0005 | - |
166
+ | 1.6575 | 600 | 0.0001 | - |
167
+ | 1.7956 | 650 | 0.0001 | - |
168
+ | 1.9337 | 700 | 0.0001 | - |
169
+ | 2.0718 | 750 | 0.0002 | - |
170
+ | 2.2099 | 800 | 0.0001 | - |
171
+ | 2.3481 | 850 | 0.0002 | - |
172
+ | 2.4862 | 900 | 0.0003 | - |
173
+ | 2.6243 | 950 | 0.0001 | - |
174
+ | 2.7624 | 1000 | 0.0001 | - |
175
+ | 2.9006 | 1050 | 0.0001 | - |
176
+ | 3.0387 | 1100 | 0.0 | - |
177
+ | 3.1768 | 1150 | 0.0001 | - |
178
+ | 3.3149 | 1200 | 0.0001 | - |
179
+ | 3.4530 | 1250 | 0.0001 | - |
180
+ | 3.5912 | 1300 | 0.0001 | - |
181
+ | 3.7293 | 1350 | 0.0 | - |
182
+ | 3.8674 | 1400 | 0.0001 | - |
183
+ | 4.0055 | 1450 | 0.0001 | - |
184
+ | 4.1436 | 1500 | 0.0001 | - |
185
+ | 4.2818 | 1550 | 0.0002 | - |
186
+ | 4.4199 | 1600 | 0.0001 | - |
187
+ | 4.5580 | 1650 | 0.0001 | - |
188
+ | 4.6961 | 1700 | 0.0002 | - |
189
+ | 4.8343 | 1750 | 0.0 | - |
190
+ | 4.9724 | 1800 | 0.0001 | - |
191
+ | 5.1105 | 1850 | 0.0 | - |
192
+ | 5.2486 | 1900 | 0.0001 | - |
193
+ | 5.3867 | 1950 | 0.0 | - |
194
+ | 5.5249 | 2000 | 0.0 | - |
195
+ | 5.6630 | 2050 | 0.0001 | - |
196
+ | 5.8011 | 2100 | 0.0 | - |
197
+ | 5.9392 | 2150 | 0.0 | - |
198
+ | 6.0773 | 2200 | 0.0001 | - |
199
+ | 6.2155 | 2250 | 0.0001 | - |
200
+ | 6.3536 | 2300 | 0.0001 | - |
201
+ | 6.4917 | 2350 | 0.0 | - |
202
+ | 6.6298 | 2400 | 0.0 | - |
203
+ | 6.7680 | 2450 | 0.0 | - |
204
+ | 6.9061 | 2500 | 0.0 | - |
205
+ | 7.0442 | 2550 | 0.0 | - |
206
+ | 7.1823 | 2600 | 0.0001 | - |
207
+ | 7.3204 | 2650 | 0.0 | - |
208
+ | 7.4586 | 2700 | 0.0 | - |
209
+ | 7.5967 | 2750 | 0.0001 | - |
210
+ | 7.7348 | 2800 | 0.0 | - |
211
+ | 7.8729 | 2850 | 0.0001 | - |
212
+ | 8.0110 | 2900 | 0.0 | - |
213
+ | 8.1492 | 2950 | 0.0 | - |
214
+ | 8.2873 | 3000 | 0.0 | - |
215
+ | 8.4254 | 3050 | 0.0 | - |
216
+ | 8.5635 | 3100 | 0.0001 | - |
217
+ | 8.7017 | 3150 | 0.0 | - |
218
+ | 8.8398 | 3200 | 0.0001 | - |
219
+ | 8.9779 | 3250 | 0.0 | - |
220
+ | 9.1160 | 3300 | 0.0 | - |
221
+ | 9.2541 | 3350 | 0.0 | - |
222
+ | 9.3923 | 3400 | 0.0 | - |
223
+ | 9.5304 | 3450 | 0.0 | - |
224
+ | 9.6685 | 3500 | 0.0 | - |
225
+ | 9.8066 | 3550 | 0.0 | - |
226
+ | 9.9448 | 3600 | 0.0 | - |
227
+
228
+ ### Framework Versions
229
+ - Python: 3.10.12
230
+ - SetFit: 1.0.1
231
+ - Sentence Transformers: 2.2.2
232
+ - Transformers: 4.35.2
233
+ - PyTorch: 2.1.0+cu118
234
+ - Datasets: 2.15.0
235
+ - Tokenizers: 0.15.0
236
+
237
+ ## Citation
238
+
239
+ ### BibTeX
240
+ ```bibtex
241
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
242
+ doi = {10.48550/ARXIV.2209.11055},
243
+ url = {https://arxiv.org/abs/2209.11055},
244
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
245
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
246
+ title = {Efficient Few-Shot Learning Without Prompts},
247
+ publisher = {arXiv},
248
+ year = {2022},
249
+ copyright = {Creative Commons Attribution 4.0 International}
250
+ }
251
+ ```
252
+
253
+ <!--
254
+ ## Glossary
255
+
256
+ *Clearly define terms in order to be accessible across audiences.*
257
+ -->
258
+
259
+ <!--
260
+ ## Model Card Authors
261
+
262
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
263
+ -->
264
+
265
+ <!--
266
+ ## Model Card Contact
267
+
268
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
269
+ -->
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/root/.cache/torch/sentence_transformers/intfloat_multilingual-e5-small/",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
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": 12,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "tokenizer_class": "XLMRobertaTokenizer",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.35.2",
23
+ "type_vocab_size": 2,
24
+ "use_cache": true,
25
+ "vocab_size": 250037
26
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.2.2",
4
+ "transformers": "4.35.2",
5
+ "pytorch": "2.1.0+cu118"
6
+ }
7
+ }
config_setfit.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "labels": [
3
+ "independent",
4
+ "follow_up"
5
+ ],
6
+ "normalize_embeddings": false
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5edb798d3bd404c37447047f5afda2cdad776e104cc8272895926d747735ca75
3
+ size 470637416
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21c3b1bfac2f76b5384939f137e1092bd4f06771646265e3952af3c4161c44a0
3
+ size 3919
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": 512,
3
+ "do_lower_case": false
4
+ }
sentencepiece.bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
3
+ size 5069051
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39feb9863a378165ab9c5c689047203d789422966c0c58721c5309fd039a8edc
3
+ size 17083074
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "mask_token": "<mask>",
49
+ "model_max_length": 512,
50
+ "pad_token": "<pad>",
51
+ "sep_token": "</s>",
52
+ "sp_model_kwargs": {},
53
+ "tokenizer_class": "XLMRobertaTokenizer",
54
+ "unk_token": "<unk>"
55
+ }