PrashantG6838 commited on
Commit
3dea811
·
verified ·
1 Parent(s): 560b93a

Upload folder 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,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: setfit
3
+ tags:
4
+ - setfit
5
+ - sentence-transformers
6
+ - text-classification
7
+ - generated_from_setfit_trainer
8
+ base_model: sentence-transformers/all-MiniLM-L6-v2
9
+ metrics:
10
+ - accuracy
11
+ widget:
12
+ - text: Education is very important for children in poverty and can also create a
13
+ future
14
+ - text: Sugandhi Devi has two daughters and she does not have a bicycle for their
15
+ education
16
+ - text: In this discussion we will tell that what should be done when the girl child
17
+ is not accompanied by her parents she will have to study a little at least
18
+ - text: A community meeting will be held in which a resolution will be taken to stop
19
+ gender discrimination
20
+ - text: The childrens mother said that she would go to Bodh Gaya block to get her
21
+ Aadhaar card made
22
+ pipeline_tag: text-classification
23
+ inference: true
24
+ ---
25
+
26
+ # SetFit with sentence-transformers/all-MiniLM-L6-v2
27
+
28
+ 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.
29
+
30
+ The model has been trained using an efficient few-shot learning technique that involves:
31
+
32
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
33
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
34
+
35
+ ## Model Details
36
+
37
+ ### Model Description
38
+ - **Model Type:** SetFit
39
+ - **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
40
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
41
+ - **Maximum Sequence Length:** 256 tokens
42
+ - **Number of Classes:** 3 classes
43
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
44
+ <!-- - **Language:** Unknown -->
45
+ <!-- - **License:** Unknown -->
46
+
47
+ ### Model Sources
48
+
49
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
50
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
51
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
52
+
53
+ ### Model Labels
54
+ | Label | Examples |
55
+ |:-------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
56
+ | Solution or Action | <ul><li>'The women of the community decided that they would not make the electricity bill and would send their children to school'</li><li>'Since the children did not have a father the mother decided to enroll them in school'</li><li>'Preeti Kumari age 18 does not want to appear for the matriculation examination due to failure Explain the solution to her parents and try to get her to appear for the examination and take her forward'</li></ul> |
57
+ | Challenge | <ul><li>'Girls have work responsibilities so they dont get a chance to study'</li><li>'Due to poverty children are unable to pursue further studies'</li><li>'Kavita didis daughter has left her studies after the fifth lesson'</li></ul> |
58
+ | Other | <ul><li>'The community woman shared that one childs birth certificate has not been made which could potentially affect their education'</li><li>'No community members should hold meetings with teachers at school'</li><li>'Regarding Siddhanta it was said that you must study only then your future will be bright and you will not face any problems in future'</li></ul> |
59
+
60
+ ## Uses
61
+
62
+ ### Direct Use for Inference
63
+
64
+ First install the SetFit library:
65
+
66
+ ```bash
67
+ pip install setfit
68
+ ```
69
+
70
+ Then you can load this model and run inference.
71
+
72
+ ```python
73
+ from setfit import SetFitModel
74
+
75
+ # Download from the 🤗 Hub
76
+ model = SetFitModel.from_pretrained("setfit_model_id")
77
+ # Run inference
78
+ preds = model("Education is very important for children in poverty and can also create a future")
79
+ ```
80
+
81
+ <!--
82
+ ### Downstream Use
83
+
84
+ *List how someone could finetune this model on their own dataset.*
85
+ -->
86
+
87
+ <!--
88
+ ### Out-of-Scope Use
89
+
90
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
91
+ -->
92
+
93
+ <!--
94
+ ## Bias, Risks and Limitations
95
+
96
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
97
+ -->
98
+
99
+ <!--
100
+ ### Recommendations
101
+
102
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
103
+ -->
104
+
105
+ ## Training Details
106
+
107
+ ### Training Set Metrics
108
+ | Training set | Min | Median | Max |
109
+ |:-------------|:----|:--------|:----|
110
+ | Word count | 1 | 19.8416 | 402 |
111
+
112
+ | Label | Training Sample Count |
113
+ |:-------------------|:----------------------|
114
+ | Challenge | 1634 |
115
+ | Other | 440 |
116
+ | Solution or Action | 1852 |
117
+
118
+ ### Training Hyperparameters
119
+ - batch_size: (16, 16)
120
+ - num_epochs: (1, 1)
121
+ - max_steps: -1
122
+ - sampling_strategy: oversampling
123
+ - num_iterations: 20
124
+ - body_learning_rate: (2e-05, 1e-05)
125
+ - head_learning_rate: 0.01
126
+ - loss: CosineSimilarityLoss
127
+ - distance_metric: cosine_distance
128
+ - margin: 0.25
129
+ - end_to_end: False
130
+ - use_amp: False
131
+ - warmup_proportion: 0.1
132
+ - l2_weight: 0.01
133
+ - seed: 42
134
+ - eval_max_steps: -1
135
+ - load_best_model_at_end: False
136
+
137
+ ### Training Results
138
+ | Epoch | Step | Training Loss | Validation Loss |
139
+ |:------:|:----:|:-------------:|:---------------:|
140
+ | 0.0002 | 1 | 0.2792 | - |
141
+ | 0.0102 | 50 | 0.2964 | - |
142
+ | 0.0204 | 100 | 0.2595 | - |
143
+ | 0.0306 | 150 | 0.23 | - |
144
+ | 0.0407 | 200 | 0.1881 | - |
145
+ | 0.0509 | 250 | 0.1349 | - |
146
+ | 0.0611 | 300 | 0.109 | - |
147
+ | 0.0713 | 350 | 0.1024 | - |
148
+ | 0.0815 | 400 | 0.0855 | - |
149
+ | 0.0917 | 450 | 0.0751 | - |
150
+ | 0.1019 | 500 | 0.0792 | - |
151
+ | 0.1121 | 550 | 0.074 | - |
152
+ | 0.1222 | 600 | 0.0643 | - |
153
+ | 0.1324 | 650 | 0.0668 | - |
154
+ | 0.1426 | 700 | 0.0624 | - |
155
+ | 0.1528 | 750 | 0.0604 | - |
156
+ | 0.1630 | 800 | 0.0513 | - |
157
+ | 0.1732 | 850 | 0.0455 | - |
158
+ | 0.1834 | 900 | 0.038 | - |
159
+ | 0.1936 | 950 | 0.0439 | - |
160
+ | 0.2037 | 1000 | 0.0331 | - |
161
+ | 0.2139 | 1050 | 0.0323 | - |
162
+ | 0.2241 | 1100 | 0.0269 | - |
163
+ | 0.2343 | 1150 | 0.0376 | - |
164
+ | 0.2445 | 1200 | 0.0256 | - |
165
+ | 0.2547 | 1250 | 0.0279 | - |
166
+ | 0.2649 | 1300 | 0.0276 | - |
167
+ | 0.2751 | 1350 | 0.0289 | - |
168
+ | 0.2852 | 1400 | 0.0241 | - |
169
+ | 0.2954 | 1450 | 0.0179 | - |
170
+ | 0.3056 | 1500 | 0.0177 | - |
171
+ | 0.3158 | 1550 | 0.0226 | - |
172
+ | 0.3260 | 1600 | 0.0176 | - |
173
+ | 0.3362 | 1650 | 0.0182 | - |
174
+ | 0.3464 | 1700 | 0.0171 | - |
175
+ | 0.3566 | 1750 | 0.0175 | - |
176
+ | 0.3667 | 1800 | 0.0141 | - |
177
+ | 0.3769 | 1850 | 0.0177 | - |
178
+ | 0.3871 | 1900 | 0.0136 | - |
179
+ | 0.3973 | 1950 | 0.0127 | - |
180
+ | 0.4075 | 2000 | 0.0173 | - |
181
+ | 0.4177 | 2050 | 0.0106 | - |
182
+ | 0.4279 | 2100 | 0.01 | - |
183
+ | 0.4381 | 2150 | 0.0113 | - |
184
+ | 0.4482 | 2200 | 0.0091 | - |
185
+ | 0.4584 | 2250 | 0.0071 | - |
186
+ | 0.4686 | 2300 | 0.01 | - |
187
+ | 0.4788 | 2350 | 0.0112 | - |
188
+ | 0.4890 | 2400 | 0.0104 | - |
189
+ | 0.4992 | 2450 | 0.0089 | - |
190
+ | 0.5094 | 2500 | 0.0096 | - |
191
+ | 0.5196 | 2550 | 0.0098 | - |
192
+ | 0.5297 | 2600 | 0.0113 | - |
193
+ | 0.5399 | 2650 | 0.005 | - |
194
+ | 0.5501 | 2700 | 0.0074 | - |
195
+ | 0.5603 | 2750 | 0.0078 | - |
196
+ | 0.5705 | 2800 | 0.007 | - |
197
+ | 0.5807 | 2850 | 0.0047 | - |
198
+ | 0.5909 | 2900 | 0.0111 | - |
199
+ | 0.6011 | 2950 | 0.0054 | - |
200
+ | 0.6112 | 3000 | 0.0088 | - |
201
+ | 0.6214 | 3050 | 0.0045 | - |
202
+ | 0.6316 | 3100 | 0.0031 | - |
203
+ | 0.6418 | 3150 | 0.0084 | - |
204
+ | 0.6520 | 3200 | 0.005 | - |
205
+ | 0.6622 | 3250 | 0.0058 | - |
206
+ | 0.6724 | 3300 | 0.0048 | - |
207
+ | 0.6826 | 3350 | 0.0057 | - |
208
+ | 0.6927 | 3400 | 0.0048 | - |
209
+ | 0.7029 | 3450 | 0.0059 | - |
210
+ | 0.7131 | 3500 | 0.0078 | - |
211
+ | 0.7233 | 3550 | 0.0057 | - |
212
+ | 0.7335 | 3600 | 0.0056 | - |
213
+ | 0.7437 | 3650 | 0.0039 | - |
214
+ | 0.7539 | 3700 | 0.0059 | - |
215
+ | 0.7641 | 3750 | 0.0058 | - |
216
+ | 0.7742 | 3800 | 0.0022 | - |
217
+ | 0.7844 | 3850 | 0.0064 | - |
218
+ | 0.7946 | 3900 | 0.0033 | - |
219
+ | 0.8048 | 3950 | 0.0037 | - |
220
+ | 0.8150 | 4000 | 0.003 | - |
221
+ | 0.8252 | 4050 | 0.0063 | - |
222
+ | 0.8354 | 4100 | 0.0047 | - |
223
+ | 0.8456 | 4150 | 0.0056 | - |
224
+ | 0.8557 | 4200 | 0.0026 | - |
225
+ | 0.8659 | 4250 | 0.0028 | - |
226
+ | 0.8761 | 4300 | 0.0066 | - |
227
+ | 0.8863 | 4350 | 0.0026 | - |
228
+ | 0.8965 | 4400 | 0.0045 | - |
229
+ | 0.9067 | 4450 | 0.0052 | - |
230
+ | 0.9169 | 4500 | 0.0017 | - |
231
+ | 0.9271 | 4550 | 0.0056 | - |
232
+ | 0.9372 | 4600 | 0.0043 | - |
233
+ | 0.9474 | 4650 | 0.0034 | - |
234
+ | 0.9576 | 4700 | 0.0042 | - |
235
+ | 0.9678 | 4750 | 0.0031 | - |
236
+ | 0.9780 | 4800 | 0.004 | - |
237
+ | 0.9882 | 4850 | 0.0064 | - |
238
+ | 0.9984 | 4900 | 0.0033 | - |
239
+
240
+ ### Framework Versions
241
+ - Python: 3.12.13
242
+ - SetFit: 1.1.0
243
+ - Sentence Transformers: 3.1.1
244
+ - Transformers: 4.45.2
245
+ - PyTorch: 2.10.0+cu128
246
+ - Datasets: 3.2.0
247
+ - Tokenizers: 0.20.3
248
+
249
+ ## Citation
250
+
251
+ ### BibTeX
252
+ ```bibtex
253
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
254
+ doi = {10.48550/ARXIV.2209.11055},
255
+ url = {https://arxiv.org/abs/2209.11055},
256
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
257
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
258
+ title = {Efficient Few-Shot Learning Without Prompts},
259
+ publisher = {arXiv},
260
+ year = {2022},
261
+ copyright = {Creative Commons Attribution 4.0 International}
262
+ }
263
+ ```
264
+
265
+ <!--
266
+ ## Glossary
267
+
268
+ *Clearly define terms in order to be accessible across audiences.*
269
+ -->
270
+
271
+ <!--
272
+ ## Model Card Authors
273
+
274
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
275
+ -->
276
+
277
+ <!--
278
+ ## Model Card Contact
279
+
280
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
281
+ -->
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "sentence-transformers/all-MiniLM-L6-v2",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 384,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 1536,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 6,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.45.2",
23
+ "type_vocab_size": 2,
24
+ "use_cache": true,
25
+ "vocab_size": 30522
26
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.1.1",
4
+ "transformers": "4.45.2",
5
+ "pytorch": "2.10.0+cu128"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
10
+ }
config_setfit.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": false,
3
+ "labels": [
4
+ "Challenge",
5
+ "Other",
6
+ "Solution or Action"
7
+ ]
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f8f66182987ba0c50a414adb530cf8dcba3cb2eff72ab5da8d25eda25747e31
3
+ size 90864192
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae52568bd3122935f0821486468ca7da2a8d04d495175f22c63296ce87c0eef3
3
+ size 10367
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,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "mask_token": "[MASK]",
49
+ "max_length": 128,
50
+ "model_max_length": 256,
51
+ "never_split": null,
52
+ "pad_to_multiple_of": null,
53
+ "pad_token": "[PAD]",
54
+ "pad_token_type_id": 0,
55
+ "padding_side": "right",
56
+ "sep_token": "[SEP]",
57
+ "stride": 0,
58
+ "strip_accents": null,
59
+ "tokenize_chinese_chars": true,
60
+ "tokenizer_class": "BertTokenizer",
61
+ "truncation_side": "right",
62
+ "truncation_strategy": "longest_first",
63
+ "unk_token": "[UNK]"
64
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff