luis-espinosa commited on
Commit
861ee7f
·
verified ·
1 Parent(s): 4076a2f

Upload trained SetFit model (multilabel)

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,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Zouk Capital invests £35 million into Energy Park through CIIF financing
9
+ - text: Volkswagen Sets Ambitious Goals for Electric Vehicle Production
10
+ - text: LATAM Unveils New Dreamliner Economy Cabin Design
11
+ - text: Emirates Announces Additional Flights for Eid Al Fitr
12
+ - text: Japan Airlines Unveils ‘MYAKU-MYAKU’ Dreamliner Livery
13
+ metrics:
14
+ - accuracy
15
+ pipeline_tag: text-classification
16
+ library_name: setfit
17
+ inference: false
18
+ base_model: thenlper/gte-small
19
+ model-index:
20
+ - name: SetFit with thenlper/gte-small
21
+ results:
22
+ - task:
23
+ type: text-classification
24
+ name: Text Classification
25
+ dataset:
26
+ name: Unknown
27
+ type: unknown
28
+ split: test
29
+ metrics:
30
+ - type: accuracy
31
+ value: 0.4864864864864865
32
+ name: Accuracy
33
+ ---
34
+
35
+ # SetFit with thenlper/gte-small
36
+
37
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [thenlper/gte-small](https://huggingface.co/thenlper/gte-small) as the Sentence Transformer embedding model. A OneVsRestClassifier instance is used for classification.
38
+
39
+ The model has been trained using an efficient few-shot learning technique that involves:
40
+
41
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
42
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
43
+
44
+ ## Model Details
45
+
46
+ ### Model Description
47
+ - **Model Type:** SetFit
48
+ - **Sentence Transformer body:** [thenlper/gte-small](https://huggingface.co/thenlper/gte-small)
49
+ - **Classification head:** a OneVsRestClassifier instance
50
+ - **Maximum Sequence Length:** 512 tokens
51
+ <!-- - **Number of Classes:** Unknown -->
52
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
53
+ <!-- - **Language:** Unknown -->
54
+ <!-- - **License:** Unknown -->
55
+
56
+ ### Model Sources
57
+
58
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
59
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
60
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
61
+
62
+ ## Evaluation
63
+
64
+ ### Metrics
65
+ | Label | Accuracy |
66
+ |:--------|:---------|
67
+ | **all** | 0.4865 |
68
+
69
+ ## Uses
70
+
71
+ ### Direct Use for Inference
72
+
73
+ First install the SetFit library:
74
+
75
+ ```bash
76
+ pip install setfit
77
+ ```
78
+
79
+ Then you can load this model and run inference.
80
+
81
+ ```python
82
+ from setfit import SetFitModel
83
+
84
+ # Download from the 🤗 Hub
85
+ model = SetFitModel.from_pretrained("amplyfi/gte-small_all-labels_multilabel")
86
+ # Run inference
87
+ preds = model("LATAM Unveils New Dreamliner Economy Cabin Design")
88
+ ```
89
+
90
+ <!--
91
+ ### Downstream Use
92
+
93
+ *List how someone could finetune this model on their own dataset.*
94
+ -->
95
+
96
+ <!--
97
+ ### Out-of-Scope Use
98
+
99
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
100
+ -->
101
+
102
+ <!--
103
+ ## Bias, Risks and Limitations
104
+
105
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
106
+ -->
107
+
108
+ <!--
109
+ ### Recommendations
110
+
111
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
112
+ -->
113
+
114
+ ## Training Details
115
+
116
+ ### Training Set Metrics
117
+ | Training set | Min | Median | Max |
118
+ |:-------------|:----|:-------|:----|
119
+ | Word count | 4 | 9.9616 | 30 |
120
+
121
+ ### Training Hyperparameters
122
+ - batch_size: (16, 16)
123
+ - num_epochs: (2, 2)
124
+ - max_steps: -1
125
+ - sampling_strategy: oversampling
126
+ - num_iterations: 5
127
+ - body_learning_rate: (2e-05, 2e-05)
128
+ - head_learning_rate: 2e-05
129
+ - loss: CosineSimilarityLoss
130
+ - distance_metric: cosine_distance
131
+ - margin: 0.25
132
+ - end_to_end: False
133
+ - use_amp: False
134
+ - warmup_proportion: 0.1
135
+ - l2_weight: 0.01
136
+ - seed: 42
137
+ - eval_max_steps: -1
138
+ - load_best_model_at_end: False
139
+
140
+ ### Training Results
141
+ | Epoch | Step | Training Loss | Validation Loss |
142
+ |:------:|:----:|:-------------:|:---------------:|
143
+ | 0.0018 | 1 | 0.3005 | - |
144
+ | 0.0903 | 50 | 0.2933 | - |
145
+ | 0.1805 | 100 | 0.2219 | - |
146
+ | 0.2708 | 150 | 0.1568 | - |
147
+ | 0.3610 | 200 | 0.1334 | - |
148
+ | 0.4513 | 250 | 0.1204 | - |
149
+ | 0.5415 | 300 | 0.1215 | - |
150
+ | 0.6318 | 350 | 0.1154 | - |
151
+ | 0.7220 | 400 | 0.1065 | - |
152
+ | 0.8123 | 450 | 0.0935 | - |
153
+ | 0.9025 | 500 | 0.0892 | - |
154
+ | 0.9928 | 550 | 0.0807 | - |
155
+ | 1.0830 | 600 | 0.0776 | - |
156
+ | 1.1733 | 650 | 0.0716 | - |
157
+ | 1.2635 | 700 | 0.06 | - |
158
+ | 1.3538 | 750 | 0.0677 | - |
159
+ | 1.4440 | 800 | 0.0607 | - |
160
+ | 1.5343 | 850 | 0.065 | - |
161
+ | 1.6245 | 900 | 0.0593 | - |
162
+ | 1.7148 | 950 | 0.0622 | - |
163
+ | 1.8051 | 1000 | 0.064 | - |
164
+ | 1.8953 | 1050 | 0.0624 | - |
165
+ | 1.9856 | 1100 | 0.0667 | - |
166
+
167
+ ### Framework Versions
168
+ - Python: 3.10.12
169
+ - SetFit: 1.1.0
170
+ - Sentence Transformers: 3.3.1
171
+ - Transformers: 4.42.2
172
+ - PyTorch: 2.5.1+cu124
173
+ - Datasets: 3.1.0
174
+ - Tokenizers: 0.19.1
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
+ "_name_or_path": "thenlper/gte-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
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.42.2",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.3.1",
4
+ "transformers": "4.42.2",
5
+ "pytorch": "2.5.1+cu124"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
config_setfit.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "labels": null,
3
+ "normalize_embeddings": false
4
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c449cb994b2a13d608bfe5014ceaa0ff89ce6ae8d030c860a62ecba12035359
3
+ size 133462128
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa10c7dbd833e3eb813dbda864ea8ab45ef6798896d38eefc875357dd07a91bc
3
+ size 62356
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
+ }
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": true,
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": 512,
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