Henniina commited on
Commit
c672291
·
verified ·
1 Parent(s): 0ac60e9

Push model using huggingface_hub.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
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
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": false,
9
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Etunimi Sukunimi Kaunistelua sanoa että vain yhden ihmisen tähden. Putinin
9
+ toimilla on Venäjällä laaja kannatus, kyllä kansakunnalla on myös kollektiivista
10
+ vastuuta tapahtumista. Sotaa vastaan protestoivia on ollut vähemmän kuin Venäjällä
11
+ sotilaita Ukrainassa.
12
+ - text: Toivottavasti valtio korvaa jokaisen menetetyn euron
13
+ - text: Etunimi Sukunimi Niin on.. ja valtioita joista lähinnä venäjä ja valko-venäjä.
14
+ - text: www.maskikauppa.fi
15
+ - text: Etunimi Sukunimi Jatka veikkonen.
16
+ metrics:
17
+ - metric
18
+ pipeline_tag: text-classification
19
+ library_name: setfit
20
+ inference: true
21
+ base_model: TurkuNLP/bert-base-finnish-cased-v1
22
+ model-index:
23
+ - name: SetFit with TurkuNLP/bert-base-finnish-cased-v1
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: metric
34
+ value: 0.7911322719833359
35
+ name: Metric
36
+ ---
37
+
38
+ # SetFit with TurkuNLP/bert-base-finnish-cased-v1
39
+
40
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [TurkuNLP/bert-base-finnish-cased-v1](https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1) 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:** [TurkuNLP/bert-base-finnish-cased-v1](https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1)
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:** 2 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
+ | 0 | <ul><li>'Etunimi Sukunimi katso tilastot ja vertaa funssiin'</li><li>'Ei muuta kuin Norjaan öljyostoksille 🙂'</li><li>'Etunimi Etunimi Härmä ja mitenköhän se yle ne anonyymit sinne haastatteluun saa jos he eivät itse ilmottaudu. Kun ovat noi potilastiedot salaisia.... joskus olis ihan hyvä hetki miettiä....🤔🤔'</li></ul> |
69
+ | 1 | <ul><li>'Etunimi väittäisin, että paremmin he tämän hoitavat, kuin viimekertainen "poikalauma"'</li><li>'Eikö. Lisää piikkejä vaan niin hyvää tulee. Ne pelastaa. 😆'</li><li>'Etunimi Sukunimi perustuslakia ei ole rikottu niissä asioissa mitä convoypellet väitti, kaikki mitä kaverit väittää ei ole totta .'</li></ul> |
70
+
71
+ ## Evaluation
72
+
73
+ ### Metrics
74
+ | Label | Metric |
75
+ |:--------|:-------|
76
+ | **all** | 0.7911 |
77
+
78
+ ## Uses
79
+
80
+ ### Direct Use for Inference
81
+
82
+ First install the SetFit library:
83
+
84
+ ```bash
85
+ pip install setfit
86
+ ```
87
+
88
+ Then you can load this model and run inference.
89
+
90
+ ```python
91
+ from setfit import SetFitModel
92
+
93
+ # Download from the 🤗 Hub
94
+ model = SetFitModel.from_pretrained("Finnish-actions/SetFit-FinBERT1-A3-challenge")
95
+ # Run inference
96
+ preds = model("www.maskikauppa.fi")
97
+ ```
98
+
99
+ <!--
100
+ ### Downstream Use
101
+
102
+ *List how someone could finetune this model on their own dataset.*
103
+ -->
104
+
105
+ <!--
106
+ ### Out-of-Scope Use
107
+
108
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
109
+ -->
110
+
111
+ <!--
112
+ ## Bias, Risks and Limitations
113
+
114
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
115
+ -->
116
+
117
+ <!--
118
+ ### Recommendations
119
+
120
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
121
+ -->
122
+
123
+ ## Training Details
124
+
125
+ ### Training Set Metrics
126
+ | Training set | Min | Median | Max |
127
+ |:-------------|:----|:--------|:----|
128
+ | Word count | 1 | 20.2233 | 213 |
129
+
130
+ | Label | Training Sample Count |
131
+ |:------|:----------------------|
132
+ | 0 | 843 |
133
+ | 1 | 120 |
134
+
135
+ ### Training Hyperparameters
136
+ - batch_size: (16, 16)
137
+ - num_epochs: (4, 4)
138
+ - max_steps: -1
139
+ - sampling_strategy: oversampling
140
+ - num_iterations: 6
141
+ - body_learning_rate: (2e-05, 1e-05)
142
+ - head_learning_rate: 0.01
143
+ - loss: CosineSimilarityLoss
144
+ - distance_metric: cosine_distance
145
+ - margin: 0.25
146
+ - end_to_end: False
147
+ - use_amp: False
148
+ - warmup_proportion: 0.1
149
+ - l2_weight: 0.01
150
+ - seed: 42
151
+ - evaluation_strategy: epoch
152
+ - eval_max_steps: -1
153
+ - load_best_model_at_end: False
154
+
155
+ ### Training Results
156
+ | Epoch | Step | Training Loss | Validation Loss |
157
+ |:------:|:----:|:-------------:|:---------------:|
158
+ | 0.0014 | 1 | 0.2409 | - |
159
+ | 0.0692 | 50 | 0.2872 | - |
160
+ | 0.1383 | 100 | 0.2515 | - |
161
+ | 0.2075 | 150 | 0.2327 | - |
162
+ | 0.2766 | 200 | 0.1678 | - |
163
+ | 0.3458 | 250 | 0.0977 | - |
164
+ | 0.4149 | 300 | 0.0434 | - |
165
+ | 0.4841 | 350 | 0.031 | - |
166
+ | 0.5533 | 400 | 0.0183 | - |
167
+ | 0.6224 | 450 | 0.0084 | - |
168
+ | 0.6916 | 500 | 0.0069 | - |
169
+ | 0.7607 | 550 | 0.0057 | - |
170
+ | 0.8299 | 600 | 0.0045 | - |
171
+ | 0.8990 | 650 | 0.0011 | - |
172
+ | 0.9682 | 700 | 0.0005 | - |
173
+ | 1.0 | 723 | - | 0.4558 |
174
+ | 1.0373 | 750 | 0.0003 | - |
175
+ | 1.1065 | 800 | 0.0008 | - |
176
+ | 1.1757 | 850 | 0.0007 | - |
177
+ | 1.2448 | 900 | 0.0001 | - |
178
+ | 1.3140 | 950 | 0.0001 | - |
179
+ | 1.3831 | 1000 | 0.0008 | - |
180
+ | 1.4523 | 1050 | 0.0001 | - |
181
+ | 1.5214 | 1100 | 0.0001 | - |
182
+ | 1.5906 | 1150 | 0.0001 | - |
183
+ | 1.6598 | 1200 | 0.0001 | - |
184
+ | 1.7289 | 1250 | 0.0001 | - |
185
+ | 1.7981 | 1300 | 0.0001 | - |
186
+ | 1.8672 | 1350 | 0.0001 | - |
187
+ | 1.9364 | 1400 | 0.0001 | - |
188
+ | 2.0 | 1446 | - | 0.4562 |
189
+ | 2.0055 | 1450 | 0.0 | - |
190
+ | 2.0747 | 1500 | 0.0001 | - |
191
+ | 2.1438 | 1550 | 0.0001 | - |
192
+ | 2.2130 | 1600 | 0.0 | - |
193
+ | 2.2822 | 1650 | 0.0001 | - |
194
+ | 2.3513 | 1700 | 0.0 | - |
195
+ | 2.4205 | 1750 | 0.0 | - |
196
+ | 2.4896 | 1800 | 0.0 | - |
197
+ | 2.5588 | 1850 | 0.0 | - |
198
+ | 2.6279 | 1900 | 0.0 | - |
199
+ | 2.6971 | 1950 | 0.0 | - |
200
+ | 2.7663 | 2000 | 0.0 | - |
201
+ | 2.8354 | 2050 | 0.0 | - |
202
+ | 2.9046 | 2100 | 0.0 | - |
203
+ | 2.9737 | 2150 | 0.0 | - |
204
+ | 3.0 | 2169 | - | 0.4560 |
205
+ | 3.0429 | 2200 | 0.0 | - |
206
+ | 3.1120 | 2250 | 0.0 | - |
207
+ | 3.1812 | 2300 | 0.0 | - |
208
+ | 3.2503 | 2350 | 0.0 | - |
209
+ | 3.3195 | 2400 | 0.0 | - |
210
+ | 3.3887 | 2450 | 0.0 | - |
211
+ | 3.4578 | 2500 | 0.0 | - |
212
+ | 3.5270 | 2550 | 0.0 | - |
213
+ | 3.5961 | 2600 | 0.0 | - |
214
+ | 3.6653 | 2650 | 0.0 | - |
215
+ | 3.7344 | 2700 | 0.0 | - |
216
+ | 3.8036 | 2750 | 0.0 | - |
217
+ | 3.8728 | 2800 | 0.0 | - |
218
+ | 3.9419 | 2850 | 0.0 | - |
219
+ | 4.0 | 2892 | - | 0.4593 |
220
+
221
+ ### Framework Versions
222
+ - Python: 3.11.9
223
+ - SetFit: 1.1.3
224
+ - Sentence Transformers: 3.2.0
225
+ - Transformers: 4.44.0
226
+ - PyTorch: 2.4.0+cu124
227
+ - Datasets: 2.21.0
228
+ - Tokenizers: 0.19.1
229
+
230
+ ## Citation
231
+
232
+ ### BibTeX
233
+ ```bibtex
234
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
235
+ doi = {10.48550/ARXIV.2209.11055},
236
+ url = {https://arxiv.org/abs/2209.11055},
237
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
238
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
239
+ title = {Efficient Few-Shot Learning Without Prompts},
240
+ publisher = {arXiv},
241
+ year = {2022},
242
+ copyright = {Creative Commons Attribution 4.0 International}
243
+ }
244
+ ```
245
+
246
+ <!--
247
+ ## Glossary
248
+
249
+ *Clearly define terms in order to be accessible across audiences.*
250
+ -->
251
+
252
+ <!--
253
+ ## Model Card Authors
254
+
255
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
256
+ -->
257
+
258
+ <!--
259
+ ## Model Card Contact
260
+
261
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
262
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "TurkuNLP/bert-base-finnish-cased-v1",
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": 768,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 3072,
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
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.44.0",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 50105
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.2.0",
4
+ "transformers": "4.44.0",
5
+ "pytorch": "2.4.0+cu124"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
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:a2978009dac1bb95ebaaf1650aac20d5c326979235edfcf72b7e38d4dc608cc4
3
+ size 498110312
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bf644717b87bd255c76ba41b187fa87d09f95311d427f347074ab5ab1fffa63
3
+ size 7007
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
+ ]
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,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "101": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "102": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "103": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "104": {
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_lower_case": false,
47
+ "mask_token": "[MASK]",
48
+ "model_max_length": 512,
49
+ "pad_token": "[PAD]",
50
+ "sep_token": "[SEP]",
51
+ "strip_accents": null,
52
+ "tokenize_chinese_chars": true,
53
+ "tokenizer_class": "BertTokenizer",
54
+ "unk_token": "[UNK]"
55
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff