MykhailoS commited on
Commit
df2e1b6
·
verified ·
1 Parent(s): b380ae2

Initial model upload

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
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
+ "include_prompt": true
10
+ }
README.md CHANGED
@@ -1,11 +1,211 @@
1
  ---
2
- license: mit
3
- language:
4
- - en
5
- pipeline_tag: text-classification
6
  tags:
7
- - llm
8
- - router
9
- base_model:
10
- - sentence-transformers/paraphrase-MiniLM-L6-v2
11
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
 
 
 
2
  tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Write a 1000-word essay on the history of the Roman Empire.
9
+ - text: Tell a two-sentence horror story involving a smart fridge.
10
+ - text: Compare the economic policies of Keynesianism and Monetarism in 250 words.
11
+ - text: Explain the difference between HTTP and HTTPS
12
+ - text: Write a SQL stored procedure to handle GDPR data deletion requests
13
+ metrics:
14
+ - f1
15
+ pipeline_tag: text-classification
16
+ library_name: setfit
17
+ inference: true
18
+ base_model: sentence-transformers/paraphrase-MiniLM-L6-v2
19
+ model-index:
20
+ - name: SetFit with sentence-transformers/paraphrase-MiniLM-L6-v2
21
+ results:
22
+ - task:
23
+ type: text-classification
24
+ name: Text Classification
25
+ dataset:
26
+ name: Unknown
27
+ type: unknown
28
+ split: test
29
+ metrics:
30
+ - type: f1
31
+ value: 1.0
32
+ name: F1
33
+ ---
34
+
35
+ # SetFit with sentence-transformers/paraphrase-MiniLM-L6-v2
36
+
37
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/paraphrase-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.
38
+
39
+ The model has been trained using an efficient few-shot learning technique that involves:
40
+
41
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
42
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
43
+
44
+ ## Model Details
45
+
46
+ ### Model Description
47
+ - **Model Type:** SetFit
48
+ - **Sentence Transformer body:** [sentence-transformers/paraphrase-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/paraphrase-MiniLM-L6-v2)
49
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
50
+ - **Maximum Sequence Length:** 128 tokens
51
+ - **Number of Classes:** 3 classes
52
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
53
+ <!-- - **Language:** Unknown -->
54
+ <!-- - **License:** Unknown -->
55
+
56
+ ### Model Sources
57
+
58
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
59
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
60
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
61
+
62
+ ### Model Labels
63
+ | Label | Examples |
64
+ |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
65
+ | 1 | <ul><li>'Draft a polite email to reschedule a meeting'</li><li>"Translate the phrase 'The quick brown fox jumps over the lazy dog' into Mandarin, French, and German."</li><li>'Write a short story (under 200 words) about a robot discovering nature.'</li></ul> |
66
+ | 0 | <ul><li>'Analyze the ethical implications of CRISPR gene editing'</li><li>'Debug this Python multiprocessing code deadlock: [code snippet]'</li><li>'Implement a Python async websocket client with error handling'</li></ul> |
67
+ | 2 | <ul><li>"Python syntax to print 'Hello World'"</li><li>'What is 2+2?'</li><li>'Who is the current president of the United States?'</li></ul> |
68
+
69
+ ## Evaluation
70
+
71
+ ### Metrics
72
+ | Label | F1 |
73
+ |:--------|:----|
74
+ | **all** | 1.0 |
75
+
76
+ ## Uses
77
+
78
+ ### Direct Use for Inference
79
+
80
+ First install the SetFit library:
81
+
82
+ ```bash
83
+ pip install setfit
84
+ ```
85
+
86
+ Then you can load this model and run inference.
87
+
88
+ ```python
89
+ from setfit import SetFitModel
90
+
91
+ # Download from the 🤗 Hub
92
+ model = SetFitModel.from_pretrained("setfit_model_id")
93
+ # Run inference
94
+ preds = model("Explain the difference between HTTP and HTTPS")
95
+ ```
96
+
97
+ <!--
98
+ ### Downstream Use
99
+
100
+ *List how someone could finetune this model on their own dataset.*
101
+ -->
102
+
103
+ <!--
104
+ ### Out-of-Scope Use
105
+
106
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
107
+ -->
108
+
109
+ <!--
110
+ ## Bias, Risks and Limitations
111
+
112
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
113
+ -->
114
+
115
+ <!--
116
+ ### Recommendations
117
+
118
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
119
+ -->
120
+
121
+ ## Training Details
122
+
123
+ ### Training Set Metrics
124
+ | Training set | Min | Median | Max |
125
+ |:-------------|:----|:-------|:----|
126
+ | Word count | 3 | 8.9583 | 17 |
127
+
128
+ | Label | Training Sample Count |
129
+ |:------|:----------------------|
130
+ | 0 | 8 |
131
+ | 1 | 8 |
132
+ | 2 | 8 |
133
+
134
+ ### Training Hyperparameters
135
+ - batch_size: (8, 8)
136
+ - num_epochs: (3, 3)
137
+ - max_steps: -1
138
+ - sampling_strategy: oversampling
139
+ - num_iterations: 20
140
+ - body_learning_rate: (1e-05, 1e-05)
141
+ - head_learning_rate: 0.001
142
+ - loss: CosineSimilarityLoss
143
+ - distance_metric: cosine_distance
144
+ - margin: 0.25
145
+ - end_to_end: True
146
+ - use_amp: False
147
+ - warmup_proportion: 0.1
148
+ - l2_weight: 0.01
149
+ - max_length: 384
150
+ - seed: 42
151
+ - evaluation_strategy: epoch
152
+ - eval_max_steps: -1
153
+ - load_best_model_at_end: True
154
+
155
+ ### Training Results
156
+ | Epoch | Step | Training Loss | Validation Loss |
157
+ |:------:|:----:|:-------------:|:---------------:|
158
+ | 0.0083 | 1 | 0.4046 | - |
159
+ | 0.4167 | 50 | 0.2913 | - |
160
+ | 0.8333 | 100 | 0.1724 | - |
161
+ | 1.0 | 120 | - | 0.1897 |
162
+ | 1.25 | 150 | 0.0825 | - |
163
+ | 1.6667 | 200 | 0.0284 | - |
164
+ | 2.0 | 240 | - | 0.1806 |
165
+ | 2.0833 | 250 | 0.0137 | - |
166
+ | 2.5 | 300 | 0.0089 | - |
167
+ | 2.9167 | 350 | 0.007 | - |
168
+ | 3.0 | 360 | - | 0.1806 |
169
+
170
+ ### Framework Versions
171
+ - Python: 3.11.13
172
+ - SetFit: 1.1.2
173
+ - Sentence Transformers: 3.3.1
174
+ - Transformers: 4.53.3
175
+ - PyTorch: 2.7.1
176
+ - Datasets: 3.0.0
177
+ - Tokenizers: 0.21.2
178
+
179
+ ## Citation
180
+
181
+ ### BibTeX
182
+ ```bibtex
183
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
184
+ doi = {10.48550/ARXIV.2209.11055},
185
+ url = {https://arxiv.org/abs/2209.11055},
186
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
187
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
188
+ title = {Efficient Few-Shot Learning Without Prompts},
189
+ publisher = {arXiv},
190
+ year = {2022},
191
+ copyright = {Creative Commons Attribution 4.0 International}
192
+ }
193
+ ```
194
+
195
+ <!--
196
+ ## Glossary
197
+
198
+ *Clearly define terms in order to be accessible across audiences.*
199
+ -->
200
+
201
+ <!--
202
+ ## Model Card Authors
203
+
204
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
205
+ -->
206
+
207
+ <!--
208
+ ## Model Card Contact
209
+
210
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
211
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "gradient_checkpointing": false,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 384,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 1536,
13
+ "layer_norm_eps": 1e-12,
14
+ "max_position_embeddings": 512,
15
+ "model_type": "bert",
16
+ "num_attention_heads": 12,
17
+ "num_hidden_layers": 6,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.53.3",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.3.1",
4
+ "transformers": "4.53.3",
5
+ "pytorch": "2.7.1"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
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:536bd357d4117276e3ed6b3ff5713bf037a5b6097294b87ed2a3ab42c6affc0c
3
+ size 90864192
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:588dd2a6bc3c488a21b4d048ef6b8fe12f2aaf23c158ea9f3de8b066d444aab4
3
+ size 10111
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": 128,
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,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": false,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "model_max_length": 128,
51
+ "never_split": null,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "strip_accents": null,
55
+ "tokenize_chinese_chars": true,
56
+ "tokenizer_class": "BertTokenizer",
57
+ "unk_token": "[UNK]"
58
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff