mann2107 commited on
Commit
0c3f704
1 Parent(s): 143ad36

Add SetFit model

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
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
+ }
README.md ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: setfit
3
+ tags:
4
+ - setfit
5
+ - sentence-transformers
6
+ - text-classification
7
+ - generated_from_setfit_trainer
8
+ base_model: sentence-transformers/paraphrase-mpnet-base-v2
9
+ metrics:
10
+ - accuracy
11
+ widget:
12
+ - text: Thank you for your email. Please go ahead and issue. Please invoice in KES
13
+ - text: Hi, We are missing some invoices, can you please provide it. 02 - 12 - 2020
14
+ AGENT FEE 8900784339018 $21.00 02 - 19 - 2020 AGENT FEE 0017417554160 $22.00 02
15
+ - 19 - 2020 AGENT FEE 0017417554143 $22.00 02 - 19 - 2020 AGENT FEE 8900783383420
16
+ $21.00
17
+ - text: I have reported this in November and not only was the trip supposed to be
18
+ cancelled and credited I was double billed and the billing has not been corrected.
19
+ The total credit should be $667.20. Please confirm this will be done.
20
+ - text: As promised, kindly send the ticket. Dr Ntlatlapa wants to plan for a meeting
21
+ while in Durban.
22
+ - text: Amy Pengidore had planned to travel from Washington, DC to Chicago, IL next
23
+ week and due to the coronavirus concerns we are looking to re-schedule her trip
24
+ for a future date. She had airfare, car rental, and hotel scheduled and was to
25
+ leave this Sunday, March 15th. Can you please direct us on what needs to be done
26
+ to make changes?
27
+ pipeline_tag: text-classification
28
+ inference: true
29
+ ---
30
+
31
+ # SetFit with sentence-transformers/paraphrase-mpnet-base-v2
32
+
33
+ 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 [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance is used for classification.
34
+
35
+ The model has been trained using an efficient few-shot learning technique that involves:
36
+
37
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
38
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
39
+
40
+ ## Model Details
41
+
42
+ ### Model Description
43
+ - **Model Type:** SetFit
44
+ - **Sentence Transformer body:** [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
45
+ - **Classification head:** a [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance
46
+ - **Maximum Sequence Length:** 512 tokens
47
+ - **Number of Classes:** 9 classes
48
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
49
+ <!-- - **Language:** Unknown -->
50
+ <!-- - **License:** Unknown -->
51
+
52
+ ### Model Sources
53
+
54
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
55
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
56
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
57
+
58
+ ### Model Labels
59
+ | Label | Examples |
60
+ |:------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
61
+ | 0 | <ul><li>'Please send me quotation for a flight for Lindelani Mkhize - East London/ Durban 31 August @ 12:00'</li><li>'I need to go to Fort Smith AR via XNA for PD days. I d like to take AA 4064 at 10:00 am arriving 11:58 am on Monday, May 11 returning on AA 4064 at 12:26 pm arriving 2:16 pm on Saturday May 16. I will need a Hertz rental. I d like to stay at the Courtyard Marriott in Fort Smith on Monday through Thursday nights checking out on Friday morning. Then I d like to stay at the Hilton Garden Inn in Bentonville AR on Walton Road Friday night checking out Saturday morning.'</li><li>'I am planning to attend a Training in to be held between Nov 22-24 2023 at Avon, France (Specific address is Corning, 7 Bis Av. de Valvins, 77210 Avon, France) I have to arrive in France on the 21st of Nov and leave on the 25th of Nov. May you please help me with the travel itinerary and accommodation quotation (within walking distance preferably), transport in France to the hotel from the airport and back. I would like to put in an overseas travel request.'</li></ul> |
62
+ | 1 | <ul><li>"Hello, Can someone help to cancel my trip in Concur? I'm unable to do it in the system. Trip from San Francisco to Minneapolis/St Paul (MDFNTI)<https://www.concursolutions.com/travelportal/triplibrary.asp>"</li><li>'Please cancel my flight for late March to Chicago and DC. Meetings have been cancelled. I am not available by phone.'</li><li>'I need to cancel the below trip due to illness in family. Could you please assist with this?'</li></ul> |
63
+ | 2 | <ul><li>'I have a travel booking question. I booked a flight for myself & a coworker, however, it was requested that we leave a couple days earlier than planned. How can I revise/move our first flight up without cancelling the whole trip? The flights home will remain the same.'</li><li>'I just received my KTN today and added it to my profile. However, I have flights in Nov booked with United and Delta. Any way to add the KTN to those reservations so the tickets come through with Pre-Check?'</li><li>"Lerato I checked Selbourne B/B, its not a nice place. Your colleague Stella booked Lindelani Mkhize in Hempston it's a beautiful place next to Garden Court, please change the accommodation from Selbourne to Hempston. This Selbourne is on the outskirt and my colleagues are not familiar with East London"</li></ul> |
64
+ | 3 | <ul><li>'Please add the below employee to our Concur system. In addition, make sure the Ghost Card is added into their profile. Lindsay Griffin [email protected]'</li><li>"Good afternoon - CAEP has 4 new staff members that we'd like to set - up new user profiles for. Please see the below information and let me know should anything additional be required. Last First Middle Travel Class Email Gender DOB Graham Rose - Helen Xiuqing Staff rose - [email protected] Female 6/14/1995 Gumbs Mary - Frances Akua Staff [email protected] Female 10/18/1995 Lee Elizabeth Andie Staff [email protected] Female 4/23/1991 Gilchrist Gabriel Jake Staff [email protected] Male"</li><li>'Good Morning, Please create a profile for Amelia West: Name: Amelia Jean - Danielle West DOB: 05/21/1987 PH: 202 - 997 - 6592 Email: [email protected]'</li></ul> |
65
+ | 4 | <ul><li>'Invoices October 2019 Hi, My name is Lucia De Las Heras property accountant at Trion Properties. I am missing a few receipts to allocate the following charges. Would you please be able to provide a detailed invoice? 10/10/2019 FROSCH/GANT TRAVEL MBLOOMINGTON IN - 21'</li><li>'I would like to request an invoice/s for the above-mentioned employee who stayed at your establishment. Thank you for the other invoice August 2023 & the confirmation for the new reservation 01st - 04th October 2023, Thanking you in Advance!'</li><li>"Hello, Looking for an invoice for the below charge to Ryan Schulke's card - could you please assist? Vendor: United Airlines Transaction Date: 02/04/2020 Amount: $2,132.07 Ticket Number: 0167515692834"</li></ul> |
66
+ | 5 | <ul><li>'This is the second email with this trip, but I still need an itinerary for trip scheduled for January 27. Derek'</li><li>'Please send us all the flights used by G4S Kenya in the year 2022. Sorry for the short notice but we need the information by 12:00 noon today.'</li><li>'Jen Holt Can you please send me the itinerary for Jen Holt for this trip this week to Jackson Mississippi?'</li></ul> |
67
+ | 6 | <ul><li>"I've had to call off my vacation. What are my options for getting refunded?"</li><li>"Looks like I won't be traveling due to some health issues. Is getting a refund for my booking possible?"</li><li>"I've fallen ill and can't travel as planned. Can you process a refund for me?"</li></ul> |
68
+ | 7 | <ul><li>'The arrangements as stated are acceptable. Please go ahead and confirm all bookings accordingly.'</li><li>"I've reviewed the details and everything seems in order. Please proceed with the booking."</li><li>'This travel plan is satisfactory. Please secure the necessary reservations.'</li></ul> |
69
+ | 8 | <ul><li>'I need some clarification on charges for a rebooked flight. It seems higher than anticipated. Who can provide more details?'</li><li>'Wishing you and your family a very Merry Christmas and a Happy and Healthy New Year. I have one unidentified item this month, hope you can help, and as always thanks in advance. Very limited information on this. 11/21/2019 #N/A #N/A #N/A 142.45 Rail Europe North Amer'</li><li>"We've identified a mismatch between our booking records and credit card statement. Who can assist with this issue?"</li></ul> |
70
+
71
+ ## Uses
72
+
73
+ ### Direct Use for Inference
74
+
75
+ First install the SetFit library:
76
+
77
+ ```bash
78
+ pip install setfit
79
+ ```
80
+
81
+ Then you can load this model and run inference.
82
+
83
+ ```python
84
+ from setfit import SetFitModel
85
+
86
+ # Download from the 🤗 Hub
87
+ model = SetFitModel.from_pretrained("mann2107/BCMPIIRABSetFit")
88
+ # Run inference
89
+ preds = model("Thank you for your email. Please go ahead and issue. Please invoice in KES")
90
+ ```
91
+
92
+ <!--
93
+ ### Downstream Use
94
+
95
+ *List how someone could finetune this model on their own dataset.*
96
+ -->
97
+
98
+ <!--
99
+ ### Out-of-Scope Use
100
+
101
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
102
+ -->
103
+
104
+ <!--
105
+ ## Bias, Risks and Limitations
106
+
107
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
108
+ -->
109
+
110
+ <!--
111
+ ### Recommendations
112
+
113
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
114
+ -->
115
+
116
+ ## Training Details
117
+
118
+ ### Training Set Metrics
119
+ | Training set | Min | Median | Max |
120
+ |:-------------|:----|:--------|:----|
121
+ | Word count | 1 | 30.4097 | 124 |
122
+
123
+ | Label | Training Sample Count |
124
+ |:------|:----------------------|
125
+ | 0 | 16 |
126
+ | 1 | 16 |
127
+ | 2 | 16 |
128
+ | 3 | 16 |
129
+ | 4 | 16 |
130
+ | 5 | 16 |
131
+ | 6 | 16 |
132
+ | 7 | 16 |
133
+ | 8 | 16 |
134
+
135
+ ### Training Hyperparameters
136
+ - batch_size: (16, 2)
137
+ - num_epochs: (1, 1)
138
+ - max_steps: -1
139
+ - sampling_strategy: oversampling
140
+ - body_learning_rate: (2e-05, 1e-05)
141
+ - head_learning_rate: 0.01
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
+ - max_length: 512
149
+ - seed: 42
150
+ - eval_max_steps: -1
151
+ - load_best_model_at_end: True
152
+
153
+ ### Training Results
154
+ | Epoch | Step | Training Loss | Validation Loss |
155
+ |:-------:|:--------:|:-------------:|:---------------:|
156
+ | 0.0009 | 1 | 0.2058 | - |
157
+ | 0.0434 | 50 | 0.1316 | - |
158
+ | 0.0868 | 100 | 0.0328 | - |
159
+ | 0.1302 | 150 | 0.0038 | - |
160
+ | 0.1736 | 200 | 0.0018 | - |
161
+ | 0.2170 | 250 | 0.0009 | - |
162
+ | 0.2604 | 300 | 0.002 | - |
163
+ | 0.3038 | 350 | 0.0008 | - |
164
+ | 0.3472 | 400 | 0.0006 | - |
165
+ | 0.3906 | 450 | 0.001 | - |
166
+ | 0.4340 | 500 | 0.0011 | - |
167
+ | 0.4774 | 550 | 0.0005 | - |
168
+ | 0.5208 | 600 | 0.0009 | - |
169
+ | 0.5642 | 650 | 0.0003 | - |
170
+ | 0.6076 | 700 | 0.0002 | - |
171
+ | 0.6510 | 750 | 0.0003 | - |
172
+ | 0.6944 | 800 | 0.0009 | - |
173
+ | 0.7378 | 850 | 0.0002 | - |
174
+ | 0.7812 | 900 | 0.0002 | - |
175
+ | 0.8247 | 950 | 0.0002 | - |
176
+ | 0.8681 | 1000 | 0.0004 | - |
177
+ | 0.9115 | 1050 | 0.0002 | - |
178
+ | 0.9549 | 1100 | 0.0003 | - |
179
+ | 0.9983 | 1150 | 0.0003 | - |
180
+ | **1.0** | **1152** | **-** | **0.0699** |
181
+
182
+ * The bold row denotes the saved checkpoint.
183
+ ### Framework Versions
184
+ - Python: 3.9.16
185
+ - SetFit: 1.1.0.dev0
186
+ - Sentence Transformers: 2.2.2
187
+ - Transformers: 4.21.3
188
+ - PyTorch: 1.12.1+cu116
189
+ - Datasets: 2.4.0
190
+ - Tokenizers: 0.12.1
191
+
192
+ ## Citation
193
+
194
+ ### BibTeX
195
+ ```bibtex
196
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
197
+ doi = {10.48550/ARXIV.2209.11055},
198
+ url = {https://arxiv.org/abs/2209.11055},
199
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
200
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
201
+ title = {Efficient Few-Shot Learning Without Prompts},
202
+ publisher = {arXiv},
203
+ year = {2022},
204
+ copyright = {Creative Commons Attribution 4.0 International}
205
+ }
206
+ ```
207
+
208
+ <!--
209
+ ## Glossary
210
+
211
+ *Clearly define terms in order to be accessible across audiences.*
212
+ -->
213
+
214
+ <!--
215
+ ## Model Card Authors
216
+
217
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
218
+ -->
219
+
220
+ <!--
221
+ ## Model Card Contact
222
+
223
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
224
+ -->
config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "old_models/paraphrase-mpnet-base-v2/0_Transformer",
3
+ "architectures": [
4
+ "MPNetModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
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.7.0",
22
+ "vocab_size": 30527
23
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.0.0",
4
+ "transformers": "4.7.0",
5
+ "pytorch": "1.9.0+cu102"
6
+ }
7
+ }
config_setfit.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "labels": null,
3
+ "normalize_embeddings": false
4
+ }
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f6a8ffab1d8c6b5242f1e0273d6cb8a00bb7aaf56bc9b290c686d6ada9949196
3
+ size 29008
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
+ ]
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c353fd8bac59ddb6c183fec2d43caf83fc66a057970433a55d8886638581854
3
+ size 438014769
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,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
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "__type": "AddedToken",
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": true,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ "cls_token": {
11
+ "__type": "AddedToken",
12
+ "content": "<s>",
13
+ "lstrip": false,
14
+ "normalized": true,
15
+ "rstrip": false,
16
+ "single_word": false
17
+ },
18
+ "do_basic_tokenize": true,
19
+ "do_lower_case": true,
20
+ "eos_token": {
21
+ "__type": "AddedToken",
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": true,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ },
28
+ "mask_token": {
29
+ "__type": "AddedToken",
30
+ "content": "<mask>",
31
+ "lstrip": true,
32
+ "normalized": true,
33
+ "rstrip": false,
34
+ "single_word": false
35
+ },
36
+ "model_max_length": 512,
37
+ "name_or_path": "checkpoints/step_1152/",
38
+ "never_split": null,
39
+ "pad_token": {
40
+ "__type": "AddedToken",
41
+ "content": "<pad>",
42
+ "lstrip": false,
43
+ "normalized": true,
44
+ "rstrip": false,
45
+ "single_word": false
46
+ },
47
+ "sep_token": {
48
+ "__type": "AddedToken",
49
+ "content": "</s>",
50
+ "lstrip": false,
51
+ "normalized": true,
52
+ "rstrip": false,
53
+ "single_word": false
54
+ },
55
+ "special_tokens_map_file": null,
56
+ "strip_accents": null,
57
+ "tokenize_chinese_chars": true,
58
+ "tokenizer_class": "MPNetTokenizer",
59
+ "unk_token": {
60
+ "__type": "AddedToken",
61
+ "content": "[UNK]",
62
+ "lstrip": false,
63
+ "normalized": true,
64
+ "rstrip": false,
65
+ "single_word": false
66
+ }
67
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff