fluent42 commited on
Commit
3dc92fe
·
verified ·
1 Parent(s): e86b645

Push model using huggingface_hub.

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,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Die elektronische Patientenakte ist ein großer Schritt nach vorn für das deutsche
9
+ Gesundheitswesen. Sie ermöglicht eine bessere Koordination zwischen Ärzten und
10
+ sorgt dafür, dass Patienten immer die richtigen Informationen erhalten.
11
+ - text: Die ePA könnte das Gesundheitssystem verbessern, aber es ist noch unklar,
12
+ wie sie in der Praxis funktioniert.
13
+ - text: Die Möglichkeit, meine Daten selbst zu verwalten und zu entscheiden, wer darauf
14
+ zugreifen kann, macht die ePA für mich sehr attraktiv.
15
+ - text: Die ePA ist ein komplexes Thema, bei dem ich noch nicht weiß, ob ich dafür
16
+ oder dagegen bin.
17
+ - text: Die ePA wird uns als Fortschritt verkauft, aber in Wirklichkeit eröffnet sie
18
+ nur neue Möglichkeiten für Missbrauch und Datenlecks.
19
+ metrics:
20
+ - accuracy
21
+ pipeline_tag: text-classification
22
+ library_name: setfit
23
+ inference: true
24
+ base_model: sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
25
+ ---
26
+
27
+ # SetFit with sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
28
+
29
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-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.
30
+
31
+ The model has been trained using an efficient few-shot learning technique that involves:
32
+
33
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
34
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
35
+
36
+ ## Model Details
37
+
38
+ ### Model Description
39
+ - **Model Type:** SetFit
40
+ - **Sentence Transformer body:** [sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2)
41
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
42
+ - **Maximum Sequence Length:** 128 tokens
43
+ - **Number of Classes:** 3 classes
44
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
45
+ <!-- - **Language:** Unknown -->
46
+ <!-- - **License:** Unknown -->
47
+
48
+ ### Model Sources
49
+
50
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
51
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
52
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
53
+
54
+ ### Model Labels
55
+ | Label | Examples |
56
+ |:-------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
57
+ | neutral | <ul><li>'Ich bin weder komplett für noch gegen die ePA. Es kommt darauf an, wie sie umgesetzt wird.'</li><li>'Die ePA wird von manchen begrüßt und von anderen kritisiert. Ich warte ab, wie sie sich entwickelt.'</li><li>'Ich bin neutral, was die ePA betrifft. Sie könnte sowohl Vorteile als auch Nachteile haben.'</li></ul> |
58
+ | ablehnend | <ul><li>'Ich habe kein Vertrauen in die ePA, weil es zu viele ungelöste Probleme gibt, besonders was den Datenschutz betrifft.'</li><li>'Ich lehne die ePA ab, weil ich nicht möchte, dass so viele Informationen über mich zentral gespeichert werden.'</li><li>'Die ePA ist ein weiterer Schritt in Richtung Überwachung. Ich habe Bedenken, dass Versicherungen und Arbeitgeber irgendwann Zugriff darauf erhalten könnten.'</li></ul> |
59
+ | befürwortend | <ul><li>'Ich finde es gut, dass mit der ePA auch Notfalldaten sofort verfügbar sind, das kann im Ernstfall Leben retten.'</li><li>'Die ePA ist ein wichtiger Schritt in Richtung Digitalisierung und Modernisierung des Gesundheitssystems.'</li><li>'Ich sehe in der ePA eine große Chance, um den Austausch von Gesundheitsdaten zu verbessern und so die Behandlungsqualität zu steigern.'</li></ul> |
60
+
61
+ ## Uses
62
+
63
+ ### Direct Use for Inference
64
+
65
+ First install the SetFit library:
66
+
67
+ ```bash
68
+ pip install setfit
69
+ ```
70
+
71
+ Then you can load this model and run inference.
72
+
73
+ ```python
74
+ from setfit import SetFitModel
75
+
76
+ # Download from the 🤗 Hub
77
+ model = SetFitModel.from_pretrained("setfit_model_id")
78
+ # Run inference
79
+ preds = model("Die ePA ist ein komplexes Thema, bei dem ich noch nicht weiß, ob ich dafür oder dagegen bin.")
80
+ ```
81
+
82
+ <!--
83
+ ### Downstream Use
84
+
85
+ *List how someone could finetune this model on their own dataset.*
86
+ -->
87
+
88
+ <!--
89
+ ### Out-of-Scope Use
90
+
91
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
92
+ -->
93
+
94
+ <!--
95
+ ## Bias, Risks and Limitations
96
+
97
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
98
+ -->
99
+
100
+ <!--
101
+ ### Recommendations
102
+
103
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
104
+ -->
105
+
106
+ ## Training Details
107
+
108
+ ### Training Set Metrics
109
+ | Training set | Min | Median | Max |
110
+ |:-------------|:----|:--------|:----|
111
+ | Word count | 11 | 16.9365 | 23 |
112
+
113
+ | Label | Training Sample Count |
114
+ |:-------------|:----------------------|
115
+ | ablehnend | 21 |
116
+ | neutral | 21 |
117
+ | befürwortend | 21 |
118
+
119
+ ### Training Hyperparameters
120
+ - batch_size: (3, 3)
121
+ - num_epochs: (2, 2)
122
+ - max_steps: -1
123
+ - sampling_strategy: oversampling
124
+ - body_learning_rate: (2e-05, 1e-05)
125
+ - head_learning_rate: 0.01
126
+ - loss: CosineSimilarityLoss
127
+ - distance_metric: cosine_distance
128
+ - margin: 0.25
129
+ - end_to_end: False
130
+ - use_amp: False
131
+ - warmup_proportion: 0.1
132
+ - l2_weight: 0.01
133
+ - seed: 63
134
+ - eval_max_steps: -1
135
+ - load_best_model_at_end: False
136
+
137
+ ### Training Results
138
+ | Epoch | Step | Training Loss | Validation Loss |
139
+ |:------:|:----:|:-------------:|:---------------:|
140
+ | 0.0011 | 1 | 0.151 | - |
141
+ | 0.0567 | 50 | 0.184 | - |
142
+ | 0.1134 | 100 | 0.1252 | - |
143
+ | 0.1701 | 150 | 0.0585 | - |
144
+ | 0.2268 | 200 | 0.0116 | - |
145
+ | 0.2834 | 250 | 0.0039 | - |
146
+ | 0.3401 | 300 | 0.002 | - |
147
+ | 0.3968 | 350 | 0.0013 | - |
148
+ | 0.4535 | 400 | 0.0007 | - |
149
+ | 0.5102 | 450 | 0.0008 | - |
150
+ | 0.5669 | 500 | 0.0005 | - |
151
+ | 0.6236 | 550 | 0.0005 | - |
152
+ | 0.6803 | 600 | 0.0004 | - |
153
+ | 0.7370 | 650 | 0.0004 | - |
154
+ | 0.7937 | 700 | 0.0003 | - |
155
+ | 0.8503 | 750 | 0.0003 | - |
156
+ | 0.9070 | 800 | 0.0003 | - |
157
+ | 0.9637 | 850 | 0.0002 | - |
158
+ | 1.0204 | 900 | 0.0002 | - |
159
+ | 1.0771 | 950 | 0.0001 | - |
160
+ | 1.1338 | 1000 | 0.0002 | - |
161
+ | 1.1905 | 1050 | 0.0001 | - |
162
+ | 1.2472 | 1100 | 0.0002 | - |
163
+ | 1.3039 | 1150 | 0.0002 | - |
164
+ | 1.3605 | 1200 | 0.0002 | - |
165
+ | 1.4172 | 1250 | 0.0001 | - |
166
+ | 1.4739 | 1300 | 0.0001 | - |
167
+ | 1.5306 | 1350 | 0.0001 | - |
168
+ | 1.5873 | 1400 | 0.0001 | - |
169
+ | 1.6440 | 1450 | 0.0001 | - |
170
+ | 1.7007 | 1500 | 0.0001 | - |
171
+ | 1.7574 | 1550 | 0.0001 | - |
172
+ | 1.8141 | 1600 | 0.0001 | - |
173
+ | 1.8707 | 1650 | 0.0001 | - |
174
+ | 1.9274 | 1700 | 0.0001 | - |
175
+ | 1.9841 | 1750 | 0.0001 | - |
176
+
177
+ ### Framework Versions
178
+ - Python: 3.12.12
179
+ - SetFit: 1.1.3
180
+ - Sentence Transformers: 5.2.3
181
+ - Transformers: 4.44.2
182
+ - PyTorch: 2.10.0
183
+ - Datasets: 4.6.0
184
+ - Tokenizers: 0.19.1
185
+
186
+ ## Citation
187
+
188
+ ### BibTeX
189
+ ```bibtex
190
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
191
+ doi = {10.48550/ARXIV.2209.11055},
192
+ url = {https://arxiv.org/abs/2209.11055},
193
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
194
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
195
+ title = {Efficient Few-Shot Learning Without Prompts},
196
+ publisher = {arXiv},
197
+ year = {2022},
198
+ copyright = {Creative Commons Attribution 4.0 International}
199
+ }
200
+ ```
201
+
202
+ <!--
203
+ ## Glossary
204
+
205
+ *Clearly define terms in order to be accessible across audiences.*
206
+ -->
207
+
208
+ <!--
209
+ ## Model Card Authors
210
+
211
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
212
+ -->
213
+
214
+ <!--
215
+ ## Model Card Contact
216
+
217
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
218
+ -->
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
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": 12,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.44.2",
23
+ "type_vocab_size": 2,
24
+ "use_cache": true,
25
+ "vocab_size": 250037
26
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "5.2.3",
4
+ "transformers": "4.44.2",
5
+ "pytorch": "2.10.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,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "labels": [
3
+ "ablehnend",
4
+ "neutral",
5
+ "bef\u00fcrwortend"
6
+ ],
7
+ "normalize_embeddings": false
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b6571b27c20f6202d323093663038e74720b324c6ff30a32b008e5ad7ff8951
3
+ size 470637416
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd90ad6ea31645773705d42e21893b2dc2a70d4e04aa895faf64c32fa36be6b9
3
+ size 10111
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": 128,
3
+ "do_lower_case": false
4
+ }
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": true,
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:cad551d5600a84242d0973327029452a1e3672ba6313c2a3c3d69c4310e12719
3
+ size 17082987
tokenizer_config.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "do_lower_case": true,
48
+ "eos_token": "</s>",
49
+ "mask_token": "<mask>",
50
+ "max_length": 128,
51
+ "model_max_length": 128,
52
+ "pad_to_multiple_of": null,
53
+ "pad_token": "<pad>",
54
+ "pad_token_type_id": 0,
55
+ "padding_side": "right",
56
+ "sep_token": "</s>",
57
+ "stride": 0,
58
+ "strip_accents": null,
59
+ "tokenize_chinese_chars": true,
60
+ "tokenizer_class": "PreTrainedTokenizerFast",
61
+ "truncation_side": "right",
62
+ "truncation_strategy": "longest_first",
63
+ "unk_token": "<unk>"
64
+ }