ppsingh commited on
Commit
9fd5038
1 Parent(s): d959a2c

Add SetFit model

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
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
+ }
README.md ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: Specific information applicable to Parties, including regional economic integration
12
+ organizations and their member States, that have reached an agreement to act jointly
13
+ under Article 4, paragraph 2, of the Paris Agreement, including the Parties that
14
+ agreed to act jointly and the terms of the agreement, in accordance with Article
15
+ 4, paragraphs 16–18, of the Paris Agreement. Not applicable. (c). How the Party’s
16
+ preparation of its nationally determined contribution has been informed by the
17
+ outcomes of the global stocktake, in accordance with Article 4, paragraph 9, of
18
+ the Paris Agreement.
19
+ - text: 'In the shipping and aviation sectors, emission reduction efforts will be
20
+ focused on distributing eco-friendly ships and enhancing the operational efficiency
21
+ of aircraft. Agriculture, livestock farming and fisheries: The Republic Korea
22
+ is introducing various options to accelerate low-carbon farming, for instance,
23
+ improving irrigation techniques in rice paddies and adopting low-input systems
24
+ for nitrogen fertilizers.'
25
+ - text: As part of this commitment, Oman s upstream oil and gas industry is developing
26
+ economically viable solutions to phase out routine flaring as quickly as possible
27
+ and ahead of the World Bank s target date. IV. Climate Preparedness and Resilience.
28
+ The Sultanate of Oman has stepped up its efforts in advancing its expertise and
29
+ methodologies to better manage the climate change risks over the past five years.
30
+ The adaptation efforts are underway, and the status of adaptation planning is
31
+ still at a nascent stage.
32
+ - text: 'Synergy and coherence 46 VII- Gender and youth 46 VIII- Education and employment
33
+ 48 ANNEXES. 49 Annex No. 1: Details of mitigation measures, conditional and non-conditional,
34
+ by sector 49 Annex No.2: List of adaptation actions proposed by sectors. 57 Annex
35
+ No.3: GCF project portfolio. 63 CONTRIBUTION DENTERMINEE AT NATIONAL LEVEL CDN
36
+ MAURITANIE LIST OF TABLES Table 1: Summary of funding needs for the CND 2021-2030
37
+ updated. 12 Table 2: CND 2021-2030 mitigation measures updated by sector (cumulative
38
+ cost and reduction potential for the period). 14 Table 3: CND 2021-2030 adaptation
39
+ measures updated by sector. Error!'
40
+ - text: In the transport sector, restructuing is planned through a number of large
41
+ infrastructure initiatives aiming to revive the role of public transport and achieving
42
+ a relevant share of fuel efficient vehicles. Under both the conditional and unconditional
43
+ mitigation scenarios, Lebanon will achieve sizeable emission reductions. With
44
+ regards to adaptation, Lebanon has planned comprehensive sectoral actions related
45
+ to water, agriculture/forestry and biodiversity, for example related to irrigation,
46
+ forest management, etc. It also continues developing adaptation strategies in
47
+ the remaining sectors.
48
+ pipeline_tag: text-classification
49
+ inference: false
50
+ co2_eq_emissions:
51
+ emissions: 25.8151164022705
52
+ source: codecarbon
53
+ training_type: fine-tuning
54
+ on_cloud: false
55
+ cpu_model: Intel(R) Xeon(R) CPU @ 2.00GHz
56
+ ram_total_size: 12.674781799316406
57
+ hours_used: 0.622
58
+ hardware_used: 1 x Tesla T4
59
+ base_model: ppsingh/SECTOR-multilabel-mpnet_w
60
+ ---
61
+
62
+ # SetFit with ppsingh/SECTOR-multilabel-mpnet_w
63
+
64
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [ppsingh/SECTOR-multilabel-mpnet_w](https://huggingface.co/ppsingh/SECTOR-multilabel-mpnet_w) as the Sentence Transformer embedding model. A [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance is used for classification.
65
+
66
+ The model has been trained using an efficient few-shot learning technique that involves:
67
+
68
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
69
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
70
+
71
+ ## Model Details
72
+
73
+ ### Model Description
74
+ - **Model Type:** SetFit
75
+ - **Sentence Transformer body:** [ppsingh/SECTOR-multilabel-mpnet_w](https://huggingface.co/ppsingh/SECTOR-multilabel-mpnet_w)
76
+ - **Classification head:** a [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance
77
+ - **Maximum Sequence Length:** 512 tokens
78
+ - **Number of Classes:** 4 classes
79
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
80
+ <!-- - **Language:** Unknown -->
81
+ <!-- - **License:** Unknown -->
82
+
83
+ ### Model Sources
84
+
85
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
86
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
87
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
88
+
89
+ ## Uses
90
+
91
+ ### Direct Use for Inference
92
+
93
+ First install the SetFit library:
94
+
95
+ ```bash
96
+ pip install setfit
97
+ ```
98
+
99
+ Then you can load this model and run inference.
100
+
101
+ ```python
102
+ from setfit import SetFitModel
103
+
104
+ # Download from the 🤗 Hub
105
+ model = SetFitModel.from_pretrained("ppsingh/iki_sector_setfit")
106
+ # Run inference
107
+ preds = model("In the shipping and aviation sectors, emission reduction efforts will be focused on distributing eco-friendly ships and enhancing the operational efficiency of aircraft. Agriculture, livestock farming and fisheries: The Republic Korea is introducing various options to accelerate low-carbon farming, for instance, improving irrigation techniques in rice paddies and adopting low-input systems for nitrogen fertilizers.")
108
+ ```
109
+
110
+ <!--
111
+ ### Downstream Use
112
+
113
+ *List how someone could finetune this model on their own dataset.*
114
+ -->
115
+
116
+ <!--
117
+ ### Out-of-Scope Use
118
+
119
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
120
+ -->
121
+
122
+ <!--
123
+ ## Bias, Risks and Limitations
124
+
125
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
126
+ -->
127
+
128
+ <!--
129
+ ### Recommendations
130
+
131
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
132
+ -->
133
+
134
+ ## Training Details
135
+
136
+ ### Training Set Metrics
137
+ | Training set | Min | Median | Max |
138
+ |:-------------|:----|:-------|:----|
139
+ | Word count | 35 | 76.164 | 170 |
140
+
141
+ ### Training Hyperparameters
142
+ - batch_size: (16, 2)
143
+ - num_epochs: (1, 0)
144
+ - max_steps: -1
145
+ - sampling_strategy: oversampling
146
+ - body_learning_rate: (2e-05, 1e-05)
147
+ - head_learning_rate: 0.01
148
+ - loss: CosineSimilarityLoss
149
+ - distance_metric: cosine_distance
150
+ - margin: 0.25
151
+ - end_to_end: False
152
+ - use_amp: False
153
+ - warmup_proportion: 0.01
154
+ - seed: 42
155
+ - eval_max_steps: -1
156
+ - load_best_model_at_end: False
157
+
158
+ ### Training Results
159
+ | Epoch | Step | Training Loss | Validation Loss |
160
+ |:------:|:----:|:-------------:|:---------------:|
161
+ | 0.0005 | 1 | 0.2029 | - |
162
+ | 0.0993 | 200 | 0.0111 | 0.1124 |
163
+ | 0.1985 | 400 | 0.0063 | 0.111 |
164
+ | 0.2978 | 600 | 0.0183 | 0.1214 |
165
+ | 0.3970 | 800 | 0.0197 | 0.1248 |
166
+ | 0.4963 | 1000 | 0.0387 | 0.1339 |
167
+ | 0.5955 | 1200 | 0.0026 | 0.1181 |
168
+ | 0.6948 | 1400 | 0.0378 | 0.1208 |
169
+ | 0.7940 | 1600 | 0.0285 | 0.1267 |
170
+ | 0.8933 | 1800 | 0.0129 | 0.1254 |
171
+ | 0.9926 | 2000 | 0.0341 | 0.1271 |
172
+
173
+ ### Environmental Impact
174
+ Carbon emissions were measured using [CodeCarbon](https://github.com/mlco2/codecarbon).
175
+ - **Carbon Emitted**: 0.026 kg of CO2
176
+ - **Hours Used**: 0.622 hours
177
+
178
+ ### Training Hardware
179
+ - **On Cloud**: No
180
+ - **GPU Model**: 1 x Tesla T4
181
+ - **CPU Model**: Intel(R) Xeon(R) CPU @ 2.00GHz
182
+ - **RAM Size**: 12.67 GB
183
+
184
+ ### Framework Versions
185
+ - Python: 3.10.12
186
+ - SetFit: 1.0.3
187
+ - Sentence Transformers: 2.3.1
188
+ - Transformers: 4.35.2
189
+ - PyTorch: 2.1.0+cu121
190
+ - Datasets: 2.3.0
191
+ - Tokenizers: 0.15.1
192
+
193
+ ## Citation
194
+
195
+ ### BibTeX
196
+ ```bibtex
197
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
198
+ doi = {10.48550/ARXIV.2209.11055},
199
+ url = {https://arxiv.org/abs/2209.11055},
200
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
201
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
202
+ title = {Efficient Few-Shot Learning Without Prompts},
203
+ publisher = {arXiv},
204
+ year = {2022},
205
+ copyright = {Creative Commons Attribution 4.0 International}
206
+ }
207
+ ```
208
+
209
+ <!--
210
+ ## Glossary
211
+
212
+ *Clearly define terms in order to be accessible across audiences.*
213
+ -->
214
+
215
+ <!--
216
+ ## Model Card Authors
217
+
218
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
219
+ -->
220
+
221
+ <!--
222
+ ## Model Card Contact
223
+
224
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
225
+ -->
config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "ppsingh/SECTOR-multilabel-mpnet_w",
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
+ "id2label": {
13
+ "0": "Agriculture",
14
+ "1": "Buildings",
15
+ "2": "Coastal Zone",
16
+ "3": "Cross-Cutting Area",
17
+ "4": "Disaster Risk Management (DRM)",
18
+ "5": "Economy-wide",
19
+ "6": "Education",
20
+ "7": "Energy",
21
+ "8": "Environment",
22
+ "9": "Health",
23
+ "10": "Industries",
24
+ "11": "LULUCF/Forestry",
25
+ "12": "Social Development",
26
+ "13": "Tourism",
27
+ "14": "Transport",
28
+ "15": "Urban",
29
+ "16": "Waste",
30
+ "17": "Water"
31
+ },
32
+ "initializer_range": 0.02,
33
+ "intermediate_size": 3072,
34
+ "label2id": {
35
+ "Agriculture": 0,
36
+ "Buildings": 1,
37
+ "Coastal Zone": 2,
38
+ "Cross-Cutting Area": 3,
39
+ "Disaster Risk Management (DRM)": 4,
40
+ "Economy-wide": 5,
41
+ "Education": 6,
42
+ "Energy": 7,
43
+ "Environment": 8,
44
+ "Health": 9,
45
+ "Industries": 10,
46
+ "LULUCF/Forestry": 11,
47
+ "Social Development": 12,
48
+ "Tourism": 13,
49
+ "Transport": 14,
50
+ "Urban": 15,
51
+ "Waste": 16,
52
+ "Water": 17
53
+ },
54
+ "layer_norm_eps": 1e-05,
55
+ "max_position_embeddings": 514,
56
+ "model_type": "mpnet",
57
+ "num_attention_heads": 12,
58
+ "num_hidden_layers": 12,
59
+ "pad_token_id": 1,
60
+ "problem_type": "multi_label_classification",
61
+ "relative_attention_num_buckets": 32,
62
+ "torch_dtype": "float32",
63
+ "transformers_version": "4.35.2",
64
+ "vocab_size": 30527
65
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.3.1",
4
+ "transformers": "4.35.2",
5
+ "pytorch": "2.1.0+cu121"
6
+ }
7
+ }
config_setfit.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": true,
3
+ "labels": [
4
+ "Economy-wide",
5
+ "Energy",
6
+ "Other Sector",
7
+ "Transport"
8
+ ]
9
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5f137bb2e1e7da1eebf8b21d4b5878675c41b4240614b3e4bccb248029eb52c
3
+ size 437967672
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88559af6420967265b7519c9b35c1a3efa8a7ef3ee3c4b40d3f5f3225ffab36b
3
+ size 13858
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 512,
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,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "problem_type": "multi_label_classification",
65
+ "sep_token": "</s>",
66
+ "stride": 0,
67
+ "strip_accents": null,
68
+ "tokenize_chinese_chars": true,
69
+ "tokenizer_class": "MPNetTokenizer",
70
+ "truncation_side": "right",
71
+ "truncation_strategy": "longest_first",
72
+ "unk_token": "[UNK]"
73
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff