sudheerdunga commited on
Commit
82e7c73
·
verified ·
1 Parent(s): 65df0ab

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": 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,3 +1,189 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: What are the deadlines and deliverables listed in this project plan summary?
9
+ - text: Quickly, just give me the dates and locations mentioned in this travel itinerary.
10
+ - text: Convert this list of configuration parameters into a JSON object. Keys are
11
+ parameter names, values are their settings.
12
+ - text: My GitLab CI/CD pipeline fails at `npm install`. The error log is `[log snippet]`.
13
+ What's wrong?
14
+ - text: 'Three friends, Alice, Bob, and Carol, each have a favorite color: red, blue,
15
+ or green. Alice doesn''t like red. Bob doesn''t like green. The person who likes
16
+ blue is not Carol. Who likes which color?'
17
+ metrics:
18
+ - accuracy
19
+ pipeline_tag: text-classification
20
+ library_name: setfit
21
+ inference: true
22
+ base_model: sentence-transformers/all-MiniLM-L6-v2
23
+ ---
24
+
25
+ # SetFit with sentence-transformers/all-MiniLM-L6-v2
26
+
27
+ 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.
28
+
29
+ The model has been trained using an efficient few-shot learning technique that involves:
30
+
31
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
32
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
33
+
34
+ ## Model Details
35
+
36
+ ### Model Description
37
+ - **Model Type:** SetFit
38
+ - **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
39
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
40
+ - **Maximum Sequence Length:** 256 tokens
41
+ - **Number of Classes:** 4 classes
42
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
43
+ <!-- - **Language:** Unknown -->
44
+ <!-- - **License:** Unknown -->
45
+
46
+ ### Model Sources
47
+
48
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
49
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
50
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
51
+
52
+ ### Model Labels
53
+ | Label | Examples |
54
+ |:------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
55
+ | simple_chat | <ul><li>'What precisely is your nature?'</li><li>'What is your primary function?'</li><li>'Good morning.'</li></ul> |
56
+ | extraction | <ul><li>'Summarize the main benefits of this service based on the provided marketing copy.'</li><li>"Can you just summarize the key findings from this research data list? I don't need all the numbers."</li><li>'Convert this list of configuration parameters into a JSON object. Keys are parameter names, values are their settings.'</li></ul> |
57
+ | reasoning | <ul><li>"What's the best way to pivot our struggling brick-and-mortar bookstore to survive in the digital age?"</li><li>'Develop a decision tree for purchasing a new company car, considering budget, fuel efficiency, maintenance costs, and resale value.'</li><li>"What's 15% of 250?"</li></ul> |
58
+ | coding | <ul><li>'Refactor this C++ legacy code to use `std::unique_ptr` and `std::shared_ptr` instead of raw pointers.'</li><li>'Refactor this spaghetti PHP script to separate business logic, presentation, and data access layers.'</li><li>"What's the fundamental difference between SQL and NoSQL databases, and when should I use each?"</li></ul> |
59
+
60
+ ## Uses
61
+
62
+ ### Direct Use for Inference
63
+
64
+ First install the SetFit library:
65
+
66
+ ```bash
67
+ pip install setfit
68
+ ```
69
+
70
+ Then you can load this model and run inference.
71
+
72
+ ```python
73
+ from setfit import SetFitModel
74
+
75
+ # Download from the 🤗 Hub
76
+ model = SetFitModel.from_pretrained("setfit_model_id")
77
+ # Run inference
78
+ preds = model("What are the deadlines and deliverables listed in this project plan summary?")
79
+ ```
80
+
81
+ <!--
82
+ ### Downstream Use
83
+
84
+ *List how someone could finetune this model on their own dataset.*
85
+ -->
86
+
87
+ <!--
88
+ ### Out-of-Scope Use
89
+
90
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
91
+ -->
92
+
93
+ <!--
94
+ ## Bias, Risks and Limitations
95
+
96
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
97
+ -->
98
+
99
+ <!--
100
+ ### Recommendations
101
+
102
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
103
+ -->
104
+
105
+ ## Training Details
106
+
107
+ ### Training Set Metrics
108
+ | Training set | Min | Median | Max |
109
+ |:-------------|:----|:--------|:----|
110
+ | Word count | 1 | 13.5101 | 41 |
111
+
112
+ | Label | Training Sample Count |
113
+ |:------------|:----------------------|
114
+ | simple_chat | 48 |
115
+ | extraction | 50 |
116
+ | reasoning | 50 |
117
+ | coding | 50 |
118
+
119
+ ### Training Hyperparameters
120
+ - batch_size: (16, 16)
121
+ - num_epochs: (1, 1)
122
+ - max_steps: -1
123
+ - sampling_strategy: oversampling
124
+ - num_iterations: 10
125
+ - body_learning_rate: (2e-05, 1e-05)
126
+ - head_learning_rate: 0.01
127
+ - loss: CosineSimilarityLoss
128
+ - distance_metric: cosine_distance
129
+ - margin: 0.25
130
+ - end_to_end: False
131
+ - use_amp: True
132
+ - warmup_proportion: 0.1
133
+ - l2_weight: 0.01
134
+ - seed: 42
135
+ - evaluation_strategy: no
136
+ - eval_max_steps: -1
137
+ - load_best_model_at_end: False
138
+
139
+ ### Training Results
140
+ | Epoch | Step | Training Loss | Validation Loss |
141
+ |:------:|:----:|:-------------:|:---------------:|
142
+ | 0.0040 | 1 | 0.5538 | - |
143
+ | 0.2016 | 50 | 0.2712 | - |
144
+ | 0.4032 | 100 | 0.1337 | - |
145
+ | 0.6048 | 150 | 0.0604 | - |
146
+ | 0.8065 | 200 | 0.0284 | - |
147
+
148
+ ### Framework Versions
149
+ - Python: 3.9.6
150
+ - SetFit: 1.1.3
151
+ - Sentence Transformers: 5.1.2
152
+ - Transformers: 4.57.6
153
+ - PyTorch: 2.8.0
154
+ - Datasets: 4.5.0
155
+ - Tokenizers: 0.22.1
156
+
157
+ ## Citation
158
+
159
+ ### BibTeX
160
+ ```bibtex
161
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
162
+ doi = {10.48550/ARXIV.2209.11055},
163
+ url = {https://arxiv.org/abs/2209.11055},
164
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
165
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
166
+ title = {Efficient Few-Shot Learning Without Prompts},
167
+ publisher = {arXiv},
168
+ year = {2022},
169
+ copyright = {Creative Commons Attribution 4.0 International}
170
+ }
171
+ ```
172
+
173
+ <!--
174
+ ## Glossary
175
+
176
+ *Clearly define terms in order to be accessible across audiences.*
177
+ -->
178
+
179
+ <!--
180
+ ## Model Card Authors
181
+
182
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
183
+ -->
184
+
185
+ <!--
186
+ ## Model Card Contact
187
+
188
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
189
+ -->
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
+ "dtype": "float32",
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
+ "transformers_version": "4.57.6",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "5.1.2",
4
+ "transformers": "4.57.6",
5
+ "pytorch": "2.8.0"
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,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": false,
3
+ "labels": [
4
+ "simple_chat",
5
+ "extraction",
6
+ "reasoning",
7
+ "coding"
8
+ ]
9
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3629323891903a0ac467a59c86e2c2b77d0cffb91b88ea2b86e5bc7415ee86a3
3
+ size 90864192
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8713d18afbb2227046e03ec989af42673b2e2eb5888b71cdf52817deab495ac
3
+ size 13191
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,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "max_length": 128,
51
+ "model_max_length": 256,
52
+ "never_split": null,
53
+ "pad_to_multiple_of": null,
54
+ "pad_token": "[PAD]",
55
+ "pad_token_type_id": 0,
56
+ "padding_side": "right",
57
+ "sep_token": "[SEP]",
58
+ "stride": 0,
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "BertTokenizer",
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "[UNK]"
65
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff