diegofiggie commited on
Commit
93eeb5a
1 Parent(s): 5e9d16b

Upload 14 files

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 384,
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
+ }
README.md ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: setfit
3
+ tags:
4
+ - setfit
5
+ - sentence-transformers
6
+ - text-classification
7
+ - generated_from_setfit_trainer
8
+ metrics:
9
+ - accuracy
10
+ widget:
11
+ - text: 'first: We recommend employees start a support group to share and address
12
+ workplace concerns. second: Grievance Resolution Committee: A committee addresses
13
+ formal grievances and ensures a fair resolution process.'
14
+ - text: 'first: Supervisors are encouraged to watch TED talks on communication to
15
+ enhance their skills. second: Progressive Discipline: Disciplinary actions are
16
+ proportionate and follow a structured process.'
17
+ - text: 'first: Grievance Resolution Committee: A committee addresses formal grievances
18
+ and ensures a fair resolution process. second: We provide employees with a comprehensive
19
+ handbook outlining our dispute resolution process for clarity.'
20
+ - text: 'first: We recommend employees seek advice from their peers and mentors to
21
+ navigate workplace issues. second: We use technology-based solutions to facilitate
22
+ virtual conflict resolution discussions.'
23
+ - text: 'first: We''ve introduced a complaint of the month contest to highlight and
24
+ address concerns effectively. second: Our company has a clear conflict resolution
25
+ policy that all employees must follow.'
26
+ pipeline_tag: text-classification
27
+ inference: true
28
+ base_model: sentence-transformers/all-MiniLM-L6-v2
29
+ model-index:
30
+ - name: SetFit with sentence-transformers/all-MiniLM-L6-v2
31
+ results:
32
+ - task:
33
+ type: text-classification
34
+ name: Text Classification
35
+ dataset:
36
+ name: Unknown
37
+ type: unknown
38
+ split: test
39
+ metrics:
40
+ - type: accuracy
41
+ value: 0.7272727272727273
42
+ name: Accuracy
43
+ ---
44
+
45
+ # SetFit with sentence-transformers/all-MiniLM-L6-v2
46
+
47
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) 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.
48
+
49
+ The model has been trained using an efficient few-shot learning technique that involves:
50
+
51
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
52
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
53
+
54
+ ## Model Details
55
+
56
+ ### Model Description
57
+ - **Model Type:** SetFit
58
+ - **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
59
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
60
+ - **Maximum Sequence Length:** 256 tokens
61
+ - **Number of Classes:** 2 classes
62
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
63
+ <!-- - **Language:** Unknown -->
64
+ <!-- - **License:** Unknown -->
65
+
66
+ ### Model Sources
67
+
68
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
69
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
70
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
71
+
72
+ ### Model Labels
73
+ | Label | Examples |
74
+ |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
75
+ | 0 | <ul><li>'first: Employee Support Groups: Peer-led support groups for employees facing similar issues. second: We offer conflict resolution workshops to provide employees with valuable skills.'</li></ul> |
76
+ | 1 | <ul><li>'first: Conflict Resolution Peer Mentoring: Experienced employees mentor newcomers in conflict resolution. second: Diversity and Inclusion Training: Programs that promote understanding and reduce conflicts related to diversity.'</li></ul> |
77
+
78
+ ## Evaluation
79
+
80
+ ### Metrics
81
+ | Label | Accuracy |
82
+ |:--------|:---------|
83
+ | **all** | 0.7273 |
84
+
85
+ ## Uses
86
+
87
+ ### Direct Use for Inference
88
+
89
+ First install the SetFit library:
90
+
91
+ ```bash
92
+ pip install setfit
93
+ ```
94
+
95
+ Then you can load this model and run inference.
96
+
97
+ ```python
98
+ from setfit import SetFitModel
99
+
100
+ # Download from the 🤗 Hub
101
+ model = SetFitModel.from_pretrained("sijan1/setfit-finetuned-fairness")
102
+ # Run inference
103
+ preds = model("first: We've introduced a complaint of the month contest to highlight and address concerns effectively. second: Our company has a clear conflict resolution policy that all employees must follow.")
104
+ ```
105
+
106
+ <!--
107
+ ### Downstream Use
108
+
109
+ *List how someone could finetune this model on their own dataset.*
110
+ -->
111
+
112
+ <!--
113
+ ### Out-of-Scope Use
114
+
115
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
116
+ -->
117
+
118
+ <!--
119
+ ## Bias, Risks and Limitations
120
+
121
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
122
+ -->
123
+
124
+ <!--
125
+ ### Recommendations
126
+
127
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
128
+ -->
129
+
130
+ ## Training Details
131
+
132
+ ### Training Set Metrics
133
+ | Training set | Min | Median | Max |
134
+ |:-------------|:----|:-------|:----|
135
+ | Word count | 24 | 25.5 | 27 |
136
+
137
+ | Label | Training Sample Count |
138
+ |:------|:----------------------|
139
+ | 0 | 1 |
140
+ | 1 | 1 |
141
+
142
+ ### Training Hyperparameters
143
+ - batch_size: (4, 4)
144
+ - num_epochs: (1, 1)
145
+ - max_steps: -1
146
+ - sampling_strategy: oversampling
147
+ - num_iterations: 30
148
+ - body_learning_rate: (2e-05, 2e-05)
149
+ - head_learning_rate: 2e-05
150
+ - loss: CosineSimilarityLoss
151
+ - distance_metric: cosine_distance
152
+ - margin: 0.25
153
+ - end_to_end: False
154
+ - use_amp: False
155
+ - warmup_proportion: 0.1
156
+ - seed: 42
157
+ - eval_max_steps: -1
158
+ - load_best_model_at_end: False
159
+
160
+ ### Training Results
161
+ | Epoch | Step | Training Loss | Validation Loss |
162
+ |:------:|:----:|:-------------:|:---------------:|
163
+ | 0.1 | 1 | 0.0141 | - |
164
+ | 5.0 | 50 | 0.0012 | - |
165
+ | 10.0 | 100 | 0.0006 | - |
166
+ | 0.1 | 1 | 0.0005 | - |
167
+ | 5.0 | 50 | 0.0005 | - |
168
+ | 10.0 | 100 | 0.0002 | - |
169
+ | 15.0 | 150 | 0.0002 | - |
170
+ | 20.0 | 200 | 0.0001 | - |
171
+ | 25.0 | 250 | 0.0001 | - |
172
+ | 30.0 | 300 | 0.0001 | - |
173
+ | 35.0 | 350 | 0.0002 | - |
174
+ | 40.0 | 400 | 0.0 | - |
175
+ | 45.0 | 450 | 0.0 | - |
176
+ | 50.0 | 500 | 0.0 | - |
177
+ | 55.0 | 550 | 0.0 | - |
178
+ | 60.0 | 600 | 0.0 | - |
179
+ | 65.0 | 650 | 0.0001 | - |
180
+ | 70.0 | 700 | 0.0 | - |
181
+ | 75.0 | 750 | 0.0 | - |
182
+ | 80.0 | 800 | 0.0 | - |
183
+ | 85.0 | 850 | 0.0 | - |
184
+ | 90.0 | 900 | 0.0 | - |
185
+ | 95.0 | 950 | 0.0 | - |
186
+ | 100.0 | 1000 | 0.0 | - |
187
+ | 0.0667 | 1 | 0.0 | - |
188
+ | 0.8333 | 50 | 0.0 | - |
189
+ | 0.0222 | 1 | 0.0 | - |
190
+ | 0.8333 | 50 | 0.0 | - |
191
+ | 0.0111 | 1 | 0.0001 | - |
192
+ | 0.5556 | 50 | 0.0 | - |
193
+ | 0.0333 | 1 | 0.0 | - |
194
+
195
+ ### Framework Versions
196
+ - Python: 3.10.12
197
+ - SetFit: 1.0.3
198
+ - Sentence Transformers: 2.3.1
199
+ - Transformers: 4.37.2
200
+ - PyTorch: 2.1.0+cu121
201
+ - Datasets: 2.17.1
202
+ - Tokenizers: 0.15.2
203
+
204
+ ## Citation
205
+
206
+ ### BibTeX
207
+ ```bibtex
208
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
209
+ doi = {10.48550/ARXIV.2209.11055},
210
+ url = {https://arxiv.org/abs/2209.11055},
211
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
212
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
213
+ title = {Efficient Few-Shot Learning Without Prompts},
214
+ publisher = {arXiv},
215
+ year = {2022},
216
+ copyright = {Creative Commons Attribution 4.0 International}
217
+ }
218
+ ```
219
+
220
+ <!--
221
+ ## Glossary
222
+
223
+ *Clearly define terms in order to be accessible across audiences.*
224
+ -->
225
+
226
+ <!--
227
+ ## Model Card Authors
228
+
229
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
230
+ -->
231
+
232
+ <!--
233
+ ## Model Card Contact
234
+
235
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
236
+ -->
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "sentence-transformers/all-MiniLM-L6-v2",
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": 384,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 1536,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 6,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.37.2",
23
+ "type_vocab_size": 2,
24
+ "use_cache": true,
25
+ "vocab_size": 30522
26
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.0.0",
4
+ "transformers": "4.6.1",
5
+ "pytorch": "1.8.1"
6
+ }
7
+ }
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:c2ab9e5d8a1781daa63f933ba0a20df6f98fe6a6f6d7802970f3fcc24bfbb8d4
3
+ size 90864192
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da534e8c56dac72f1467ca8580929be60367c31d3de44d75ca75ddfc8c941f9c
3
+ size 3935
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": 256,
3
+ "do_lower_case": false
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,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "max_length": 128,
50
+ "model_max_length": 512,
51
+ "never_split": null,
52
+ "pad_to_multiple_of": null,
53
+ "pad_token": "[PAD]",
54
+ "pad_token_type_id": 0,
55
+ "padding_side": "right",
56
+ "sep_token": "[SEP]",
57
+ "stride": 0,
58
+ "strip_accents": null,
59
+ "tokenize_chinese_chars": true,
60
+ "tokenizer_class": "BertTokenizer",
61
+ "truncation_side": "right",
62
+ "truncation_strategy": "longest_first",
63
+ "unk_token": "[UNK]"
64
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff