MiguelRod commited on
Commit
a42dfa8
·
verified ·
1 Parent(s): 7aac983

Upload folder using huggingface_hub

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
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
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: cambridgeltl/SapBERT-from-PubMedBERT-fulltext
3
+ library_name: setfit
4
+ metrics:
5
+ - accuracy
6
+ pipeline_tag: text-classification
7
+ tags:
8
+ - setfit
9
+ - sentence-transformers
10
+ - text-classification
11
+ - generated_from_setfit_trainer
12
+ widget:
13
+ - text: exorphins
14
+ - text: phosphatidylethanolamines
15
+ - text: lipopolysaccharides
16
+ - text: ion channels
17
+ - text: caspases
18
+ inference: false
19
+ model-index:
20
+ - name: SetFit with cambridgeltl/SapBERT-from-PubMedBERT-fulltext
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.17570754716981132
32
+ name: Accuracy
33
+ ---
34
+
35
+ # SetFit with cambridgeltl/SapBERT-from-PubMedBERT-fulltext
36
+
37
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [cambridgeltl/SapBERT-from-PubMedBERT-fulltext](https://huggingface.co/cambridgeltl/SapBERT-from-PubMedBERT-fulltext) as the Sentence Transformer embedding model. A MultiOutputClassifier 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:** [cambridgeltl/SapBERT-from-PubMedBERT-fulltext](https://huggingface.co/cambridgeltl/SapBERT-from-PubMedBERT-fulltext)
49
+ - **Classification head:** a MultiOutputClassifier 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.1757 |
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("setfit_model_id")
86
+ # Run inference
87
+ preds = model("caspases")
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 | 1 | 1.7652 | 5 |
120
+
121
+ ### Training Hyperparameters
122
+ - batch_size: (16, 16)
123
+ - num_epochs: (3, 3)
124
+ - max_steps: -1
125
+ - sampling_strategy: oversampling
126
+ - num_iterations: 15
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.0009 | 1 | 0.2361 | - |
144
+ | 0.0463 | 50 | 0.2377 | - |
145
+ | 0.0927 | 100 | 0.2269 | - |
146
+ | 0.1390 | 150 | 0.2104 | - |
147
+ | 0.1854 | 200 | 0.1871 | - |
148
+ | 0.2317 | 250 | 0.1437 | - |
149
+ | 0.2780 | 300 | 0.1322 | - |
150
+ | 0.3244 | 350 | 0.1365 | - |
151
+ | 0.3707 | 400 | 0.1155 | - |
152
+ | 0.4171 | 450 | 0.1144 | - |
153
+ | 0.4634 | 500 | 0.1068 | - |
154
+ | 0.5097 | 550 | 0.1011 | - |
155
+ | 0.5561 | 600 | 0.095 | - |
156
+ | 0.6024 | 650 | 0.0933 | - |
157
+ | 0.6487 | 700 | 0.1063 | - |
158
+ | 0.6951 | 750 | 0.0999 | - |
159
+ | 0.7414 | 800 | 0.0823 | - |
160
+ | 0.7878 | 850 | 0.0877 | - |
161
+ | 0.8341 | 900 | 0.0767 | - |
162
+ | 0.8804 | 950 | 0.0849 | - |
163
+ | 0.9268 | 1000 | 0.0796 | - |
164
+ | 0.9731 | 1050 | 0.0877 | - |
165
+ | 1.0195 | 1100 | 0.0759 | - |
166
+ | 1.0658 | 1150 | 0.0705 | - |
167
+ | 1.1121 | 1200 | 0.0728 | - |
168
+ | 1.1585 | 1250 | 0.0738 | - |
169
+ | 1.2048 | 1300 | 0.0767 | - |
170
+ | 1.2512 | 1350 | 0.0692 | - |
171
+ | 1.2975 | 1400 | 0.0697 | - |
172
+ | 1.3438 | 1450 | 0.0639 | - |
173
+ | 1.3902 | 1500 | 0.0729 | - |
174
+ | 1.4365 | 1550 | 0.0759 | - |
175
+ | 1.4829 | 1600 | 0.0786 | - |
176
+ | 1.5292 | 1650 | 0.0618 | - |
177
+ | 1.5755 | 1700 | 0.0722 | - |
178
+ | 1.6219 | 1750 | 0.0719 | - |
179
+ | 1.6682 | 1800 | 0.072 | - |
180
+ | 1.7146 | 1850 | 0.0654 | - |
181
+ | 1.7609 | 1900 | 0.0683 | - |
182
+ | 1.8072 | 1950 | 0.0654 | - |
183
+ | 1.8536 | 2000 | 0.0679 | - |
184
+ | 1.8999 | 2050 | 0.0643 | - |
185
+ | 1.9462 | 2100 | 0.0662 | - |
186
+ | 1.9926 | 2150 | 0.0642 | - |
187
+ | 2.0389 | 2200 | 0.0812 | - |
188
+ | 2.0853 | 2250 | 0.068 | - |
189
+ | 2.1316 | 2300 | 0.0583 | - |
190
+ | 2.1779 | 2350 | 0.0627 | - |
191
+ | 2.2243 | 2400 | 0.0654 | - |
192
+ | 2.2706 | 2450 | 0.0571 | - |
193
+ | 2.3170 | 2500 | 0.0623 | - |
194
+ | 2.3633 | 2550 | 0.0639 | - |
195
+ | 2.4096 | 2600 | 0.059 | - |
196
+ | 2.4560 | 2650 | 0.0637 | - |
197
+ | 2.5023 | 2700 | 0.0675 | - |
198
+ | 2.5487 | 2750 | 0.0696 | - |
199
+ | 2.5950 | 2800 | 0.0669 | - |
200
+ | 2.6413 | 2850 | 0.0633 | - |
201
+ | 2.6877 | 2900 | 0.0606 | - |
202
+ | 2.7340 | 2950 | 0.0609 | - |
203
+ | 2.7804 | 3000 | 0.054 | - |
204
+ | 2.8267 | 3050 | 0.0598 | - |
205
+ | 2.8730 | 3100 | 0.0597 | - |
206
+ | 2.9194 | 3150 | 0.0618 | - |
207
+ | 2.9657 | 3200 | 0.065 | - |
208
+
209
+ ### Framework Versions
210
+ - Python: 3.10.12
211
+ - SetFit: 1.1.0
212
+ - Sentence Transformers: 3.1.1
213
+ - Transformers: 4.39.0
214
+ - PyTorch: 2.4.1+cu121
215
+ - Datasets: 3.0.0
216
+ - Tokenizers: 0.15.2
217
+
218
+ ## Citation
219
+
220
+ ### BibTeX
221
+ ```bibtex
222
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
223
+ doi = {10.48550/ARXIV.2209.11055},
224
+ url = {https://arxiv.org/abs/2209.11055},
225
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
226
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
227
+ title = {Efficient Few-Shot Learning Without Prompts},
228
+ publisher = {arXiv},
229
+ year = {2022},
230
+ copyright = {Creative Commons Attribution 4.0 International}
231
+ }
232
+ ```
233
+
234
+ <!--
235
+ ## Glossary
236
+
237
+ *Clearly define terms in order to be accessible across audiences.*
238
+ -->
239
+
240
+ <!--
241
+ ## Model Card Authors
242
+
243
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
244
+ -->
245
+
246
+ <!--
247
+ ## Model Card Contact
248
+
249
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
250
+ -->
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "cambridgeltl/SapBERT-from-PubMedBERT-fulltext",
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": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.39.0",
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.39.0",
5
+ "pytorch": "2.4.1+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
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:d06b56258d86aece592a5a1c5d117c15ad68d262e2015db4221dd23355c30e08
3
+ size 437951328
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38c0dad256433f167a10a8f5a7b32c5fcf3becb10746a8686a4f8eec99a6b7ae
3
+ size 150849
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,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "1": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
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
+ "full_tokenizer_file": null,
49
+ "mask_token": "[MASK]",
50
+ "model_max_length": 1000000000000000019884624838656,
51
+ "never_split": null,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "strip_accents": null,
55
+ "tokenize_chinese_chars": true,
56
+ "tokenizer_class": "BertTokenizer",
57
+ "unk_token": "[UNK]"
58
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff