gehaustein commited on
Commit
fa814e6
·
verified ·
1 Parent(s): 5ec24cc

Push model using huggingface_hub.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
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
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: für Integration
9
+ - text: Zugang zu Integrationsmaßnahmen sicherstellen;
10
+ - text: Wir sehen in der natürlichen Zwei- oder Mehrsprachigkeit ein wichtiges Potenzial,
11
+ das durch eine gezielte sprachliche Förderung realisiert werden kann.
12
+ - text: Deutschland braucht ein umfassendes Integrationskonzept auf allen Ebenen -
13
+ der Kommune, des Landes und des Bundes.
14
+ - text: Eine offene Gesellschaft bietet im Rahmen der Grundrechte allen Religionen
15
+ den Freiraum zur Entfaltung ihres Glaubens.
16
+ metrics:
17
+ - f1
18
+ - precision
19
+ - recall
20
+ pipeline_tag: text-classification
21
+ library_name: setfit
22
+ inference: true
23
+ base_model: deutsche-telekom/gbert-large-paraphrase-cosine
24
+ model-index:
25
+ - name: SetFit with deutsche-telekom/gbert-large-paraphrase-cosine
26
+ results:
27
+ - task:
28
+ type: text-classification
29
+ name: Text Classification
30
+ dataset:
31
+ name: Unknown
32
+ type: unknown
33
+ split: test
34
+ metrics:
35
+ - type: f1
36
+ value: 0.8563995837669095
37
+ name: F1
38
+ - type: precision
39
+ value: 0.858476507713885
40
+ name: Precision
41
+ - type: recall
42
+ value: 0.8548387096774194
43
+ name: Recall
44
+ ---
45
+
46
+ # SetFit with deutsche-telekom/gbert-large-paraphrase-cosine
47
+
48
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [deutsche-telekom/gbert-large-paraphrase-cosine](https://huggingface.co/deutsche-telekom/gbert-large-paraphrase-cosine) 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.
49
+
50
+ The model has been trained using an efficient few-shot learning technique that involves:
51
+
52
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
53
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
54
+
55
+ ## Model Details
56
+
57
+ ### Model Description
58
+ - **Model Type:** SetFit
59
+ - **Sentence Transformer body:** [deutsche-telekom/gbert-large-paraphrase-cosine](https://huggingface.co/deutsche-telekom/gbert-large-paraphrase-cosine)
60
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
61
+ - **Maximum Sequence Length:** 512 tokens
62
+ - **Number of Classes:** 2 classes
63
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
64
+ <!-- - **Language:** Unknown -->
65
+ <!-- - **License:** Unknown -->
66
+
67
+ ### Model Sources
68
+
69
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
70
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
71
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
72
+
73
+ ### Model Labels
74
+ | Label | Examples |
75
+ |:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
76
+ | 1 | <ul><li>'Deutschland ist ein gastfreundliches und weltoffenes Land.'</li><li>'Aber auch in der Polizei und Justiz muss sich einiges ändern.'</li><li>'Die FDP sucht das Gespräch mit der evangelischen und katholischen Kirche ebenso wie mit dem Judentum, dem Islam und allen anderen Religionsgemeinschaften.'</li></ul> |
77
+ | 0 | <ul><li>'Wir wollen eine Integrationsoffensive.'</li><li>'Kenntnisse der deutschen Sprache sind eine unverzichtbare Voraussetzung zur Beseitigung sozialer Benachteiligungen und zum Erreichen schulischer, beruflicher und gesellschaftlicher Erfolge.'</li><li>'Wir erwarten von Zuwandernden, dass sie die deutsche Sprache erlernen.'</li></ul> |
78
+
79
+ ## Evaluation
80
+
81
+ ### Metrics
82
+ | Label | F1 | Precision | Recall |
83
+ |:--------|:-------|:----------|:-------|
84
+ | **all** | 0.8564 | 0.8585 | 0.8548 |
85
+
86
+ ## Uses
87
+
88
+ ### Direct Use for Inference
89
+
90
+ First install the SetFit library:
91
+
92
+ ```bash
93
+ pip install setfit
94
+ ```
95
+
96
+ Then you can load this model and run inference.
97
+
98
+ ```python
99
+ from setfit import SetFitModel
100
+
101
+ # Download from the 🤗 Hub
102
+ model = SetFitModel.from_pretrained("gehaustein/gbert-large-stance-multiculturalism")
103
+ # Run inference
104
+ preds = model("für Integration")
105
+ ```
106
+
107
+ <!--
108
+ ### Downstream Use
109
+
110
+ *List how someone could finetune this model on their own dataset.*
111
+ -->
112
+
113
+ <!--
114
+ ### Out-of-Scope Use
115
+
116
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
117
+ -->
118
+
119
+ <!--
120
+ ## Bias, Risks and Limitations
121
+
122
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
123
+ -->
124
+
125
+ <!--
126
+ ### Recommendations
127
+
128
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
129
+ -->
130
+
131
+ ## Training Details
132
+
133
+ ### Training Set Metrics
134
+ | Training set | Min | Median | Max |
135
+ |:-------------|:----|:--------|:----|
136
+ | Word count | 1 | 14.6336 | 42 |
137
+
138
+ | Label | Training Sample Count |
139
+ |:------|:----------------------|
140
+ | 0 | 128 |
141
+ | 1 | 366 |
142
+
143
+ ### Training Hyperparameters
144
+ - batch_size: (128, 128)
145
+ - num_epochs: (1, 1)
146
+ - max_steps: -1
147
+ - sampling_strategy: oversampling
148
+ - body_learning_rate: (1e-05, 1e-05)
149
+ - head_learning_rate: 0.01
150
+ - loss: CosineSimilarityLoss
151
+ - distance_metric: cosine_distance
152
+ - margin: 0.25
153
+ - end_to_end: False
154
+ - use_amp: False
155
+ - warmup_proportion: 0.1
156
+ - seed: 42
157
+ - eval_max_steps: -1
158
+ - load_best_model_at_end: True
159
+
160
+ ### Training Results
161
+ | Epoch | Step | Training Loss | Validation Loss |
162
+ |:----------:|:-------:|:-------------:|:---------------:|
163
+ | 0.0008 | 1 | 0.3283 | - |
164
+ | 0.0424 | 50 | 0.2401 | 0.234 |
165
+ | 0.0848 | 100 | 0.0852 | 0.202 |
166
+ | 0.1272 | 150 | 0.0054 | 0.2493 |
167
+ | 0.1696 | 200 | 0.001 | 0.2502 |
168
+ | 0.2120 | 250 | 0.0002 | 0.2513 |
169
+ | 0.2545 | 300 | 0.0012 | 0.2496 |
170
+ | 0.2969 | 350 | 0.0046 | 0.2485 |
171
+ | 0.3393 | 400 | 0.0056 | 0.2538 |
172
+ | 0.3817 | 450 | 0.0001 | 0.2543 |
173
+ | **0.4241** | **500** | **0.0001** | **0.2443** |
174
+ | 0.4665 | 550 | 0.0001 | 0.2472 |
175
+ | 0.5089 | 600 | 0.0051 | 0.2655 |
176
+ | 0.5513 | 650 | 0.0002 | 0.2646 |
177
+
178
+ * The bold row denotes the saved checkpoint.
179
+ ### Framework Versions
180
+ - Python: 3.11.11
181
+ - SetFit: 1.1.0.dev0
182
+ - Sentence Transformers: 3.3.1
183
+ - Transformers: 4.48.1
184
+ - PyTorch: 2.5.1+cu121
185
+ - Datasets: 2.14.4
186
+ - Tokenizers: 0.21.0
187
+
188
+ ## Citation
189
+
190
+ ### BibTeX
191
+ ```bibtex
192
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
193
+ doi = {10.48550/ARXIV.2209.11055},
194
+ url = {https://arxiv.org/abs/2209.11055},
195
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
196
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
197
+ title = {Efficient Few-Shot Learning Without Prompts},
198
+ publisher = {arXiv},
199
+ year = {2022},
200
+ copyright = {Creative Commons Attribution 4.0 International}
201
+ }
202
+ ```
203
+
204
+ <!--
205
+ ## Glossary
206
+
207
+ *Clearly define terms in order to be accessible across audiences.*
208
+ -->
209
+
210
+ <!--
211
+ ## Model Card Authors
212
+
213
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
214
+ -->
215
+
216
+ <!--
217
+ ## Model Card Contact
218
+
219
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
220
+ -->
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "checkpoints/step_500",
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": 1024,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 4096,
13
+ "layer_norm_eps": 1e-12,
14
+ "max_position_embeddings": 512,
15
+ "model_type": "bert",
16
+ "num_attention_heads": 16,
17
+ "num_hidden_layers": 24,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.48.1",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 31102
25
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.3.1",
4
+ "transformers": "4.48.1",
5
+ "pytorch": "2.5.1+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
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:bd2dcc1a936a535fe5fe99548896a16f3322739148fa5f7ebcd224c10cc1f37c
3
+ size 1342988112
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcba0a7cded0ecd78a4f776e01dac7afdfea7054159bf7ae2ec39316c382f0e2
3
+ size 9055
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,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": false,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": false,
48
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "max_len": 512,
51
+ "max_length": 512,
52
+ "model_max_length": 512,
53
+ "never_split": null,
54
+ "pad_to_multiple_of": null,
55
+ "pad_token": "[PAD]",
56
+ "pad_token_type_id": 0,
57
+ "padding_side": "right",
58
+ "sep_token": "[SEP]",
59
+ "stride": 0,
60
+ "strip_accents": false,
61
+ "tokenize_chinese_chars": true,
62
+ "tokenizer_class": "BertTokenizer",
63
+ "truncation_side": "right",
64
+ "truncation_strategy": "longest_first",
65
+ "unk_token": "[UNK]"
66
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff