krish2505 commited on
Commit
ad87cbc
·
verified ·
1 Parent(s): f205ea7

Add SetFit model

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
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
+ }
README.md ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: Outcome Of Board Meeting Of Mahindra & Mahindra Limited Held On 4Th August,
12
+ 2023
13
+ - text: Board Meeting Intimation for Considering And Taking On Record The Audited
14
+ Standalone And Unaudited Consolidated Financial Results Of The Company For The
15
+ Quarter And Nine Months Ended December 31, 2022.
16
+ - text: 'Board Meeting Intimation for Intimation Regarding Holding Of Meeting Of The
17
+ Board Of Directors: - Un-Audited Financial Results For The Quarter Ended June
18
+ 30, 2023'
19
+ - text: Report Of Auditors On Financial Statements For The Quarter Ended September
20
+ 30 2031 With UDIN
21
+ - text: Infosys Unveils New AI-Powered Solutions for Enhanced Customer Experience
22
+ pipeline_tag: text-classification
23
+ inference: true
24
+ base_model: sentence-transformers/all-mpnet-base-v2
25
+ model-index:
26
+ - name: SetFit with sentence-transformers/all-mpnet-base-v2
27
+ results:
28
+ - task:
29
+ type: text-classification
30
+ name: Text Classification
31
+ dataset:
32
+ name: Unknown
33
+ type: unknown
34
+ split: test
35
+ metrics:
36
+ - type: accuracy
37
+ value: 0.9557522123893806
38
+ name: Accuracy
39
+ ---
40
+
41
+ # SetFit with sentence-transformers/all-mpnet-base-v2
42
+
43
+ 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.
44
+
45
+ The model has been trained using an efficient few-shot learning technique that involves:
46
+
47
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
48
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
49
+
50
+ ## Model Details
51
+
52
+ ### Model Description
53
+ - **Model Type:** SetFit
54
+ - **Sentence Transformer body:** [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2)
55
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
56
+ - **Maximum Sequence Length:** 384 tokens
57
+ - **Number of Classes:** 9 classes
58
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
59
+ <!-- - **Language:** Unknown -->
60
+ <!-- - **License:** Unknown -->
61
+
62
+ ### Model Sources
63
+
64
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
65
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
66
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
67
+
68
+ ### Model Labels
69
+ | Label | Examples |
70
+ |:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
71
+ | 8 | <ul><li>'Resignation Of Smt. Nita M. Ambani From The Board Of The Company - Disclosure Dated August 28'</li><li>'Announcement under Regulation 30 (LODR)-Resignation of Head of Customer Relations'</li><li>'Announcement under Regulation 30 (LODR)-Resignation of Head of Human Resources'</li></ul> |
72
+ | 5 | <ul><li>'Intimation Regarding Change in Compliance Officer Under Regulation 30 Of SEBI (Listing Obligations and Disclosure Requirements) Regulations'</li><li>'Disclosure Under Regulation 30 Of SEBI LODR Regulations (Merger or Demerger)'</li><li>'Regulation 30 Of The SEBI (Listing Obligations And Disclosure Requirements) Regulations 2015: Disclosure Of Appointment of Key Managerial Personnel'</li></ul> |
73
+ | 7 | <ul><li>"Energizing Change: Infosys-HFS Research Unveils Companies' Top 3 Priorities in the Energy Transition Era,"</li><li>'Infosys Rated A Leader In Multicloud Managed Services Providers And Cloud Migration And Managed Service Partners By Independent Research Firm'</li><li>'Cloud For Organizational Growth And Transformation Is Three Times More Important Than Cloud For Cost Optimization: Infosys Research'</li></ul> |
74
+ | 4 | <ul><li>'An official announcement under SEBI (LODR) has been made declaring the notification of the record date for ESOP Holders and Shareholders post the successful completion of the Amalgamation between XYZ Systems Ltd and our Company.'</li><li>'An official announcement under Regulation 30 (LODR) has been released concerning the successful merger of Quantum Software Solutions Limited with the company.'</li><li>'Grant Of Stock Options Under The Employee Stock Option Scheme Of The Bank (ESOP Scheme).'</li></ul> |
75
+ | 2 | <ul><li>'Board Meeting - Un-Audited Financial Results For The Quarter Ended June 30, 2023'</li><li>'Board Meeting Outcome for Interim Dividend For The Financial Year 2022-23'</li><li>'Board Meeting Intimation for Board Meeting - 3Rd February, 2023'</li></ul> |
76
+ | 0 | <ul><li>'Announcement under Regulation 30 (LODR)-Press Release / Media Release'</li><li>'Media Release By The Company'</li><li>'Clarification on Market Rumors Regarding Product Recall'</li></ul> |
77
+ | 1 | <ul><li>'Corporate Insolvency Resolution Process (CIRP)-Updates - Corporate Insolvency Resolution Process (CIRP)'</li><li>'Notice Of Record Date For Bonus Issue'</li><li>"Update To Disclosure Under Regulation 30 Of SEBI (Listing Obligations And Disclosure Requirements) Regulations, 2015 - Resolution Plan Jointly Submitted By Reliance Industries Limited And Assets Care & Reconstruction Enterprise Limited For The Resolution Of Sintex Industries Limited, Approved By Hon'Ble National Company Law Tribunal, Ahmedabad Bench"</li></ul> |
78
+ | 6 | <ul><li>'Statement Of Unaudited Standalone And Consolidated Financial Results Of The Company For The Quarter And Nine Months Ended 31St December, 2022'</li><li>'Unaudited Financial Results'</li><li>'Statement Of Audited Standalone And Consolidated Financial Results Of The Company For The Quarter And Year Ended 31St March, 2023'</li></ul> |
79
+ | 3 | <ul><li>'EARNINGS CALL:'</li><li>'Earnings Call - Intimation'</li><li>'Presentation On Earnings Call Update - Consolidated And Standalone Audited Financial Results Of The Bank For The Financial Year Ended March 31, 2023'</li></ul> |
80
+
81
+ ## Evaluation
82
+
83
+ ### Metrics
84
+ | Label | Accuracy |
85
+ |:--------|:---------|
86
+ | **all** | 0.9558 |
87
+
88
+ ## Uses
89
+
90
+ ### Direct Use for Inference
91
+
92
+ First install the SetFit library:
93
+
94
+ ```bash
95
+ pip install setfit
96
+ ```
97
+
98
+ Then you can load this model and run inference.
99
+
100
+ ```python
101
+ from setfit import SetFitModel
102
+
103
+ # Download from the 🤗 Hub
104
+ model = SetFitModel.from_pretrained("krish2505/setfitmkrt2")
105
+ # Run inference
106
+ preds = model("Infosys Unveils New AI-Powered Solutions for Enhanced Customer Experience")
107
+ ```
108
+
109
+ <!--
110
+ ### Downstream Use
111
+
112
+ *List how someone could finetune this model on their own dataset.*
113
+ -->
114
+
115
+ <!--
116
+ ### Out-of-Scope Use
117
+
118
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
119
+ -->
120
+
121
+ <!--
122
+ ## Bias, Risks and Limitations
123
+
124
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
125
+ -->
126
+
127
+ <!--
128
+ ### Recommendations
129
+
130
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
131
+ -->
132
+
133
+ ## Training Details
134
+
135
+ ### Training Set Metrics
136
+ | Training set | Min | Median | Max |
137
+ |:-------------|:----|:--------|:----|
138
+ | Word count | 1 | 14.7272 | 50 |
139
+
140
+ | Label | Training Sample Count |
141
+ |:------|:----------------------|
142
+ | 0 | 142 |
143
+ | 1 | 134 |
144
+ | 2 | 298 |
145
+ | 3 | 66 |
146
+ | 4 | 43 |
147
+ | 5 | 53 |
148
+ | 6 | 202 |
149
+ | 7 | 34 |
150
+ | 8 | 36 |
151
+
152
+ ### Training Hyperparameters
153
+ - batch_size: (64, 64)
154
+ - num_epochs: (2, 2)
155
+ - max_steps: -1
156
+ - sampling_strategy: oversampling
157
+ - num_iterations: 20
158
+ - body_learning_rate: (2e-05, 2e-05)
159
+ - head_learning_rate: 2e-05
160
+ - loss: CosineSimilarityLoss
161
+ - distance_metric: cosine_distance
162
+ - margin: 0.25
163
+ - end_to_end: False
164
+ - use_amp: False
165
+ - warmup_proportion: 0.1
166
+ - seed: 42
167
+ - eval_max_steps: -1
168
+ - load_best_model_at_end: False
169
+
170
+ ### Training Results
171
+ | Epoch | Step | Training Loss | Validation Loss |
172
+ |:------:|:----:|:-------------:|:---------------:|
173
+ | 0.0016 | 1 | 0.1754 | - |
174
+ | 0.0794 | 50 | 0.0917 | - |
175
+ | 0.1587 | 100 | 0.0534 | - |
176
+ | 0.2381 | 150 | 0.0521 | - |
177
+ | 0.3175 | 200 | 0.0352 | - |
178
+ | 0.3968 | 250 | 0.0062 | - |
179
+ | 0.4762 | 300 | 0.0159 | - |
180
+ | 0.5556 | 350 | 0.0151 | - |
181
+ | 0.6349 | 400 | 0.0207 | - |
182
+ | 0.7143 | 450 | 0.0129 | - |
183
+ | 0.7937 | 500 | 0.0186 | - |
184
+ | 0.8730 | 550 | 0.0083 | - |
185
+ | 0.9524 | 600 | 0.002 | - |
186
+ | 1.0317 | 650 | 0.0081 | - |
187
+ | 1.1111 | 700 | 0.0263 | - |
188
+ | 1.1905 | 750 | 0.0118 | - |
189
+ | 1.2698 | 800 | 0.0196 | - |
190
+ | 1.3492 | 850 | 0.011 | - |
191
+ | 1.4286 | 900 | 0.0153 | - |
192
+ | 1.5079 | 950 | 0.0015 | - |
193
+ | 1.5873 | 1000 | 0.0156 | - |
194
+ | 1.6667 | 1050 | 0.0215 | - |
195
+ | 1.7460 | 1100 | 0.0022 | - |
196
+ | 1.8254 | 1150 | 0.003 | - |
197
+ | 1.9048 | 1200 | 0.0033 | - |
198
+ | 1.9841 | 1250 | 0.0155 | - |
199
+
200
+ ### Framework Versions
201
+ - Python: 3.10.12
202
+ - SetFit: 1.0.3
203
+ - Sentence Transformers: 2.2.2
204
+ - Transformers: 4.36.2
205
+ - PyTorch: 2.0.0
206
+ - Datasets: 2.16.1
207
+ - Tokenizers: 0.15.0
208
+
209
+ ## Citation
210
+
211
+ ### BibTeX
212
+ ```bibtex
213
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
214
+ doi = {10.48550/ARXIV.2209.11055},
215
+ url = {https://arxiv.org/abs/2209.11055},
216
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
217
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
218
+ title = {Efficient Few-Shot Learning Without Prompts},
219
+ publisher = {arXiv},
220
+ year = {2022},
221
+ copyright = {Creative Commons Attribution 4.0 International}
222
+ }
223
+ ```
224
+
225
+ <!--
226
+ ## Glossary
227
+
228
+ *Clearly define terms in order to be accessible across audiences.*
229
+ -->
230
+
231
+ <!--
232
+ ## Model Card Authors
233
+
234
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
235
+ -->
236
+
237
+ <!--
238
+ ## Model Card Contact
239
+
240
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
241
+ -->
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/root/.cache/torch/sentence_transformers/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.36.2",
23
+ "vocab_size": 30527
24
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.0.0",
4
+ "transformers": "4.6.1",
5
+ "pytorch": "1.8.1"
6
+ }
7
+ }
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:7cc5331986e1106f3d7b82ca0e757a36bec5fb7e73211f92748fb44a60d45f51
3
+ size 437967672
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92a079aa8b0cc208dba99b9c15b482529571d446b93f7e056a1310b07416224a
3
+ size 56271
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": 512,
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