Netta1994 commited on
Commit
1ed9e90
·
verified ·
1 Parent(s): b223101

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,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 answer is direct, concise, and accurately picks out the relevant information
16
+ from the document concerning the percentage in the response status column.
17
+
18
+ Evaluation: Good'
19
+ - text: 'Reasoning:
20
+
21
+ The document provides specific steps to enable and configure Endpoint controls,
22
+ but it doesn''t explicitly state the purpose or objective of Endpoint controls.
23
+ The answer appropriately recognizes that the provided information does not cover
24
+ the specific query regarding the purpose. This shows strong context grounding
25
+ and relevance to the question, as the document indeed lacks the required detail.
26
+
27
+
28
+ Evaluation: Good'
29
+ - text: 'Reasoning:
30
+
31
+ The answer directly refers to a specific function mentioned in the document, which
32
+ is to collect logs and securely forward them to the <ORGANIZATION> XDR. This is
33
+ concise and appropriately addresses the question based on the given text.
34
+
35
+
36
+ Evaluation: Good'
37
+ - text: 'Reasoning:
38
+
39
+ The answer correctly identifies the purpose of the <ORGANIZATION_2> email notifications
40
+ checkbox as enabling or disabling email notifications for users. This is supported
41
+ by the document, specifically the section that details that if <ORGANIZATION_2>
42
+ notifications is set to On, users with the System Admin role will receive email
43
+ notifications about stale or archived sensors, even if the user notification checkbox
44
+ is not selected.
45
+
46
+
47
+ Evaluation: Good'
48
+ - text: 'Reasoning:
49
+
50
+ 1. Context Grounding: The provided answer is not adequately supported by the document.
51
+ The document provides the correct URL, which is `..\/..\/_images\/hunting_http://miller.co
52
+ for the second query, but the answer presented is incorrect and refers only to
53
+ the first query image.
54
+
55
+ 2. Relevance: The answer is not relevant; it does not identify that the appropriate
56
+ URL for the image is `..\/..\/_images\/hunting_http://miller.co.
57
+
58
+ 3. Conciseness: The answer is concise but inaccurate.
59
+
60
+ 4. Specificity: The answer lacks the specifics necessary to directly respond to
61
+ the question, it does not pertain to the second query image URL.
62
+
63
+
64
+ Final Result: Bad'
65
+ inference: true
66
+ model-index:
67
+ - name: SetFit with BAAI/bge-base-en-v1.5
68
+ results:
69
+ - task:
70
+ type: text-classification
71
+ name: Text Classification
72
+ dataset:
73
+ name: Unknown
74
+ type: unknown
75
+ split: test
76
+ metrics:
77
+ - type: accuracy
78
+ value: 0.5070422535211268
79
+ name: Accuracy
80
+ ---
81
+
82
+ # SetFit with BAAI/bge-base-en-v1.5
83
+
84
+ 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.
85
+
86
+ The model has been trained using an efficient few-shot learning technique that involves:
87
+
88
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
89
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
90
+
91
+ ## Model Details
92
+
93
+ ### Model Description
94
+ - **Model Type:** SetFit
95
+ - **Sentence Transformer body:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5)
96
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
97
+ - **Maximum Sequence Length:** 512 tokens
98
+ - **Number of Classes:** 2 classes
99
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
100
+ <!-- - **Language:** Unknown -->
101
+ <!-- - **License:** Unknown -->
102
+
103
+ ### Model Sources
104
+
105
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
106
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
107
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
108
+
109
+ ### Model Labels
110
+ | Label | Examples |
111
+ |:------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
112
+ | 0 | <ul><li>'Reasoning:\nThe response fails to fully address the specifics of the question based on the provided document. The question is about the significance of considering all answers together when determining if the behavior in a MalOp is malicious. The response should have included how analyzing various factors, such as the significance of machines, behavior severity, and the users involved, helps in forming a comprehensive understanding of whether the behavior is malicious and requires further action.\n\nThe answer given is overly vague and does not capture the detailed reasoning found in the document. It lacks essential details concerning the factors that need to be considered, such as machine significance, activity severity, and user importance.\n\nEvaluation: Bad'</li><li>'Reasoning:\nThe document provides a detailed process to exclude a MalOp during the remediation phase, and the answer fails to incorporate this information. The answer is also quite dismissive, suggesting the document does not cover the query when it does. Thus, the answer does not address the specific question asked and is not grounded in the context of the provided document.\n\nFinal Result: Bad'</li><li>'Reasoning:\nThe answer correctly states that a file should be un-quarantined before submitting it to the respective organization, which aligns with the information provided in the document. The answer is concise, specific, and directly addresses the question without any deviation.\n\nEvaluation: Good'</li></ul> |
113
+ | 1 | <ul><li>"Reasoning:\nThe answer is directly grounded in the provided document, accurately conveying the information that the computer will generate a dump file containing the entire contents of the sensor's RAM at the time of the failure. The response is concise and specific to the question asked without including unnecessary information.\n\nEvaluation: Good"</li><li>'Reasoning:\n1. Context Grounding: The provided answer "To identify cyber security threats" is directly supported by the document, which states that threat detection is a core capability that aims to identify cyber security threats by analyzing data.\n2. Relevance: The answer directly addresses the specific question about the purpose of the <ORGANIZATION_2> platform\'s threat detection abilities.\n3. Conciseness: The answer is clear and to the point, summarizing the purpose effectively without unnecessary information.\n4. Specificity: The answer provides a specific purpose as outlined in the document.\n\nEvaluation: Good'</li><li>'Reasoning:\nThe given answer asserts that the provided information does not cover the specific query, advising to refer to additional sources. However, the document contains clear information regarding four different scenarios and their corresponding severity scores. The answer also does not directly address what is clearly stated in the document and evades the question.\n\nEvaluation: Bad'</li></ul> |
114
+
115
+ ## Evaluation
116
+
117
+ ### Metrics
118
+ | Label | Accuracy |
119
+ |:--------|:---------|
120
+ | **all** | 0.5070 |
121
+
122
+ ## Uses
123
+
124
+ ### Direct Use for Inference
125
+
126
+ First install the SetFit library:
127
+
128
+ ```bash
129
+ pip install setfit
130
+ ```
131
+
132
+ Then you can load this model and run inference.
133
+
134
+ ```python
135
+ from setfit import SetFitModel
136
+
137
+ # Download from the 🤗 Hub
138
+ model = SetFitModel.from_pretrained("Netta1994/setfit_baai_cybereason_gpt-4o_improved-cot-instructions_chat_few_shot_only_reasoning_")
139
+ # Run inference
140
+ preds = model("Reasoning:
141
+ The answer is direct, concise, and accurately picks out the relevant information from the document concerning the percentage in the response status column.
142
+ Evaluation: Good")
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 | 2 | 48.4638 | 115 |
175
+
176
+ | Label | Training Sample Count |
177
+ |:------|:----------------------|
178
+ | 0 | 34 |
179
+ | 1 | 35 |
180
+
181
+ ### Training Hyperparameters
182
+ - batch_size: (16, 16)
183
+ - num_epochs: (5, 5)
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.0058 | 1 | 0.2563 | - |
204
+ | 0.2890 | 50 | 0.2638 | - |
205
+ | 0.5780 | 100 | 0.242 | - |
206
+ | 0.8671 | 150 | 0.1521 | - |
207
+ | 1.1561 | 200 | 0.0056 | - |
208
+ | 1.4451 | 250 | 0.0025 | - |
209
+ | 1.7341 | 300 | 0.0022 | - |
210
+ | 2.0231 | 350 | 0.0019 | - |
211
+ | 2.3121 | 400 | 0.0019 | - |
212
+ | 2.6012 | 450 | 0.0016 | - |
213
+ | 2.8902 | 500 | 0.0015 | - |
214
+ | 3.1792 | 550 | 0.0014 | - |
215
+ | 3.4682 | 600 | 0.0014 | - |
216
+ | 3.7572 | 650 | 0.0014 | - |
217
+ | 4.0462 | 700 | 0.0014 | - |
218
+ | 4.3353 | 750 | 0.0014 | - |
219
+ | 4.6243 | 800 | 0.0013 | - |
220
+ | 4.9133 | 850 | 0.0013 | - |
221
+
222
+ ### Framework Versions
223
+ - Python: 3.10.14
224
+ - SetFit: 1.1.0
225
+ - Sentence Transformers: 3.1.0
226
+ - Transformers: 4.44.0
227
+ - PyTorch: 2.4.1+cu121
228
+ - Datasets: 2.19.2
229
+ - Tokenizers: 0.19.1
230
+
231
+ ## Citation
232
+
233
+ ### BibTeX
234
+ ```bibtex
235
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
236
+ doi = {10.48550/ARXIV.2209.11055},
237
+ url = {https://arxiv.org/abs/2209.11055},
238
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
239
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
240
+ title = {Efficient Few-Shot Learning Without Prompts},
241
+ publisher = {arXiv},
242
+ year = {2022},
243
+ copyright = {Creative Commons Attribution 4.0 International}
244
+ }
245
+ ```
246
+
247
+ <!--
248
+ ## Glossary
249
+
250
+ *Clearly define terms in order to be accessible across audiences.*
251
+ -->
252
+
253
+ <!--
254
+ ## Model Card Authors
255
+
256
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
257
+ -->
258
+
259
+ <!--
260
+ ## Model Card Contact
261
+
262
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
263
+ -->
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.0",
4
+ "transformers": "4.44.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
+ "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:2da66776db189c68cb35016faa0455bb209d59510717ce5e5b6c95647c600146
3
+ size 437951328
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32b3387b68fb92b4c22c44c583dfa042128e90551cc01e5c6e192beaae51836b
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