vgarg commited on
Commit
624bfe5
1 Parent(s): 7752127

Add SetFit model

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
1_Pooling/config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
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: Why is KOF losing share in Cuernavaca Colas MS RET Original?
12
+ - text: Are there any whitespaces in terms of flavor for KOF within CSD Sabores?
13
+ - text: What is the trend of KOF"s market share in Colas SS in Cuernavaca from 2019
14
+ to YTD 2023?
15
+ - text: Which categories have seen the some of the highest Share losses for KOF in
16
+ Cuernavaca in 2022?
17
+ - text: Which Category X Pack can we see the major share gain and which parameters
18
+ are driving the share gain in Cuernavaca?
19
+ pipeline_tag: text-classification
20
+ inference: true
21
+ base_model: intfloat/multilingual-e5-large
22
+ model-index:
23
+ - name: SetFit with intfloat/multilingual-e5-large
24
+ results:
25
+ - task:
26
+ type: text-classification
27
+ name: Text Classification
28
+ dataset:
29
+ name: Unknown
30
+ type: unknown
31
+ split: test
32
+ metrics:
33
+ - type: accuracy
34
+ value: 0.25
35
+ name: Accuracy
36
+ ---
37
+
38
+ # SetFit with intfloat/multilingual-e5-large
39
+
40
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [intfloat/multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large) 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.
41
+
42
+ The model has been trained using an efficient few-shot learning technique that involves:
43
+
44
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
45
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
46
+
47
+ ## Model Details
48
+
49
+ ### Model Description
50
+ - **Model Type:** SetFit
51
+ - **Sentence Transformer body:** [intfloat/multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large)
52
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
53
+ - **Maximum Sequence Length:** 512 tokens
54
+ - **Number of Classes:** 12 classes
55
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
56
+ <!-- - **Language:** Unknown -->
57
+ <!-- - **License:** Unknown -->
58
+
59
+ ### Model Sources
60
+
61
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
62
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
63
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
64
+
65
+ ### Model Labels
66
+ | Label | Examples |
67
+ |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
68
+ | 6 | <ul><li>'Are there any major whitespace opportunity in terms of Categories x Pack Segments in Cuernavaca?'</li><li>'In Colas MS which packsegment is not dominated by KOF in TT HM Orizaba 2022? At what price point we can launch an offering'</li><li>'I want to launch a new pack type in csd for kof. Tell me what'</li></ul> |
69
+ | 2 | <ul><li>"Do any seasonal patterns exist in Jumex's share change in Orizaba?"</li><li>'What is the Market share for Resto in colas MS at each size groups in TT HM Orizaba in 2022'</li><li>'Which categories have seen the some of the highest Share losses for KOF in Cuernavaca in FY22-21?'</li></ul> |
70
+ | 0 | <ul><li>'Which packs have driven the shares for the competition in Colas in FY 21-22?'</li><li>'Apart from Jugos + Néctares, Which are the top contributing categoriesXconsumo to the share loss for Jumex in Orizaba in 2021?'</li><li>'which pack segment is contributing most to share change for Resto in Orizaba NCBs in 2022'</li></ul> |
71
+ | 10 | <ul><li>'Which pack segment shows opportunities to drive my market share in NCBS Colas SS?'</li><li>'What are my priority pack segments to gain share in NCB Colas SS?'</li><li>'What are my priority pack segments to gain share in AGUA Colas SS?'</li></ul> |
72
+ | 5 | <ul><li>'Where should I play in terms\xa0of flavor in Sabores SS?'</li><li>'I want to launch flavored water in onion flavor for kof.'</li><li>'What areas should I focus on to grow my market presence?'</li></ul> |
73
+ | 7 | <ul><li>'Is Fanta a premium brand? How premium are its offerings as compared to other brands in Sabores?'</li><li>"Is there potential for PPL correction in the packaging and pricing strategy of Tropicana's fruit juice offerings within the Juice category?"</li><li>'Is there an opportunity to premiumize any offerings for coca-cola?'</li></ul> |
74
+ | 9 | <ul><li>'Which industries to prioritize to gain share in AGUA in Cuernavaca?'</li><li>'What measures can be taken to maximize headroom in the AGUA market?'</li><li>'How much headroom do I have in CSDS'</li></ul> |
75
+ | 11 | <ul><li>'How can I gain share in NCBS?'</li><li>'How should KOF gain share in Colas MS in Cuernavaca? '</li><li>'How can I gain share in CSD Colas MS in Cuernavaca'</li></ul> |
76
+ | 8 | <ul><li>'Category wise market share'</li><li>'What is the ND, WD of KOF in colas'</li><li>'Tell me the top 10 SKUs in colas'</li></ul> |
77
+ | 3 | <ul><li>'What is the difference in offerings for KOF vs the key competitors in xx price bracket within CSD Colas in TT HM?'</li><li>'How should KOF gain share in <10 price bracket for NCB in TT HM'</li><li>'Which price points to play in?'</li></ul> |
78
+ | 1 | <ul><li>'what factors contributed to share change for agua?'</li><li>'Why is Resto losing share in Cuernavaca Colas SS RET Original?'</li><li>'What are the main factors contributing to the share gain of Jumex in Still Drinks MS in Orizaba for FY 2022?'</li></ul> |
79
+ | 4 | <ul><li>'How has the csd industry evolved in the last two years?'</li><li>'Tell me the categories to focus on, for driving growth in future'</li><li>'What is the change in industry mix for coca-cola in TT HM Orizaba in 2021 to 2022'</li></ul> |
80
+
81
+ ## Evaluation
82
+
83
+ ### Metrics
84
+ | Label | Accuracy |
85
+ |:--------|:---------|
86
+ | **all** | 0.25 |
87
+
88
+ ## Uses
89
+
90
+ ### Direct Use for Inference
91
+
92
+ First install the SetFit library:
93
+
94
+ ```bash
95
+ pip install setfit
96
+ ```
97
+
98
+ Then you can load this model and run inference.
99
+
100
+ ```python
101
+ from setfit import SetFitModel
102
+
103
+ # Download from the 🤗 Hub
104
+ model = SetFitModel.from_pretrained("vgarg/fw_identification_model_e5_large_v5_14_02_24")
105
+ # Run inference
106
+ preds = model("Why is KOF losing share in Cuernavaca Colas MS RET Original?")
107
+ ```
108
+
109
+ <!--
110
+ ### Downstream Use
111
+
112
+ *List how someone could finetune this model on their own dataset.*
113
+ -->
114
+
115
+ <!--
116
+ ### Out-of-Scope Use
117
+
118
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
119
+ -->
120
+
121
+ <!--
122
+ ## Bias, Risks and Limitations
123
+
124
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
125
+ -->
126
+
127
+ <!--
128
+ ### Recommendations
129
+
130
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
131
+ -->
132
+
133
+ ## Training Details
134
+
135
+ ### Training Set Metrics
136
+ | Training set | Min | Median | Max |
137
+ |:-------------|:----|:--------|:----|
138
+ | Word count | 4 | 13.5351 | 28 |
139
+
140
+ | Label | Training Sample Count |
141
+ |:------|:----------------------|
142
+ | 0 | 10 |
143
+ | 1 | 10 |
144
+ | 2 | 10 |
145
+ | 3 | 8 |
146
+ | 4 | 10 |
147
+ | 5 | 10 |
148
+ | 6 | 10 |
149
+ | 7 | 10 |
150
+ | 8 | 10 |
151
+ | 9 | 10 |
152
+ | 10 | 10 |
153
+ | 11 | 6 |
154
+
155
+ ### Training Hyperparameters
156
+ - batch_size: (16, 16)
157
+ - num_epochs: (3, 3)
158
+ - max_steps: -1
159
+ - sampling_strategy: oversampling
160
+ - num_iterations: 20
161
+ - body_learning_rate: (2e-05, 2e-05)
162
+ - head_learning_rate: 2e-05
163
+ - loss: CosineSimilarityLoss
164
+ - distance_metric: cosine_distance
165
+ - margin: 0.25
166
+ - end_to_end: False
167
+ - use_amp: False
168
+ - warmup_proportion: 0.1
169
+ - seed: 42
170
+ - eval_max_steps: -1
171
+ - load_best_model_at_end: False
172
+
173
+ ### Training Results
174
+ | Epoch | Step | Training Loss | Validation Loss |
175
+ |:------:|:----:|:-------------:|:---------------:|
176
+ | 0.0035 | 1 | 0.3481 | - |
177
+ | 0.1754 | 50 | 0.1442 | - |
178
+ | 0.3509 | 100 | 0.091 | - |
179
+ | 0.5263 | 150 | 0.0089 | - |
180
+ | 0.7018 | 200 | 0.0038 | - |
181
+ | 0.8772 | 250 | 0.0018 | - |
182
+ | 1.0526 | 300 | 0.001 | - |
183
+ | 1.2281 | 350 | 0.0012 | - |
184
+ | 1.4035 | 400 | 0.0007 | - |
185
+ | 1.5789 | 450 | 0.0007 | - |
186
+ | 1.7544 | 500 | 0.0004 | - |
187
+ | 1.9298 | 550 | 0.0005 | - |
188
+ | 2.1053 | 600 | 0.0006 | - |
189
+ | 2.2807 | 650 | 0.0005 | - |
190
+ | 2.4561 | 700 | 0.0006 | - |
191
+ | 2.6316 | 750 | 0.0004 | - |
192
+ | 2.8070 | 800 | 0.0004 | - |
193
+ | 2.9825 | 850 | 0.0004 | - |
194
+
195
+ ### Framework Versions
196
+ - Python: 3.10.12
197
+ - SetFit: 1.0.3
198
+ - Sentence Transformers: 2.3.1
199
+ - Transformers: 4.35.2
200
+ - PyTorch: 2.1.0+cu121
201
+ - Datasets: 2.17.0
202
+ - Tokenizers: 0.15.1
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,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "intfloat/multilingual-e5-large",
3
+ "architectures": [
4
+ "XLMRobertaModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 4096,
15
+ "layer_norm_eps": 1e-05,
16
+ "max_position_embeddings": 514,
17
+ "model_type": "xlm-roberta",
18
+ "num_attention_heads": 16,
19
+ "num_hidden_layers": 24,
20
+ "output_past": true,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.35.2",
25
+ "type_vocab_size": 1,
26
+ "use_cache": true,
27
+ "vocab_size": 250002
28
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.3.1",
4
+ "transformers": "4.35.2",
5
+ "pytorch": "2.1.0+cu121"
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:8dc9b2039f94ba30877feb42d5dbafb3ba9ee2dfaba88e6f06f643089a77e3ab
3
+ size 2239607176
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbeca4f713060257f4bde6335d369dfd9167f78f6edb446d09ef4245c71e6961
3
+ size 99335
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": false
4
+ }
sentencepiece.bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
3
+ size 5069051
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1cc44ad7faaeec47241864835473fd5403f2da94673f3f764a77ebcb0a803ec
3
+ size 17083009
tokenizer_config.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
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": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "mask_token": "<mask>",
49
+ "model_max_length": 512,
50
+ "pad_token": "<pad>",
51
+ "sep_token": "</s>",
52
+ "tokenizer_class": "XLMRobertaTokenizer",
53
+ "unk_token": "<unk>"
54
+ }