Netta1994 commited on
Commit
5374931
1 Parent(s): 6d9f858

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,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 diligently grounds itself with multiple points from the provided document,
16
+ ensuring it is both specific and detailed. It covers key parts of the performance
17
+ review process, including self-assessment, peer feedback, consolidation, coaching
18
+ sessions, and resources. This maintains high relevance andclear grounding in the
19
+ document.
20
+
21
+ Evaluation:'
22
+ - text: 'Reasoning:
23
+
24
+ The answer is accurately grounded in the provided document and directly addresses
25
+ the question without deviating into unrelated topics. The email address for contacting
26
+ regarding travel reimbursement questions is correctly cited from the document.
27
+
28
+
29
+ Final evaluation:'
30
+ - text: 'Reasoning:
31
+
32
+ The answer is adequately grounded in the provided document, covering the steps
33
+ that team leads and employees should take to improve the situation. It includes
34
+ specific actions such as thinking about someone''s time at the company, flagging
35
+ issues, analyzing problems, providing feedback, trying to fix issues together,
36
+ and finishing it up if progress isn''t made. It also mentions asking for upward
37
+ feedback and improving work-life balance, which are directly referenced in the
38
+ documents.
39
+
40
+
41
+ Final Result:'
42
+ - text: 'Reasoning:
43
+
44
+ The answer is directly related to the document content, addressing the specific
45
+ topic of sexual harassment, which includes flirting making colleagues uncomfortable.
46
+ It covers the importance of creating a respectful environment and mentions the
47
+ consequences of such actions, which is implicitly grounded in the documents''
48
+ information. Thus, it meets the criteria of context grounding, relevance,conciseness,
49
+ and specificity.
50
+
51
+
52
+ Final Result:'
53
+ - text: 'Reasoning:
54
+
55
+ The answer provides a general rationale for investing in personal relationships
56
+ at work. However, it fails to provide specific points or direct references from
57
+ the documents that explicitly answer the question. Given that the document hints
58
+ at the importance of personal relationships but does not directly explain the
59
+ detailed benefits outlined in the answer, the response is considered somewhat
60
+ speculative and not sufficientlygrounded in the provided text.
61
+
62
+
63
+ Final Result:'
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.6567164179104478
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
+ | 0 | <ul><li>'Reasoning:\nThe provided answer is too general and is not grounded in the specific details or context of the given document, which focuses on study budgets and considerations for wise spending within the organization.\n\nEvaluation:'</li><li>'Reasoning:\nThe answer contains specific information from the document and lists relevant pet peeves. However, there are multiple instances of the phrase "Cassandra Rivera Heather Nelson," which seems out of place. This could cause confusion and detract from the overall clarity.\n\nFinal Result:'</li><li>"Reasoning:\nThe answer does not address the question directly. The provided steps and methods mentioned focus on handling personal documents, expense reimbursements, secure sharing of information, feedback discussion, and requesting a learning budget. The question specifically asks about accessing the company's training resources, and the answer provided does not stay focused on that.\n\nEvaluation:"</li></ul> |
112
+ | 1 | <ul><li>'Reasoning:\nThe answer accurately addresses the question, providing specific details from the document about how feedback should be given. It includes key points such as timing, focusing on the situation, being clear and direct, showing appreciation, and the intention behind giving feedback, all of which are mentioned in the document.\n\nEvaluation:'</li><li>'Reasoning:\nThe answer correctly identifies several reasons why it is important to share information from high-level meetings, directly supported by the provided document. The explanation is clear, relevant, and to the point, avoiding unnecessary information.\n\nEvaluation:'</li><li>'Reasoning:\nThe answer largely reproduces content from the document accurately, specifying the process for keeping track of kilometers and sending an email or excel document. However, there are inaccuracies in the email addresses and naming inconsistency. For instance, "Dustin Chan" appears in place of "finance@Dustin [email protected]" and "ORGANIZATION_2," which do not exist in the document. Moreover, it includes extraneous, non-verifiable information about the parking card.\n\nEvaluation:'</li></ul> |
113
+
114
+ ## Evaluation
115
+
116
+ ### Metrics
117
+ | Label | Accuracy |
118
+ |:--------|:---------|
119
+ | **all** | 0.6567 |
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_newrelic_gpt-4o_improved-cot-instructions_chat_few_shot_remove_final_eval")
138
+ # Run inference
139
+ preds = model("Reasoning:
140
+ The answer is accurately grounded in the provided document and directly addresses the question without deviating into unrelated topics. The email address for contacting regarding travel reimbursement questions is correctly cited from the document.
141
+
142
+ Final 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 | 16 | 48.1538 | 125 |
175
+
176
+ | Label | Training Sample Count |
177
+ |:------|:----------------------|
178
+ | 0 | 32 |
179
+ | 1 | 33 |
180
+
181
+ ### Training Hyperparameters
182
+ - batch_size: (16, 16)
183
+ - num_epochs: (2, 2)
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.0061 | 1 | 0.2381 | - |
204
+ | 0.3067 | 50 | 0.2589 | - |
205
+ | 0.6135 | 100 | 0.2081 | - |
206
+ | 0.9202 | 150 | 0.0271 | - |
207
+ | 1.2270 | 200 | 0.0045 | - |
208
+ | 1.5337 | 250 | 0.0031 | - |
209
+ | 1.8405 | 300 | 0.0026 | - |
210
+
211
+ ### Framework Versions
212
+ - Python: 3.10.14
213
+ - SetFit: 1.1.0
214
+ - Sentence Transformers: 3.1.0
215
+ - Transformers: 4.44.0
216
+ - PyTorch: 2.4.1+cu121
217
+ - Datasets: 2.19.2
218
+ - Tokenizers: 0.19.1
219
+
220
+ ## Citation
221
+
222
+ ### BibTeX
223
+ ```bibtex
224
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
225
+ doi = {10.48550/ARXIV.2209.11055},
226
+ url = {https://arxiv.org/abs/2209.11055},
227
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
228
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
229
+ title = {Efficient Few-Shot Learning Without Prompts},
230
+ publisher = {arXiv},
231
+ year = {2022},
232
+ copyright = {Creative Commons Attribution 4.0 International}
233
+ }
234
+ ```
235
+
236
+ <!--
237
+ ## Glossary
238
+
239
+ *Clearly define terms in order to be accessible across audiences.*
240
+ -->
241
+
242
+ <!--
243
+ ## Model Card Authors
244
+
245
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
246
+ -->
247
+
248
+ <!--
249
+ ## Model Card Contact
250
+
251
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
252
+ -->
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:3096f612c377cfada0a3bda45770dab2f061ba16885097bfe9bdf90c6aad4d43
3
+ size 437951328
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:928b8dea0cb857fed7dcb22cb448b1311f73e551e7a363aa1218c125201f843e
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