PrashantG6838 commited on
Commit
344b3c8
·
verified ·
1 Parent(s): 2bcd2ad

Upload folder using huggingface_hub

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "embedding_dimension": 384,
3
+ "pooling_mode": "mean",
4
+ "include_prompt": true
5
+ }
README.md CHANGED
@@ -1,3 +1,208 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: The environment around the school is not clean.
9
+ - text: Early marriage of girls
10
+ - text: The community faces a challenge with the government school in their village
11
+ not providing proper education.
12
+ - text: Children did not want to enroll in school and hence they did not go to school.
13
+ - text: About children's academic progress
14
+ metrics:
15
+ - accuracy
16
+ pipeline_tag: text-classification
17
+ library_name: setfit
18
+ inference: true
19
+ base_model: sentence-transformers/all-MiniLM-L6-v2
20
  ---
21
+
22
+ # SetFit with sentence-transformers/all-MiniLM-L6-v2
23
+
24
+ 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.
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:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
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:** 11 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
+ | Other Factors | <ul><li>'Due to lack of education of the parents of the children, they are unable to send their children to school.'</li><li>"In some families, girls' education is not prioritized. Due to social stereotypes, household pressures, and a lack of awareness, girls' school attendance and enrollment are relatively low. As a result, girls are being deprived of education at the elementary level, which is a serious concern for their future."</li><li>'Due to development, the surrounding environment is not good and there is no awareness about education.'</li></ul> |
53
+ | Early Marriage | <ul><li>'Child marriage is another challenge facing this community.'</li><li>'Girls end up marrying their own people, which stops their education and limits their future prospects.'</li><li>'Child marriage'</li></ul> |
54
+ | Unknown/Unclear | <ul><li>'Children are enrolled in school but do not attend school regularly.'</li><li>'The importance of education in life and the progress of children in their country and their own lives if they are educated were discussed.'</li><li>'Being sick disrupts education'</li></ul> |
55
+ | Distance and Accessibility Issues | <ul><li>'Children are unable to attend school because the school is located on the edge of the forest.'</li><li>'The school is far away from the village.'</li><li>'The school is located in a secluded area, making it difficult for children to reach there.'</li></ul> |
56
+ | Teacher Capacity and Quality Issues | <ul><li>'There is no study in school'</li><li>'The rural woman said that there are English teachers in the schools, but the children do not know English.'</li><li>'In school, teachers make the child do cleaning work and since the school is very far away, the date of birth is not available.'</li></ul> |
57
+ | Poverty and Economic Barriers | <ul><li>'Children work in the fields with their parents.'</li><li>'Child Labor'</li><li>'Instead of going to school, children are being sent to graze goats.'</li></ul> |
58
+ | Safety Concerns | <ul><li>'Girls are unable to attend school regularly due to harassment on the way.'</li><li>'The head master discriminates against girls from lower caste by saying that these people are from lower caste, he gives them some favour in food and drinks and there is a lot of beating.'</li><li>'Parents, distressed by the harsh treatment meted out to girls, are afraid to send their children to school.'</li></ul> |
59
+ | Legal Document linked Barriers | <ul><li>'Children are not getting enrolled in school due to lack of Aadhaar card.'</li><li>'Some girls in her village go to school, some have left after enrolling, some do not go to school due to lack of Aadhar card.'</li><li>'Admission in school is not possible due to lack of Aadhar card'</li></ul> |
60
+ | Parental Attitudes and Socio-Cultural Barriers | <ul><li>'Lack of coordination between girls and parents'</li><li>'Girls take wrong steps and this is also the reason why higher education is wasted.'</li><li>'Children do not go to school because of household chores.'</li></ul> |
61
+ | Substance Abuse and Addiction | <ul><li>'Parents challenged that their children do not go to school and are always busy playing games and using mobile phones.'</li><li>"Children's studies are being disrupted due to misuse of mobile phones."</li><li>'Fathers who drink alcohol often neglect their children.'</li></ul> |
62
+ | School Infrastructure and Facility Issues | <ul><li>'In Shiksha Chaupal, the parents were told that there is only a school up to class 5 in our village.'</li><li>'Lack of proper infrastructure for education.'</li><li>'When we go to Anganwadi, the Didi does not make us take care of food and cleanliness.'</li></ul> |
63
+
64
+ ## Uses
65
+
66
+ ### Direct Use for Inference
67
+
68
+ First install the SetFit library:
69
+
70
+ ```bash
71
+ pip install setfit
72
+ ```
73
+
74
+ Then you can load this model and run inference.
75
+
76
+ ```python
77
+ from setfit import SetFitModel
78
+
79
+ # Download from the 🤗 Hub
80
+ model = SetFitModel.from_pretrained("setfit_model_id")
81
+ # Run inference
82
+ preds = model("Early marriage of girls")
83
+ ```
84
+
85
+ <!--
86
+ ### Downstream Use
87
+
88
+ *List how someone could finetune this model on their own dataset.*
89
+ -->
90
+
91
+ <!--
92
+ ### Out-of-Scope Use
93
+
94
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
95
+ -->
96
+
97
+ <!--
98
+ ## Bias, Risks and Limitations
99
+
100
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
101
+ -->
102
+
103
+ <!--
104
+ ### Recommendations
105
+
106
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
107
+ -->
108
+
109
+ ## Training Details
110
+
111
+ ### Training Set Metrics
112
+ | Training set | Min | Median | Max |
113
+ |:-------------|:----|:--------|:----|
114
+ | Word count | 1 | 15.3202 | 158 |
115
+
116
+ | Label | Training Sample Count |
117
+ |:-----------------------------------------------|:----------------------|
118
+ | Distance and Accessibility Issues | 500 |
119
+ | Early Marriage | 500 |
120
+ | Legal Document linked Barriers | 500 |
121
+ | Other Factors | 500 |
122
+ | Parental Attitudes and Socio-Cultural Barriers | 500 |
123
+ | Poverty and Economic Barriers | 500 |
124
+ | Safety Concerns | 500 |
125
+ | School Infrastructure and Facility Issues | 500 |
126
+ | Substance Abuse and Addiction | 500 |
127
+ | Teacher Capacity and Quality Issues | 500 |
128
+ | Unknown/Unclear | 500 |
129
+
130
+ ### Training Hyperparameters
131
+ - batch_size: (16, 16)
132
+ - num_epochs: (1, 1)
133
+ - max_steps: -1
134
+ - sampling_strategy: oversampling
135
+ - num_iterations: 1
136
+ - body_learning_rate: (2e-05, 1e-05)
137
+ - head_learning_rate: 0.01
138
+ - loss: CosineSimilarityLoss
139
+ - distance_metric: cosine_distance
140
+ - margin: 0.25
141
+ - end_to_end: False
142
+ - use_amp: False
143
+ - warmup_proportion: 0.1
144
+ - l2_weight: 0.01
145
+ - seed: 42
146
+ - eval_max_steps: -1
147
+ - load_best_model_at_end: False
148
+
149
+ ### Training Results
150
+ | Epoch | Step | Training Loss | Validation Loss |
151
+ |:------:|:----:|:-------------:|:---------------:|
152
+ | 0.0015 | 1 | 0.2641 | - |
153
+ | 0.0727 | 50 | 0.2312 | - |
154
+ | 0.1453 | 100 | 0.2069 | - |
155
+ | 0.2180 | 150 | 0.1816 | - |
156
+ | 0.2907 | 200 | 0.155 | - |
157
+ | 0.3634 | 250 | 0.1408 | - |
158
+ | 0.4360 | 300 | 0.1306 | - |
159
+ | 0.5087 | 350 | 0.1371 | - |
160
+ | 0.5814 | 400 | 0.1301 | - |
161
+ | 0.6541 | 450 | 0.1239 | - |
162
+ | 0.7267 | 500 | 0.1236 | - |
163
+ | 0.7994 | 550 | 0.1213 | - |
164
+ | 0.8721 | 600 | 0.122 | - |
165
+ | 0.9448 | 650 | 0.1298 | - |
166
+
167
+ ### Framework Versions
168
+ - Python: 3.12.3
169
+ - SetFit: 1.1.3
170
+ - Sentence Transformers: 5.6.0
171
+ - Transformers: 4.57.6
172
+ - PyTorch: 2.13.0+cpu
173
+ - Datasets: 2.16.1
174
+ - Tokenizers: 0.22.2
175
+
176
+ ## Citation
177
+
178
+ ### BibTeX
179
+ ```bibtex
180
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
181
+ doi = {10.48550/ARXIV.2209.11055},
182
+ url = {https://arxiv.org/abs/2209.11055},
183
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
184
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
185
+ title = {Efficient Few-Shot Learning Without Prompts},
186
+ publisher = {arXiv},
187
+ year = {2022},
188
+ copyright = {Creative Commons Attribution 4.0 International}
189
+ }
190
+ ```
191
+
192
+ <!--
193
+ ## Glossary
194
+
195
+ *Clearly define terms in order to be accessible across audiences.*
196
+ -->
197
+
198
+ <!--
199
+ ## Model Card Authors
200
+
201
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
202
+ -->
203
+
204
+ <!--
205
+ ## Model Card Contact
206
+
207
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
208
+ -->
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
+ "dtype": "float32",
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
+ "transformers_version": "4.57.6",
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
+ "pytorch": "2.13.0+cpu",
4
+ "sentence_transformers": "5.6.0",
5
+ "transformers": "4.57.6"
6
+ },
7
+ "default_prompt_name": null,
8
+ "model_type": "SentenceTransformer",
9
+ "prompts": {
10
+ "document": "",
11
+ "query": ""
12
+ },
13
+ "similarity_fn_name": "cosine"
14
+ }
config_setfit.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": false,
3
+ "labels": [
4
+ "Distance and Accessibility Issues",
5
+ "Early Marriage",
6
+ "Legal Document linked Barriers",
7
+ "Other Factors",
8
+ "Parental Attitudes and Socio-Cultural Barriers",
9
+ "Poverty and Economic Barriers",
10
+ "Safety Concerns",
11
+ "School Infrastructure and Facility Issues",
12
+ "Substance Abuse and Addiction",
13
+ "Teacher Capacity and Quality Issues",
14
+ "Unknown/Unclear"
15
+ ]
16
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ad48a78394323c34100ff8d174e3a3d9d7babd21b182597ca527127cd3ab0c0
3
+ size 90864192
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da968ce364148fab9ae3f98efe5035f34230adb8f496d71df5c58c5155defcb3
3
+ size 19811
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.base.modules.transformer.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.sentence_transformer.modules.normalize.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "feature-extraction",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "last_hidden_state"
7
+ }
8
+ },
9
+ "module_output_name": "token_embeddings"
10
+ }
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": 128,
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