Netta1994 commited on
Commit
6726556
·
verified ·
1 Parent(s): 250bad9

Add SetFit model

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
3
+ "pooling_mode_cls_token": true,
4
+ "pooling_mode_mean_tokens": false,
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,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-base-en-v1.5
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: 'Reasoning:
14
+
15
+ The provided answer correctly indicates that the percentage in the response status
16
+ column shows "the total amount of successful completion of response actions."
17
+ This is well-supported by the document, which states, "the status of response
18
+ actions for the different steps in the... percentage indicates the total amount
19
+ of successful completion of response actions." Therefore, the answer effectively
20
+ addresses the specific question, maintains relevance, is concise, and uses the
21
+ correct key/value terms from the document.
22
+
23
+
24
+ Evaluation:'
25
+ - text: "Reasoning:\nThe document does not explicitly state the purpose of Endpoint\
26
+ \ controls, but it provides instructions on how to enable and configure them.\
27
+ \ The answer given is technically correct because the document does not directly\
28
+ \ address the purpose of Endpoint controls. However, by reviewing the instructions\
29
+ \ provided, one can infer that the purpose involves managing device control, firewall\
30
+ \ control, and disk encryption visibility, all of which are related to enhancing\
31
+ \ endpoint security. \n\nWhile the provided answer states that the information\
32
+ \ needed isn't covered, this can be considered somewhat true, but it does not\
33
+ \ make any inference from the given details.\n\nFinal result: Methodologically,\
34
+ \ it aligns as'' based on strict criteria.\nEvaluation:"
35
+ - text: 'Reasoning:
36
+
37
+ The provided document clearly outlines the purpose of the <ORGANIZATION> XDR On-Site
38
+ Collector Agent: it is installed to collect logs from platforms and securely forward
39
+ them to <ORGANIZATION> XDR. The answer given aligns accurately with the document''s
40
+ description, addressing the specific question without deviating into unrelated
41
+ topics. The response isalso concise and to the point.
42
+
43
+
44
+ Evaluation:'
45
+ - text: 'Reasoning:
46
+
47
+ The document specifies that in the "Email Notifications section," setting the
48
+ "<ORGANIZATION_2> notifications On" will ensure that users with the System Admin
49
+ role receive email notifications about stale or archived sensors. The answer provided
50
+ states that the purpose of the checkbox is to enable or disable email notifications
51
+ for users, which accurately reflects the information given in the document. The
52
+ answer is supported by the document, directly addresses the question, and is concise.
53
+
54
+
55
+ Evaluation:'
56
+ - text: "Reasoning:\nThe provided document contains specific URLs for images corresponding\
57
+ \ to the queries. The URL for the image associated with the second query is given\
58
+ \ as `..\\/..\\/_images\\/hunting_http://miller.co`. However, the provided answer\
59
+ \ `/..\\/..\\/_images\\/hunting_http://www.flores.net/` does not match this information\
60
+ \ and provides an incorrect URL that is not mentioned in the document. Therefore,\
61
+ \ the answer fails to meet the relevant criteria, is not grounded in the context\
62
+ \ of the document, and lacks conciseness by not directly referencing the correct\
63
+ \ URL.\n\nFinal evaluation: \nEvaluation:"
64
+ inference: true
65
+ model-index:
66
+ - name: SetFit with BAAI/bge-base-en-v1.5
67
+ results:
68
+ - task:
69
+ type: text-classification
70
+ name: Text Classification
71
+ dataset:
72
+ name: Unknown
73
+ type: unknown
74
+ split: test
75
+ metrics:
76
+ - type: accuracy
77
+ value: 0.6619718309859155
78
+ name: Accuracy
79
+ ---
80
+
81
+ # SetFit with BAAI/bge-base-en-v1.5
82
+
83
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) 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.
84
+
85
+ The model has been trained using an efficient few-shot learning technique that involves:
86
+
87
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
88
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
89
+
90
+ ## Model Details
91
+
92
+ ### Model Description
93
+ - **Model Type:** SetFit
94
+ - **Sentence Transformer body:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5)
95
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
96
+ - **Maximum Sequence Length:** 512 tokens
97
+ - **Number of Classes:** 2 classes
98
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
99
+ <!-- - **Language:** Unknown -->
100
+ <!-- - **License:** Unknown -->
101
+
102
+ ### Model Sources
103
+
104
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
105
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
106
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
107
+
108
+ ### Model Labels
109
+ | Label | Examples |
110
+ |:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
111
+ | 1 | <ul><li>'Reasoning:\nThe answer states that a dime holds a monetary value of 10 cents, which is one-tenth of a dollar. This is confirmed by the document, which specifies that a dime is indeed one-tenth of a dollar and worth 10 cents. The answer is directly related to the question, well-supported by the provided document, and is concise and to the point without any unnecessary information.\n\nEvaluation:'</li><li>'Reasoning:\nThe document clearly mentions "Set the <ORGANIZATION> investigation status" as one of the tasks that can be performed. Therefore, the answer "Yes" is well-supported by the provided document. The answer is concise, directly related to the question, and does not provide unnecessary information. All the criteria such as context grounding, relevance, and conciseness are met.\n\nEvaluation:'</li><li>'Reasoning:\nThe answer directly addresses the question by listing the benefits the author has experienced from their regular yoga practice. These benefits include unapologetic "me" time, improved health, self-growth, increased patience, the ability to be still, acceptance of daily changes, the realization that happiness is their responsibility, a deeper appreciation for their body, the understanding that yoga exists off the mat, and the importance of being open. Each of these points is explicitly mentioned in the provided document, making the answer well-supported and contextually accurate. The answer is concise and relevant, sticking closely to the specifics asked for in the question.\n\nFinal Evaluation:'</li></ul> |
112
+ | 0 | <ul><li>'Reasoning:\nThe answer is strongly grounded in the provided document, addressing the common challenge of losing the last 10 pounds and offering strategies directly related to the information in the text. It mentions reducing salt intake, cutting out processed foods and alcohol, drinking more water, increasing exercise intensity, engaging in interval training, and ensuring adequate sleep. These points are all covered in the document. The answer remains focused on the question without deviating into unrelated topics and is concise, providing practical tips in a clear and straightforward manner.\n\nFinal Evaluation:'</li><li>'Reasoning:\nThe correct answer should provide the image URL specifically associated with step 5 in the document. According to the document, the image URL for step 5 is `..\\/..\\/_images\\/bal_http://osborn-mendoza.info/`. The provided answer, `..\\/..\\/_images\\/bal_https://elliott.biz/`, does not match this URL.\n\nFinal evaluation: \nEvaluation:'</li><li>"Reasoning:\nThe provided answer accurately captures the challenges Amy Bloom faces when starting a significant writing project, as detailed in the document. Notably, it mentions the difficulty of getting started, the need to clear mental space, and to recalibrate her daily life, which are all points grounded in the text. The answer also covers her becoming less involved in everyday life and spending less time on domestic concerns, which aligns well with the provided passage. However, the part about traveling to a remote island with no internet access is not mentioned in the document and appears to be fabricated, which detracts from the answer's context grounding.\n\nFinal Result:"</li></ul> |
113
+
114
+ ## Evaluation
115
+
116
+ ### Metrics
117
+ | Label | Accuracy |
118
+ |:--------|:---------|
119
+ | **all** | 0.6620 |
120
+
121
+ ## Uses
122
+
123
+ ### Direct Use for Inference
124
+
125
+ First install the SetFit library:
126
+
127
+ ```bash
128
+ pip install setfit
129
+ ```
130
+
131
+ Then you can load this model and run inference.
132
+
133
+ ```python
134
+ from setfit import SetFitModel
135
+
136
+ # Download from the 🤗 Hub
137
+ model = SetFitModel.from_pretrained("Netta1994/setfit_baai_cybereason_gpt-4o_improved-cot-instructions_chat_few_shot_generated_remov")
138
+ # Run inference
139
+ preds = model("Reasoning:
140
+ The provided document clearly outlines the purpose of the <ORGANIZATION> XDR On-Site Collector Agent: it is installed to collect logs from platforms and securely forward them to <ORGANIZATION> XDR. The answer given aligns accurately with the document's description, addressing the specific question without deviating into unrelated topics. The response isalso concise and to the point.
141
+
142
+ Evaluation:")
143
+ ```
144
+
145
+ <!--
146
+ ### Downstream Use
147
+
148
+ *List how someone could finetune this model on their own dataset.*
149
+ -->
150
+
151
+ <!--
152
+ ### Out-of-Scope Use
153
+
154
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
155
+ -->
156
+
157
+ <!--
158
+ ## Bias, Risks and Limitations
159
+
160
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
161
+ -->
162
+
163
+ <!--
164
+ ### Recommendations
165
+
166
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
167
+ -->
168
+
169
+ ## Training Details
170
+
171
+ ### Training Set Metrics
172
+ | Training set | Min | Median | Max |
173
+ |:-------------|:----|:--------|:----|
174
+ | Word count | 33 | 75.9366 | 176 |
175
+
176
+ | Label | Training Sample Count |
177
+ |:------|:----------------------|
178
+ | 0 | 129 |
179
+ | 1 | 139 |
180
+
181
+ ### Training Hyperparameters
182
+ - batch_size: (16, 16)
183
+ - num_epochs: (1, 1)
184
+ - max_steps: -1
185
+ - sampling_strategy: oversampling
186
+ - num_iterations: 20
187
+ - body_learning_rate: (2e-05, 2e-05)
188
+ - head_learning_rate: 2e-05
189
+ - loss: CosineSimilarityLoss
190
+ - distance_metric: cosine_distance
191
+ - margin: 0.25
192
+ - end_to_end: False
193
+ - use_amp: False
194
+ - warmup_proportion: 0.1
195
+ - l2_weight: 0.01
196
+ - seed: 42
197
+ - eval_max_steps: -1
198
+ - load_best_model_at_end: False
199
+
200
+ ### Training Results
201
+ | Epoch | Step | Training Loss | Validation Loss |
202
+ |:------:|:----:|:-------------:|:---------------:|
203
+ | 0.0015 | 1 | 0.2012 | - |
204
+ | 0.0746 | 50 | 0.2574 | - |
205
+ | 0.1493 | 100 | 0.252 | - |
206
+ | 0.2239 | 150 | 0.2507 | - |
207
+ | 0.2985 | 200 | 0.2204 | - |
208
+ | 0.3731 | 250 | 0.1529 | - |
209
+ | 0.4478 | 300 | 0.0581 | - |
210
+ | 0.5224 | 350 | 0.0298 | - |
211
+ | 0.5970 | 400 | 0.0209 | - |
212
+ | 0.6716 | 450 | 0.0075 | - |
213
+ | 0.7463 | 500 | 0.0038 | - |
214
+ | 0.8209 | 550 | 0.0032 | - |
215
+ | 0.8955 | 600 | 0.003 | - |
216
+ | 0.9701 | 650 | 0.0027 | - |
217
+
218
+ ### Framework Versions
219
+ - Python: 3.10.14
220
+ - SetFit: 1.1.0
221
+ - Sentence Transformers: 3.1.1
222
+ - Transformers: 4.44.0
223
+ - PyTorch: 2.4.0+cu121
224
+ - Datasets: 3.0.0
225
+ - Tokenizers: 0.19.1
226
+
227
+ ## Citation
228
+
229
+ ### BibTeX
230
+ ```bibtex
231
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
232
+ doi = {10.48550/ARXIV.2209.11055},
233
+ url = {https://arxiv.org/abs/2209.11055},
234
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
235
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
236
+ title = {Efficient Few-Shot Learning Without Prompts},
237
+ publisher = {arXiv},
238
+ year = {2022},
239
+ copyright = {Creative Commons Attribution 4.0 International}
240
+ }
241
+ ```
242
+
243
+ <!--
244
+ ## Glossary
245
+
246
+ *Clearly define terms in order to be accessible across audiences.*
247
+ -->
248
+
249
+ <!--
250
+ ## Model Card Authors
251
+
252
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
253
+ -->
254
+
255
+ <!--
256
+ ## Model Card Contact
257
+
258
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
259
+ -->
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BAAI/bge-base-en-v1.5",
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
+ "id2label": {
13
+ "0": "LABEL_0"
14
+ },
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "label2id": {
18
+ "LABEL_0": 0
19
+ },
20
+ "layer_norm_eps": 1e-12,
21
+ "max_position_embeddings": 512,
22
+ "model_type": "bert",
23
+ "num_attention_heads": 12,
24
+ "num_hidden_layers": 12,
25
+ "pad_token_id": 0,
26
+ "position_embedding_type": "absolute",
27
+ "torch_dtype": "float32",
28
+ "transformers_version": "4.44.0",
29
+ "type_vocab_size": 2,
30
+ "use_cache": true,
31
+ "vocab_size": 30522
32
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.1.1",
4
+ "transformers": "4.44.0",
5
+ "pytorch": "2.4.0+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:7ad5d65e214ba0cbaec2c7d02d20afba6da6f231d6e6d95eb4955f246656c772
3
+ size 437951328
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:943166a2cedb6ee11bbc303154320aecbb5ff119b9f3c1d0d9e08be14800b6c5
3
+ size 7007
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": true
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,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "model_max_length": 512,
50
+ "never_split": null,
51
+ "pad_token": "[PAD]",
52
+ "sep_token": "[SEP]",
53
+ "strip_accents": null,
54
+ "tokenize_chinese_chars": true,
55
+ "tokenizer_class": "BertTokenizer",
56
+ "unk_token": "[UNK]"
57
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff