Netta1994 commited on
Commit
7682a1e
1 Parent(s): 273b163

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,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 directly addresses the question and is correctly grounded in the document.
16
+ The percentage indeed refers to the total amount of successful completion of response
17
+ actions.
18
+
19
+ Evaluation: Good'
20
+ - text: 'Reasoning:
21
+
22
+ From the provided document, it is clear that Endpoint controls relate to Device
23
+ Control, Personal Firewall Control, and Full Disk Encryption Visibility. The purpose
24
+ or intent behind enabling endpoint controls is to manage and secure endpoint devices
25
+ through various specific features. The given answer does not address the query
26
+ effectively, overlooking the information from the document that provides insight
27
+ into the purpose of endpoint controls.
28
+
29
+ Evaluation: Bad'
30
+ - text: 'Reasoning:
31
+
32
+ The answer provided--"To collect logs and securely forward them to <ORGANIZATION>
33
+ XDR"--is precisely aligned with the information given in the document. The document
34
+ explicitly states that the On-Site Collector Agent is installed to collect logs
35
+ and securely forward them to <ORGANIZATION> (XDR). This answer is accurate and
36
+ specific, addressing the question without ambiguity or omission.
37
+
38
+
39
+ Evaluation: Good'
40
+ - text: 'Reasoning:
41
+
42
+ The answer ''The purpose of the <ORGANIZATION_2> email notifications checkbox
43
+ in the Users section is to <ORGANIZATION_2> or disable email notifications for
44
+ users'' attempts to leverage the document''s information but fails to correctly
45
+ incorporate the specifics. The correct description based on the document should
46
+ detail how this checkbox allows toggling email notifications for users with the
47
+ System Admin role regarding stale or archived sensors.
48
+
49
+
50
+ Evaluation: Bad'
51
+ - text: 'Reasoning:
52
+
53
+ The answered string `..\/..\/_images\/hunting_http://www.flores.net/ does not
54
+ appear in the document, nor does it match the provided URLs. The correct URL for
55
+ the image is `..\/..\/_images\/hunting_http://miller.co, which corresponds to
56
+ the second query.
57
+
58
+ Evaluation: Bad'
59
+ inference: true
60
+ model-index:
61
+ - name: SetFit with BAAI/bge-base-en-v1.5
62
+ results:
63
+ - task:
64
+ type: text-classification
65
+ name: Text Classification
66
+ dataset:
67
+ name: Unknown
68
+ type: unknown
69
+ split: test
70
+ metrics:
71
+ - type: accuracy
72
+ value: 0.5492957746478874
73
+ name: Accuracy
74
+ ---
75
+
76
+ # SetFit with BAAI/bge-base-en-v1.5
77
+
78
+ 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.
79
+
80
+ The model has been trained using an efficient few-shot learning technique that involves:
81
+
82
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
83
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
84
+
85
+ ## Model Details
86
+
87
+ ### Model Description
88
+ - **Model Type:** SetFit
89
+ - **Sentence Transformer body:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5)
90
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
91
+ - **Maximum Sequence Length:** 512 tokens
92
+ - **Number of Classes:** 2 classes
93
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
94
+ <!-- - **Language:** Unknown -->
95
+ <!-- - **License:** Unknown -->
96
+
97
+ ### Model Sources
98
+
99
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
100
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
101
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
102
+
103
+ ### Model Labels
104
+ | Label | Examples |
105
+ |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
106
+ | 0 | <ul><li>'Reasoning:\nThe provided answer "It provides a comprehensive understanding of the situation" partially aligns with the intended concept, suggesting a holistic evaluation. However, it lacks direct specificity in relation to the document\'s key aspects, which emphasize deciding malicious behavior and subsequent actions, such as remediation, based on a collective assessment of significant machines, behaviors, and users affected. The answer misses the emphasis on prioritization and context provided by evaluating all factors collectively.\n\nEvaluation: Bad'</li><li>'Reasoning:\nThe given document explicitly outlines the steps required to exclude a MalOp during the remediation process. The answer, however, incorrectly states that the information is not covered in the document and suggests referring to additional sources. This contradicts the clear instructions provided in the document.\n\nEvaluation: Bad'</li><li>'Reasoning:\nThe answer directly addresses the question by stating that a quarantined file should be un-quarantined before being submitted, which aligns with the information provided in the document. The specific instruction to un-quarantine the file first if it is quarantined is accurately reflected in the response.\nEvaluation: Good'</li></ul> |
107
+ | 1 | <ul><li>'Reasoning:\nThe answer is precise, correct, and directly addresses the question. It matches the information provided in the "Result" section of the document, which states that the computer will generate a dump file containing the entire contents of the sensor\'s RAM at the time of the failure.\n\nEvaluation: Good'</li><li>'Reasoning:\nThe provided answer "To identify cyber security threats" directly aligns with the information in the document which talks about the primary function of the <ORGANIZATION_2> platform being to identify cyber security threats using advanced technologies and methods.\nEvaluation: Good'</li><li>'Reasoning:\nThere is no fifth scenario detailed in the provided document, and the answer correctly identifies that the specific query is not covered in the provided information.\nEvaluation: Good'</li></ul> |
108
+
109
+ ## Evaluation
110
+
111
+ ### Metrics
112
+ | Label | Accuracy |
113
+ |:--------|:---------|
114
+ | **all** | 0.5493 |
115
+
116
+ ## Uses
117
+
118
+ ### Direct Use for Inference
119
+
120
+ First install the SetFit library:
121
+
122
+ ```bash
123
+ pip install setfit
124
+ ```
125
+
126
+ Then you can load this model and run inference.
127
+
128
+ ```python
129
+ from setfit import SetFitModel
130
+
131
+ # Download from the 🤗 Hub
132
+ model = SetFitModel.from_pretrained("Netta1994/setfit_baai_cybereason_gpt-4o_improved-cot_chat_few_shot_only_reasoning_1726752428.08")
133
+ # Run inference
134
+ preds = model("Reasoning:
135
+ The answer directly addresses the question and is correctly grounded in the document. The percentage indeed refers to the total amount of successful completion of response actions.
136
+ Evaluation: Good")
137
+ ```
138
+
139
+ <!--
140
+ ### Downstream Use
141
+
142
+ *List how someone could finetune this model on their own dataset.*
143
+ -->
144
+
145
+ <!--
146
+ ### Out-of-Scope Use
147
+
148
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
149
+ -->
150
+
151
+ <!--
152
+ ## Bias, Risks and Limitations
153
+
154
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
155
+ -->
156
+
157
+ <!--
158
+ ### Recommendations
159
+
160
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
161
+ -->
162
+
163
+ ## Training Details
164
+
165
+ ### Training Set Metrics
166
+ | Training set | Min | Median | Max |
167
+ |:-------------|:----|:--------|:----|
168
+ | Word count | 18 | 43.0580 | 94 |
169
+
170
+ | Label | Training Sample Count |
171
+ |:------|:----------------------|
172
+ | 0 | 34 |
173
+ | 1 | 35 |
174
+
175
+ ### Training Hyperparameters
176
+ - batch_size: (16, 16)
177
+ - num_epochs: (5, 5)
178
+ - max_steps: -1
179
+ - sampling_strategy: oversampling
180
+ - num_iterations: 20
181
+ - body_learning_rate: (2e-05, 2e-05)
182
+ - head_learning_rate: 2e-05
183
+ - loss: CosineSimilarityLoss
184
+ - distance_metric: cosine_distance
185
+ - margin: 0.25
186
+ - end_to_end: False
187
+ - use_amp: False
188
+ - warmup_proportion: 0.1
189
+ - l2_weight: 0.01
190
+ - seed: 42
191
+ - eval_max_steps: -1
192
+ - load_best_model_at_end: False
193
+
194
+ ### Training Results
195
+ | Epoch | Step | Training Loss | Validation Loss |
196
+ |:------:|:----:|:-------------:|:---------------:|
197
+ | 0.0058 | 1 | 0.246 | - |
198
+ | 0.2890 | 50 | 0.2593 | - |
199
+ | 0.5780 | 100 | 0.2385 | - |
200
+ | 0.8671 | 150 | 0.0897 | - |
201
+ | 1.1561 | 200 | 0.004 | - |
202
+ | 1.4451 | 250 | 0.0022 | - |
203
+ | 1.7341 | 300 | 0.002 | - |
204
+ | 2.0231 | 350 | 0.0017 | - |
205
+ | 2.3121 | 400 | 0.0017 | - |
206
+ | 2.6012 | 450 | 0.0014 | - |
207
+ | 2.8902 | 500 | 0.0013 | - |
208
+ | 3.1792 | 550 | 0.0013 | - |
209
+ | 3.4682 | 600 | 0.0012 | - |
210
+ | 3.7572 | 650 | 0.0012 | - |
211
+ | 4.0462 | 700 | 0.0013 | - |
212
+ | 4.3353 | 750 | 0.0012 | - |
213
+ | 4.6243 | 800 | 0.0012 | - |
214
+ | 4.9133 | 850 | 0.0011 | - |
215
+
216
+ ### Framework Versions
217
+ - Python: 3.10.14
218
+ - SetFit: 1.1.0
219
+ - Sentence Transformers: 3.1.0
220
+ - Transformers: 4.44.0
221
+ - PyTorch: 2.4.1+cu121
222
+ - Datasets: 2.19.2
223
+ - Tokenizers: 0.19.1
224
+
225
+ ## Citation
226
+
227
+ ### BibTeX
228
+ ```bibtex
229
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
230
+ doi = {10.48550/ARXIV.2209.11055},
231
+ url = {https://arxiv.org/abs/2209.11055},
232
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
233
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
234
+ title = {Efficient Few-Shot Learning Without Prompts},
235
+ publisher = {arXiv},
236
+ year = {2022},
237
+ copyright = {Creative Commons Attribution 4.0 International}
238
+ }
239
+ ```
240
+
241
+ <!--
242
+ ## Glossary
243
+
244
+ *Clearly define terms in order to be accessible across audiences.*
245
+ -->
246
+
247
+ <!--
248
+ ## Model Card Authors
249
+
250
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
251
+ -->
252
+
253
+ <!--
254
+ ## Model Card Contact
255
+
256
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
257
+ -->
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:9d33e9699d9660f98ec5e8c766bc14f56d93eb3f6f9667bc5c3eb18a23abe166
3
+ size 437951328
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:660fe08d37e0452d1a4bcdd543d0b86d65f3e9f2e31f08e36c01c964290b6e9e
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