thegenerativegeneration commited on
Commit
137f54b
1 Parent(s): 31cb78b

Upload 13 files

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,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 ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: setfit
3
+ tags:
4
+ - setfit
5
+ - sentence-transformers
6
+ - text-classification
7
+ - generated_from_setfit_trainer
8
+ base_model: intfloat/multilingual-e5-small
9
+ metrics:
10
+ - accuracy
11
+ widget:
12
+ - text: 'query: Sí, la próxima vez que vayas, cuenta conmigo. He querido salir y hacer
13
+ más actividades en la naturaleza.'
14
+ - text: 'query: I''m man, I''m leaving now.'
15
+ - text: 'query: Ja, forse possiamo fare un giro in bicicletta insieme.'
16
+ - text: 'query: Mak saya suruh balik, jumpa lagi.'
17
+ - text: 'query: İnanılmaz, bu harika! Bir ayı gördüğüne inanamıyorum!'
18
+ pipeline_tag: text-classification
19
+ inference: true
20
+ ---
21
+
22
+ # SetFit with intfloat/multilingual-e5-small
23
+
24
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) as the Sentence Transformer embedding model. A [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance is used for classification.
25
+
26
+ The model has been trained using an efficient few-shot learning technique that involves:
27
+
28
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
29
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
30
+
31
+ ## Model Details
32
+
33
+ ### Model Description
34
+ - **Model Type:** SetFit
35
+ - **Sentence Transformer body:** [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small)
36
+ - **Classification head:** a [SetFitHead](huggingface.co/docs/setfit/reference/main#setfit.SetFitHead) instance
37
+ - **Maximum Sequence Length:** 512 tokens
38
+ - **Number of Classes:** 2 classes
39
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
40
+ <!-- - **Language:** Unknown -->
41
+ <!-- - **License:** Unknown -->
42
+
43
+ ### Model Sources
44
+
45
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
46
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
47
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
48
+
49
+ ### Model Labels
50
+ | Label | Examples |
51
+ |:------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
52
+ | 1 | <ul><li>'query: Tja, måste dra nu, ses senare.'</li><li>'query: Ispričavam se, moram sada otići.'</li><li>'query: Przepraszam, muszę już iść.'</li></ul> |
53
+ | 0 | <ul><li>'query: Sveiki, kā jums klājas?'</li><li>'query: அதிர்ச்சிகரமானது, அது மிகவும் அருமையாக இருக்கிறது! நீ கரடியை பார்த்தது எனக்கு நம்பிக்கையே வரவில்லை!'</li><li>'query: Ég hef það fínt, takk. Og þú?'</li></ul> |
54
+
55
+ ## Uses
56
+
57
+ ### Direct Use for Inference
58
+
59
+ First install the SetFit library:
60
+
61
+ ```bash
62
+ pip install setfit
63
+ ```
64
+
65
+ Then you can load this model and run inference.
66
+
67
+ ```python
68
+ from setfit import SetFitModel
69
+
70
+ # Download from the 🤗 Hub
71
+ model = SetFitModel.from_pretrained("setfit_model_id")
72
+ # Run inference
73
+ preds = model("query: I'm man, I'm leaving now.")
74
+ ```
75
+
76
+ <!--
77
+ ### Downstream Use
78
+
79
+ *List how someone could finetune this model on their own dataset.*
80
+ -->
81
+
82
+ <!--
83
+ ### Out-of-Scope Use
84
+
85
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
86
+ -->
87
+
88
+ <!--
89
+ ## Bias, Risks and Limitations
90
+
91
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
92
+ -->
93
+
94
+ <!--
95
+ ### Recommendations
96
+
97
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
98
+ -->
99
+
100
+ ## Training Details
101
+
102
+ ### Training Set Metrics
103
+ | Training set | Min | Median | Max |
104
+ |:-------------|:----|:-------|:----|
105
+ | Word count | 2 | 7.6965 | 31 |
106
+
107
+ | Label | Training Sample Count |
108
+ |:------|:----------------------|
109
+ | 0 | 902 |
110
+ | 1 | 910 |
111
+
112
+ ### Training Hyperparameters
113
+ - batch_size: (16, 2)
114
+ - num_epochs: (1, 16)
115
+ - max_steps: -1
116
+ - sampling_strategy: undersampling
117
+ - body_learning_rate: (1e-05, 1e-05)
118
+ - head_learning_rate: 0.001
119
+ - loss: CosineSimilarityLoss
120
+ - distance_metric: cosine_distance
121
+ - margin: 0.1
122
+ - end_to_end: False
123
+ - use_amp: False
124
+ - warmup_proportion: 0.1
125
+ - seed: 42
126
+ - run_name: multilingual-e5-small
127
+ - eval_max_steps: -1
128
+ - load_best_model_at_end: True
129
+
130
+ ### Training Results
131
+ | Epoch | Step | Training Loss | Validation Loss |
132
+ |:------:|:----:|:-------------:|:---------------:|
133
+ | 0.0000 | 1 | 0.3613 | - |
134
+ | 0.0005 | 50 | 0.3577 | - |
135
+ | 0.0010 | 100 | 0.3511 | 0.3413 |
136
+ | 0.0015 | 150 | 0.3372 | - |
137
+ | 0.0019 | 200 | 0.3447 | 0.3347 |
138
+ | 0.0024 | 250 | 0.3349 | - |
139
+ | 0.0029 | 300 | 0.3326 | 0.3224 |
140
+ | 0.0034 | 350 | 0.3372 | - |
141
+ | 0.0039 | 400 | 0.3185 | 0.3039 |
142
+ | 0.0044 | 450 | 0.2828 | - |
143
+ | 0.0049 | 500 | 0.3055 | 0.2774 |
144
+ | 0.0054 | 550 | 0.2594 | - |
145
+ | 0.0058 | 600 | 0.2779 | 0.2489 |
146
+ | 0.0063 | 650 | 0.2486 | - |
147
+ | 0.0068 | 700 | 0.2321 | 0.22 |
148
+ | 0.0073 | 750 | 0.1838 | - |
149
+ | 0.0078 | 800 | 0.1845 | 0.2075 |
150
+ | 0.0083 | 850 | 0.1899 | - |
151
+ | 0.0088 | 900 | 0.2147 | 0.2025 |
152
+ | 0.0093 | 950 | 0.1644 | - |
153
+ | 0.0097 | 1000 | 0.2019 | 0.1821 |
154
+ | 0.0102 | 1050 | 0.2309 | - |
155
+ | 0.0107 | 1100 | 0.2084 | 0.1784 |
156
+ | 0.0112 | 1150 | 0.1508 | - |
157
+ | 0.0117 | 1200 | 0.1064 | 0.1453 |
158
+ | 0.0122 | 1250 | 0.1376 | - |
159
+ | 0.0127 | 1300 | 0.0828 | 0.121 |
160
+ | 0.0132 | 1350 | 0.1628 | - |
161
+ | 0.0136 | 1400 | 0.1308 | 0.1018 |
162
+ | 0.0141 | 1450 | 0.0566 | - |
163
+ | 0.0146 | 1500 | 0.0953 | 0.0767 |
164
+ | 0.0151 | 1550 | 0.1607 | - |
165
+ | 0.0156 | 1600 | 0.1322 | 0.0625 |
166
+ | 0.0161 | 1650 | 0.0861 | - |
167
+ | 0.0166 | 1700 | 0.0926 | 0.0423 |
168
+ | 0.0171 | 1750 | 0.0338 | - |
169
+ | 0.0175 | 1800 | 0.1029 | 0.0344 |
170
+ | 0.0180 | 1850 | 0.0442 | - |
171
+ | 0.0185 | 1900 | 0.019 | 0.0256 |
172
+ | 0.0190 | 1950 | 0.0489 | - |
173
+ | 0.0195 | 2000 | 0.0675 | 0.0187 |
174
+
175
+ ### Framework Versions
176
+ - Python: 3.10.11
177
+ - SetFit: 1.0.3
178
+ - Sentence Transformers: 2.7.0
179
+ - Transformers: 4.39.0
180
+ - PyTorch: 2.4.0
181
+ - Datasets: 2.20.0
182
+ - Tokenizers: 0.15.2
183
+
184
+ ## Citation
185
+
186
+ ### BibTeX
187
+ ```bibtex
188
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
189
+ doi = {10.48550/ARXIV.2209.11055},
190
+ url = {https://arxiv.org/abs/2209.11055},
191
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
192
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
193
+ title = {Efficient Few-Shot Learning Without Prompts},
194
+ publisher = {arXiv},
195
+ year = {2022},
196
+ copyright = {Creative Commons Attribution 4.0 International}
197
+ }
198
+ ```
199
+
200
+ <!--
201
+ ## Glossary
202
+
203
+ *Clearly define terms in order to be accessible across audiences.*
204
+ -->
205
+
206
+ <!--
207
+ ## Model Card Authors
208
+
209
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
210
+ -->
211
+
212
+ <!--
213
+ ## Model Card Contact
214
+
215
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
216
+ -->
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "intfloat/multilingual-e5-small",
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
+ "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": 12,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "tokenizer_class": "XLMRobertaTokenizer",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.39.0",
23
+ "type_vocab_size": 2,
24
+ "use_cache": true,
25
+ "vocab_size": 250037
26
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.7.0",
4
+ "transformers": "4.39.0",
5
+ "pytorch": "2.4.0"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null
9
+ }
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:61169cbb78c41b4aebadcaac92b29f7dd363dea2e868cf27f169ce0771888e6c
3
+ size 470637416
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df178af3c19cf3bd160758f24dfedbf2133263527e90b572f5ff9c7107f6a5de
3
+ size 4608
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,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45b6ee00bc5023ac454b82c372ebe14b27866fa471b6dbb0d24e09b12909a1f4
3
+ size 17083075
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": false,
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
+ "sp_model_kwargs": {},
53
+ "tokenizer_class": "XLMRobertaTokenizer",
54
+ "unk_token": "<unk>"
55
+ }