bogged363 commited on
Commit
2cbe588
·
verified ·
1 Parent(s): e0978d2

Upload SetFit section filter v0.2.0

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
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
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Remote work is allowed provided the candidate has adequate home systems to
9
+ support the high internet data demands required for this position
10
+ - text: · High School degree required, though we will consider candidates with equivalent
11
+ education or experience · Experience and verifiable competence in building systems
12
+ including HVAC, steam, gas, electrical, plumbing, repair work and/or equivalent
13
+ training are required
14
+ - text: 'Beyond a light and engaging work environment, team members receive the following
15
+ benefits: Competitive salary PPO, HSA, and life insurance options 401k plan Open
16
+ vacation policy (discretionary time-off) DIY schedule for balancing personal and
17
+ professional responsibilities Equipment and tools for you to do your job Tracker
18
+ is an equal opportunity employer'
19
+ - text: Job descriptionA leading real estate firm in New Jersey is seeking an administrative
20
+ Marketing Coordinator with some experience in graphic design
21
+ - text: QualificationsPortfolio of published articles (electronic and print)Excellent
22
+ writing and editing skills in EnglishEvidence of collaboration with clients and
23
+ within an office environmentHands-on experience with MailChimp, WordPress, SEO
24
+ tools, Microsoft Suite, and social mediaFamiliarity with web publicationsPhotography
25
+ skills preferred
26
+ metrics:
27
+ - accuracy
28
+ pipeline_tag: text-classification
29
+ library_name: setfit
30
+ inference: true
31
+ base_model: sentence-transformers/paraphrase-mpnet-base-v2
32
+ ---
33
+
34
+ # SetFit with sentence-transformers/paraphrase-mpnet-base-v2
35
+
36
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-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.
37
+
38
+ The model has been trained using an efficient few-shot learning technique that involves:
39
+
40
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
41
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
42
+
43
+ ## Model Details
44
+
45
+ ### Model Description
46
+ - **Model Type:** SetFit
47
+ - **Sentence Transformer body:** [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
48
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
49
+ - **Maximum Sequence Length:** 512 tokens
50
+ - **Number of Classes:** 2 classes
51
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
52
+ <!-- - **Language:** Unknown -->
53
+ <!-- - **License:** Unknown -->
54
+
55
+ ### Model Sources
56
+
57
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
58
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
59
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
60
+
61
+ ### Model Labels
62
+ | Label | Examples |
63
+ |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
64
+ | skip | <ul><li>'Additional tasks may be assigned based on organizationalneeds and priorities.Culture:At the Kids’ Book Bank, we are a small but mighty team dedicated to getting more books to more children and fostering a love of reading'</li><li>'Founded in Sweden in 1907, today SKF is publicly traded on the Nasdaq Stockholm with annual sales in 2020 of approximately $10 billion'</li><li>'Compensation:$55,000-$75,000/year'</li></ul> |
65
+ | keep | <ul><li>'Requirements Must have at least 2 years Arizona or Colorado civil litigation experience, knowledge of both state and federal procedural rules, superior organizational skills, strong attention to detail and the ability to provide secretarial/administrative support to experienced trial attorneys'</li><li>'Experience with EMR systems Knowledge of Microsoft products (Word, Excel, Outlook)'</li><li>"Requirements:A bachelor's degree in exercise science, kinesiology, sports science, or a related field preferred but not required"</li></ul> |
66
+
67
+ ## Uses
68
+
69
+ ### Direct Use for Inference
70
+
71
+ First install the SetFit library:
72
+
73
+ ```bash
74
+ pip install setfit
75
+ ```
76
+
77
+ Then you can load this model and run inference.
78
+
79
+ ```python
80
+ from setfit import SetFitModel
81
+
82
+ # Download from the 🤗 Hub
83
+ model = SetFitModel.from_pretrained("setfit_model_id")
84
+ # Run inference
85
+ preds = model("Remote work is allowed provided the candidate has adequate home systems to support the high internet data demands required for this position")
86
+ ```
87
+
88
+ <!--
89
+ ### Downstream Use
90
+
91
+ *List how someone could finetune this model on their own dataset.*
92
+ -->
93
+
94
+ <!--
95
+ ### Out-of-Scope Use
96
+
97
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
98
+ -->
99
+
100
+ <!--
101
+ ## Bias, Risks and Limitations
102
+
103
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
104
+ -->
105
+
106
+ <!--
107
+ ### Recommendations
108
+
109
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
110
+ -->
111
+
112
+ ## Training Details
113
+
114
+ ### Training Set Metrics
115
+ | Training set | Min | Median | Max |
116
+ |:-------------|:----|:--------|:----|
117
+ | Word count | 1 | 24.1078 | 84 |
118
+
119
+ | Label | Training Sample Count |
120
+ |:------|:----------------------|
121
+ | skip | 52 |
122
+ | keep | 50 |
123
+
124
+ ### Training Hyperparameters
125
+ - batch_size: (16, 16)
126
+ - num_epochs: (4, 4)
127
+ - max_steps: -1
128
+ - sampling_strategy: oversampling
129
+ - num_iterations: 20
130
+ - body_learning_rate: (2e-05, 2e-05)
131
+ - head_learning_rate: 0.01
132
+ - loss: CosineSimilarityLoss
133
+ - distance_metric: cosine_distance
134
+ - margin: 0.25
135
+ - end_to_end: False
136
+ - use_amp: False
137
+ - warmup_proportion: 0.1
138
+ - l2_weight: 0.01
139
+ - seed: 42
140
+ - eval_max_steps: -1
141
+ - load_best_model_at_end: True
142
+
143
+ ### Training Results
144
+ | Epoch | Step | Training Loss | Validation Loss |
145
+ |:------:|:----:|:-------------:|:---------------:|
146
+ | 0.0039 | 1 | 0.3866 | - |
147
+ | 0.1961 | 50 | 0.2075 | - |
148
+ | 0.3922 | 100 | 0.0179 | - |
149
+ | 0.5882 | 150 | 0.0005 | - |
150
+ | 0.7843 | 200 | 0.0003 | - |
151
+ | 0.9804 | 250 | 0.0002 | - |
152
+ | 1.0 | 255 | - | 0.1885 |
153
+ | 1.1765 | 300 | 0.0002 | - |
154
+ | 1.3725 | 350 | 0.0001 | - |
155
+ | 1.5686 | 400 | 0.0001 | - |
156
+ | 1.7647 | 450 | 0.0001 | - |
157
+ | 1.9608 | 500 | 0.0001 | - |
158
+ | 2.0 | 510 | - | 0.1909 |
159
+ | 2.1569 | 550 | 0.0001 | - |
160
+ | 2.3529 | 600 | 0.0001 | - |
161
+ | 2.5490 | 650 | 0.0001 | - |
162
+ | 2.7451 | 700 | 0.0001 | - |
163
+ | 2.9412 | 750 | 0.0001 | - |
164
+ | 3.0 | 765 | - | 0.1904 |
165
+ | 3.1373 | 800 | 0.0001 | - |
166
+ | 3.3333 | 850 | 0.0001 | - |
167
+ | 3.5294 | 900 | 0.0001 | - |
168
+ | 3.7255 | 950 | 0.0001 | - |
169
+ | 3.9216 | 1000 | 0.0001 | - |
170
+ | 4.0 | 1020 | - | 0.1910 |
171
+
172
+ ### Framework Versions
173
+ - Python: 3.12.3
174
+ - SetFit: 1.1.3
175
+ - Sentence Transformers: 5.2.0
176
+ - Transformers: 4.57.3
177
+ - PyTorch: 2.5.1+cu124
178
+ - Datasets: 4.4.2
179
+ - Tokenizers: 0.22.2
180
+
181
+ ## Citation
182
+
183
+ ### BibTeX
184
+ ```bibtex
185
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
186
+ doi = {10.48550/ARXIV.2209.11055},
187
+ url = {https://arxiv.org/abs/2209.11055},
188
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
189
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
190
+ title = {Efficient Few-Shot Learning Without Prompts},
191
+ publisher = {arXiv},
192
+ year = {2022},
193
+ copyright = {Creative Commons Attribution 4.0 International}
194
+ }
195
+ ```
196
+
197
+ <!--
198
+ ## Glossary
199
+
200
+ *Clearly define terms in order to be accessible across audiences.*
201
+ -->
202
+
203
+ <!--
204
+ ## Model Card Authors
205
+
206
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
207
+ -->
208
+
209
+ <!--
210
+ ## Model Card Contact
211
+
212
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
213
+ -->
config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MPNetModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "dtype": "float32",
8
+ "eos_token_id": 2,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-05,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "mpnet",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 1,
20
+ "relative_attention_num_buckets": 32,
21
+ "transformers_version": "4.57.3",
22
+ "vocab_size": 30527
23
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "5.2.0",
4
+ "transformers": "4.57.3",
5
+ "pytorch": "2.5.1+cu124"
6
+ },
7
+ "model_type": "SentenceTransformer",
8
+ "prompts": {
9
+ "query": "",
10
+ "document": ""
11
+ },
12
+ "default_prompt_name": null,
13
+ "similarity_fn_name": "cosine"
14
+ }
config_setfit.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "labels": [
3
+ "skip",
4
+ "keep"
5
+ ]
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3b029ee591192357cfa319dd9c6351bbc9a888b7740912269e0909180805ace
3
+ size 437967672
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fd8f97bf296efb11454e74372526ac4e0720e0e0223767377627235dede8c35
3
+ size 7019
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 512,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "[UNK]",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "104": {
28
+ "content": "[UNK]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "30526": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "<s>",
47
+ "do_basic_tokenize": true,
48
+ "do_lower_case": true,
49
+ "eos_token": "</s>",
50
+ "extra_special_tokens": {},
51
+ "mask_token": "<mask>",
52
+ "model_max_length": 512,
53
+ "never_split": null,
54
+ "pad_token": "<pad>",
55
+ "sep_token": "</s>",
56
+ "strip_accents": null,
57
+ "tokenize_chinese_chars": true,
58
+ "tokenizer_class": "MPNetTokenizer",
59
+ "unk_token": "[UNK]"
60
+ }
training_metadata.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "v0.2.0",
3
+ "base_model": "sentence-transformers/paraphrase-mpnet-base-v2",
4
+ "labels": [
5
+ "skip",
6
+ "keep"
7
+ ],
8
+ "training": {
9
+ "batch_size": 16,
10
+ "num_epochs": 4,
11
+ "num_iterations": 20,
12
+ "body_learning_rate": 2e-05,
13
+ "solver": "liblinear",
14
+ "max_iter": 100,
15
+ "random_seed": 42,
16
+ "data_dir": "data/training/section_filter"
17
+ },
18
+ "test_metrics": {
19
+ "accuracy": 0.8571428571428571,
20
+ "total": 14
21
+ }
22
+ }
version.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ v0.2.0
vocab.txt ADDED
The diff for this file is too large to render. See raw diff