rbojja commited on
Commit
f898d6a
·
verified ·
1 Parent(s): 4eaf5a3

Push model using huggingface_hub.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 384,
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,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: '"I think this might be the solution."'
9
+ - text: '"Oh no, I apologize!"'
10
+ - text: Could you repeat that, please?
11
+ - text: Oh, this is so disappointing.
12
+ - text: Uhh, clear.
13
+ metrics:
14
+ - accuracy
15
+ pipeline_tag: text-classification
16
+ library_name: setfit
17
+ inference: true
18
+ datasets:
19
+ - rbojja/zero-shot-intent-classification
20
+ base_model: BAAI/bge-small-en-v1.5
21
+ ---
22
+
23
+ # SetFit with BAAI/bge-small-en-v1.5
24
+
25
+ This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [rbojja/zero-shot-intent-classification](https://huggingface.co/datasets/rbojja/zero-shot-intent-classification) dataset that can be used for Text Classification. This SetFit model uses [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-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.
26
+
27
+ The model has been trained using an efficient few-shot learning technique that involves:
28
+
29
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
30
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
31
+
32
+ ## Model Details
33
+
34
+ ### Model Description
35
+ - **Model Type:** SetFit
36
+ - **Sentence Transformer body:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
37
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
38
+ - **Maximum Sequence Length:** 512 tokens
39
+ - **Number of Classes:** 18 classes
40
+ - **Training Dataset:** [rbojja/zero-shot-intent-classification](https://huggingface.co/datasets/rbojja/zero-shot-intent-classification)
41
+ <!-- - **Language:** Unknown -->
42
+ <!-- - **License:** Unknown -->
43
+
44
+ ### Model Sources
45
+
46
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
47
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
48
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
49
+
50
+ ### Model Labels
51
+ | Label | Examples |
52
+ |:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------|
53
+ | 7 | <ul><li>'Oh my, this is great!'</li><li>'Oh, this is fantastic!'</li><li>'Hmm, I’m so delighted!'</li></ul> |
54
+ | 3 | <ul><li>"Oh, absolutely, that's it!"</li><li>"Oh, absolutely, that's it!"</li><li>"Yep, that's exactly what I meant."</li></ul> |
55
+ | 15 | <ul><li>'Really, no way?'</li><li>'Oh, that’s quite something!'</li><li>'Oh, that’s quite something!'</li></ul> |
56
+ | 8 | <ul><li>"Gotcha... oh, that's clear!"</li><li>'Hmm, I see... perfect!'</li><li>'Oh, I see... clear!'</li></ul> |
57
+ | 12 | <ul><li>'Uhh, fine.'</li><li>'Oh, clear.'</li><li>'Uhh, noted.'</li></ul> |
58
+ | 9 | <ul><li>'Uhh, take care!'</li><li>'Hmm, see you!'</li><li>'Uhh, see you!'</li></ul> |
59
+ | 17 | <ul><li>'"Umm, this could be a decent plan."'</li><li>'"I think this might be the solution."'</li><li>'"Maybe this will work out, I suppose."'</li></ul> |
60
+ | 0 | <ul><li>"Why can't you just work?!"</li><li>'Seriously, this is a joke!'</li><li>'Ugh, this is so frustrating!'</li></ul> |
61
+ | 6 | <ul><li>'"Oh, what if I\'m a dream?"'</li><li>'"Oh, do you speak dolphin?"'</li><li>'"Uhh, do you have a wish?"'</li></ul> |
62
+ | 11 | <ul><li>"Uh-huh, that's a valid point."</li><li>'Like, I get it.'</li><li>'Right, I understand.'</li></ul> |
63
+ | 16 | <ul><li>'Thank you!'</li><li>'"Hmmm, thanks, you\'re great!"'</li><li>'"Oh, fantastic, thanks a lot!"'</li></ul> |
64
+ | 4 | <ul><li>"Sorry, I'm not sure."</li><li>"Well, I'm lost."</li><li>"Hmm, I'm not sure."</li></ul> |
65
+ | 10 | <ul><li>'Oh, hi!'</li><li>"Hello! What's new?"</li><li>"Hi! How's life?"</li></ul> |
66
+ | 13 | <ul><li>'Oh, gotcha.'</li><li>'Hmmm, okay.'</li><li>'Alright, thanks.'</li></ul> |
67
+ | 2 | <ul><li>'What’s the context behind that?'</li><li>'Could you simplify that for me?'</li><li>'Can you explain that concept?'</li></ul> |
68
+ | 1 | <ul><li>'"Oh, I didn’t mean to."'</li><li>'"Oops, sorry for the oversight."'</li><li>'"Oops, I’m really sorry."'</li></ul> |
69
+ | 5 | <ul><li>'Oh, this is not what I wanted.'</li><li>'Oh no, this is not right.'</li><li>'Seriously, this is a failure.'</li></ul> |
70
+ | 14 | <ul><li>'Uhh, superb choice!'</li><li>'Uhh, amazing decision!'</li><li>'Oh, superb performance!'</li></ul> |
71
+
72
+ ## Uses
73
+
74
+ ### Direct Use for Inference
75
+
76
+ First install the SetFit library:
77
+
78
+ ```bash
79
+ pip install setfit
80
+ ```
81
+
82
+ Then you can load this model and run inference.
83
+
84
+ ```python
85
+ from setfit import SetFitModel
86
+
87
+ # Download from the 🤗 Hub
88
+ model = SetFitModel.from_pretrained("rbojja/intent-classification-small")
89
+ # Run inference
90
+ preds = model("Uhh, clear.")
91
+ ```
92
+
93
+ <!--
94
+ ### Downstream Use
95
+
96
+ *List how someone could finetune this model on their own dataset.*
97
+ -->
98
+
99
+ <!--
100
+ ### Out-of-Scope Use
101
+
102
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
103
+ -->
104
+
105
+ <!--
106
+ ## Bias, Risks and Limitations
107
+
108
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
109
+ -->
110
+
111
+ <!--
112
+ ### Recommendations
113
+
114
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
115
+ -->
116
+
117
+ ## Training Details
118
+
119
+ ### Training Set Metrics
120
+ | Training set | Min | Median | Max |
121
+ |:-------------|:----|:-------|:----|
122
+ | Word count | 2 | 4.2224 | 9 |
123
+
124
+ | Label | Training Sample Count |
125
+ |:------|:----------------------|
126
+ | 0 | 40 |
127
+ | 1 | 40 |
128
+ | 2 | 37 |
129
+ | 3 | 40 |
130
+ | 4 | 41 |
131
+ | 5 | 38 |
132
+ | 6 | 42 |
133
+ | 7 | 38 |
134
+ | 8 | 35 |
135
+ | 9 | 39 |
136
+ | 10 | 42 |
137
+ | 11 | 41 |
138
+ | 12 | 42 |
139
+ | 13 | 44 |
140
+ | 14 | 38 |
141
+ | 15 | 43 |
142
+ | 16 | 47 |
143
+ | 17 | 37 |
144
+
145
+ ### Training Hyperparameters
146
+ - batch_size: (16, 2)
147
+ - num_epochs: (1, 16)
148
+ - max_steps: -1
149
+ - sampling_strategy: oversampling
150
+ - num_iterations: 20
151
+ - body_learning_rate: (2e-05, 1e-05)
152
+ - head_learning_rate: 0.01
153
+ - loss: CosineSimilarityLoss
154
+ - distance_metric: cosine_distance
155
+ - margin: 0.25
156
+ - end_to_end: False
157
+ - use_amp: False
158
+ - warmup_proportion: 0.1
159
+ - l2_weight: 0.01
160
+ - seed: 42
161
+ - eval_max_steps: -1
162
+ - load_best_model_at_end: False
163
+
164
+ ### Training Results
165
+ | Epoch | Step | Training Loss | Validation Loss |
166
+ |:------:|:----:|:-------------:|:---------------:|
167
+ | 0.0006 | 1 | 0.149 | - |
168
+ | 0.0276 | 50 | 0.1836 | - |
169
+ | 0.0552 | 100 | 0.1408 | - |
170
+ | 0.0829 | 150 | 0.0978 | - |
171
+ | 0.1105 | 200 | 0.0805 | - |
172
+ | 0.1381 | 250 | 0.0684 | - |
173
+ | 0.1657 | 300 | 0.0594 | - |
174
+ | 0.1934 | 350 | 0.051 | - |
175
+ | 0.2210 | 400 | 0.0383 | - |
176
+ | 0.2486 | 450 | 0.0379 | - |
177
+ | 0.2762 | 500 | 0.035 | - |
178
+ | 0.3039 | 550 | 0.0334 | - |
179
+ | 0.3315 | 600 | 0.0306 | - |
180
+ | 0.3591 | 650 | 0.0266 | - |
181
+ | 0.3867 | 700 | 0.0264 | - |
182
+ | 0.4144 | 750 | 0.018 | - |
183
+ | 0.4420 | 800 | 0.0193 | - |
184
+ | 0.4696 | 850 | 0.0166 | - |
185
+ | 0.4972 | 900 | 0.0165 | - |
186
+ | 0.5249 | 950 | 0.016 | - |
187
+ | 0.5525 | 1000 | 0.0177 | - |
188
+ | 0.5801 | 1050 | 0.0202 | - |
189
+ | 0.6077 | 1100 | 0.0133 | - |
190
+ | 0.6354 | 1150 | 0.014 | - |
191
+ | 0.6630 | 1200 | 0.013 | - |
192
+ | 0.6906 | 1250 | 0.0161 | - |
193
+ | 0.7182 | 1300 | 0.0119 | - |
194
+ | 0.7459 | 1350 | 0.0132 | - |
195
+ | 0.7735 | 1400 | 0.0131 | - |
196
+ | 0.8011 | 1450 | 0.0123 | - |
197
+ | 0.8287 | 1500 | 0.0115 | - |
198
+ | 0.8564 | 1550 | 0.0111 | - |
199
+ | 0.8840 | 1600 | 0.011 | - |
200
+ | 0.9116 | 1650 | 0.01 | - |
201
+ | 0.9392 | 1700 | 0.0098 | - |
202
+ | 0.9669 | 1750 | 0.0142 | - |
203
+ | 0.9945 | 1800 | 0.0132 | - |
204
+
205
+ ### Framework Versions
206
+ - Python: 3.11.11
207
+ - SetFit: 1.1.1
208
+ - Sentence Transformers: 3.3.1
209
+ - Transformers: 4.47.1
210
+ - PyTorch: 2.5.1+cu121
211
+ - Datasets: 3.2.0
212
+ - Tokenizers: 0.21.0
213
+
214
+ ## Citation
215
+
216
+ ### BibTeX
217
+ ```bibtex
218
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
219
+ doi = {10.48550/ARXIV.2209.11055},
220
+ url = {https://arxiv.org/abs/2209.11055},
221
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
222
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
223
+ title = {Efficient Few-Shot Learning Without Prompts},
224
+ publisher = {arXiv},
225
+ year = {2022},
226
+ copyright = {Creative Commons Attribution 4.0 International}
227
+ }
228
+ ```
229
+
230
+ <!--
231
+ ## Glossary
232
+
233
+ *Clearly define terms in order to be accessible across audiences.*
234
+ -->
235
+
236
+ <!--
237
+ ## Model Card Authors
238
+
239
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
240
+ -->
241
+
242
+ <!--
243
+ ## Model Card Contact
244
+
245
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
246
+ -->
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BAAI/bge-small-en-v1.5",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 384,
11
+ "id2label": {
12
+ "0": "LABEL_0"
13
+ },
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 1536,
16
+ "label2id": {
17
+ "LABEL_0": 0
18
+ },
19
+ "layer_norm_eps": 1e-12,
20
+ "max_position_embeddings": 512,
21
+ "model_type": "bert",
22
+ "num_attention_heads": 12,
23
+ "num_hidden_layers": 12,
24
+ "pad_token_id": 0,
25
+ "position_embedding_type": "absolute",
26
+ "torch_dtype": "float32",
27
+ "transformers_version": "4.47.1",
28
+ "type_vocab_size": 2,
29
+ "use_cache": true,
30
+ "vocab_size": 30522
31
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.3.1",
4
+ "transformers": "4.47.1",
5
+ "pytorch": "2.5.1+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
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:10aae658e3cab6ea00cd4eae39769d51c9427f62aee94794bc665c319f1607b7
3
+ size 133462128
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae45b37b0ebad7d90a40be70afa791ce398a699c2af10ae45445f4abbcdc8350
3
+ size 56423
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,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": true,
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": 512,
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