TRUEnder commited on
Commit
1dac3fc
1 Parent(s): 707a69c

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,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: setfit
3
+ tags:
4
+ - setfit
5
+ - sentence-transformers
6
+ - text-classification
7
+ - generated_from_setfit_trainer
8
+ base_model: firqaaa/indo-sentence-bert-base
9
+ metrics:
10
+ - accuracy
11
+ - precision
12
+ - recall
13
+ - f1
14
+ widget:
15
+ - text: halaman 97 - 128 tidak ada , diulang halaman 65 - 96 , pembelian hari minggu
16
+ tanggal 24 desember sore sekitar jam 4 pembayaran menggunakan kartu atm bri bersamaan
17
+ dengan buku the puppeteer dan sirkus pohon
18
+ - text: liverpool sukses di kandang tottenham
19
+ - text: hai angga , untuk penerbitan tiket reschedule diharuskan melakukan pembayaran
20
+ dulu ya .
21
+ - text: sedih kalau umat diprovokasi supaya saling membenci .
22
+ - text: berada di lokasi strategis jalan merdeka , berseberangan agak ke samping bandung
23
+ indah plaza , tapat sebelah kanan jalan sebelum traffic light , parkir mobil cukup
24
+ luas . saus bumbu dan lain-lain disediakan cukup lengkap di lantai bawah . di
25
+ lantai atas suasana agak sepi . bakso cukup enak dan terjangkau harga nya tetapi
26
+ kuah relatif kurang dan porsi tidak terlalu besar
27
+ pipeline_tag: text-classification
28
+ inference: true
29
+ model-index:
30
+ - name: SetFit with firqaaa/indo-sentence-bert-base
31
+ results:
32
+ - task:
33
+ type: text-classification
34
+ name: Text Classification
35
+ dataset:
36
+ name: Unknown
37
+ type: unknown
38
+ split: test
39
+ metrics:
40
+ - type: accuracy
41
+ value: 0.7171717171717171
42
+ name: Accuracy
43
+ - type: precision
44
+ value: 0.7171717171717171
45
+ name: Precision
46
+ - type: recall
47
+ value: 0.7171717171717171
48
+ name: Recall
49
+ - type: f1
50
+ value: 0.7171717171717171
51
+ name: F1
52
+ ---
53
+
54
+ # SetFit with firqaaa/indo-sentence-bert-base
55
+
56
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [firqaaa/indo-sentence-bert-base](https://huggingface.co/firqaaa/indo-sentence-bert-base) 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.
57
+
58
+ The model has been trained using an efficient few-shot learning technique that involves:
59
+
60
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
61
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
62
+
63
+ ## Model Details
64
+
65
+ ### Model Description
66
+ - **Model Type:** SetFit
67
+ - **Sentence Transformer body:** [firqaaa/indo-sentence-bert-base](https://huggingface.co/firqaaa/indo-sentence-bert-base)
68
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
69
+ - **Maximum Sequence Length:** 512 tokens
70
+ - **Number of Classes:** 3 classes
71
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
72
+ <!-- - **Language:** Unknown -->
73
+ <!-- - **License:** Unknown -->
74
+
75
+ ### Model Sources
76
+
77
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
78
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
79
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
80
+
81
+ ### Model Labels
82
+ | Label | Examples |
83
+ |:------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
84
+ | 2 | <ul><li>'nasi campur terkenal di bandung , info nya nasi campur pertama di bandung . mengandung b2 . rasa standar nasi campur . ada babi merah , babi panggang , sate babi manis , bakso goreng , jerohan manis . layanan tidak ramah , maklum masih generasi tua yang beraksi . lokasi makan lumayan bersih tapi tidak berat'</li><li>'saya di cgv marvel city sby mau verifikasi sms redam , tapi di informasi telkomsel trobel , menyebalkan !'</li><li>'indonesia itu tipe yang kalau sudah down pasti susah bangkit lagi'</li></ul> |
85
+ | 1 | <ul><li>'biru ada 4 , hijau ada 4 , merah ada 3 , kuning ada 3'</li><li>'baik terima kasih banyak'</li><li>'hai , ya , silakan kamu dapat mencoba lakukan pembayaran pdam di bukalapak .'</li></ul> |
86
+ | 0 | <ul><li>'nyaman banget kalau lagi nongkrong kenyang di warung upnormal . mulai dari pilihan menu nya yang serius banget digarap , dari pelayan2 nya yang kece , sampai ke interior nya yang super . rekomendasi banget deh kalau mau mengerjakan tugas , arisan , ulang tahun , reunian di sini .'</li><li>'conggo gallrely cafe di bandung utara . cafe nya sih okok saja . yang menarik adalah produksi meja dengan kayu-kayu yang panjang dan tebal khusus untuk meja makan .'</li><li>'terima kasih mas'</li></ul> |
87
+
88
+ ## Evaluation
89
+
90
+ ### Metrics
91
+ | Label | Accuracy | Precision | Recall | F1 |
92
+ |:--------|:---------|:----------|:-------|:-------|
93
+ | **all** | 0.7172 | 0.7172 | 0.7172 | 0.7172 |
94
+
95
+ ## Uses
96
+
97
+ ### Direct Use for Inference
98
+
99
+ First install the SetFit library:
100
+
101
+ ```bash
102
+ pip install setfit
103
+ ```
104
+
105
+ Then you can load this model and run inference.
106
+
107
+ ```python
108
+ from setfit import SetFitModel
109
+
110
+ # Download from the 🤗 Hub
111
+ model = SetFitModel.from_pretrained("TRUEnder/setfit-indosentencebert-indonlusmsa-8-shot")
112
+ # Run inference
113
+ preds = model("liverpool sukses di kandang tottenham")
114
+ ```
115
+
116
+ <!--
117
+ ### Downstream Use
118
+
119
+ *List how someone could finetune this model on their own dataset.*
120
+ -->
121
+
122
+ <!--
123
+ ### Out-of-Scope Use
124
+
125
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
126
+ -->
127
+
128
+ <!--
129
+ ## Bias, Risks and Limitations
130
+
131
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
132
+ -->
133
+
134
+ <!--
135
+ ### Recommendations
136
+
137
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
138
+ -->
139
+
140
+ ## Training Details
141
+
142
+ ### Training Set Metrics
143
+ | Training set | Min | Median | Max |
144
+ |:-------------|:----|:--------|:----|
145
+ | Word count | 3 | 22.7917 | 61 |
146
+
147
+ | Label | Training Sample Count |
148
+ |:------|:----------------------|
149
+ | 0 | 8 |
150
+ | 1 | 8 |
151
+ | 2 | 8 |
152
+
153
+ ### Training Hyperparameters
154
+ - batch_size: (16, 2)
155
+ - num_epochs: (2, 16)
156
+ - max_steps: -1
157
+ - sampling_strategy: oversampling
158
+ - body_learning_rate: (2e-05, 1e-05)
159
+ - head_learning_rate: 0.01
160
+ - loss: CosineSimilarityLoss
161
+ - distance_metric: cosine_distance
162
+ - margin: 0.25
163
+ - end_to_end: False
164
+ - use_amp: False
165
+ - warmup_proportion: 0.1
166
+ - seed: 42
167
+ - eval_max_steps: -1
168
+ - load_best_model_at_end: True
169
+
170
+ ### Training Results
171
+ | Epoch | Step | Training Loss | Validation Loss |
172
+ |:-------:|:------:|:-------------:|:---------------:|
173
+ | 0.0417 | 1 | 0.3908 | - |
174
+ | 0.0833 | 2 | 0.2962 | - |
175
+ | 0.125 | 3 | 0.2397 | - |
176
+ | 0.1667 | 4 | 0.3493 | - |
177
+ | 0.2083 | 5 | 0.2197 | - |
178
+ | 0.25 | 6 | 0.3782 | - |
179
+ | 0.2917 | 7 | 0.2341 | - |
180
+ | 0.3333 | 8 | 0.2166 | - |
181
+ | 0.375 | 9 | 0.3381 | - |
182
+ | 0.4167 | 10 | 0.1212 | - |
183
+ | 0.4583 | 11 | 0.1849 | - |
184
+ | 0.5 | 12 | 0.1796 | - |
185
+ | 0.5417 | 13 | 0.2027 | - |
186
+ | 0.5833 | 14 | 0.1824 | - |
187
+ | 0.625 | 15 | 0.1242 | - |
188
+ | 0.6667 | 16 | 0.1071 | - |
189
+ | 0.7083 | 17 | 0.1324 | - |
190
+ | 0.75 | 18 | 0.0667 | - |
191
+ | 0.7917 | 19 | 0.1095 | - |
192
+ | 0.8333 | 20 | 0.1277 | - |
193
+ | 0.875 | 21 | 0.0506 | - |
194
+ | 0.9167 | 22 | 0.0661 | - |
195
+ | 0.9583 | 23 | 0.0776 | - |
196
+ | 1.0 | 24 | 0.0371 | 0.2406 |
197
+ | 1.0417 | 25 | 0.0652 | - |
198
+ | 1.0833 | 26 | 0.0698 | - |
199
+ | 1.125 | 27 | 0.0775 | - |
200
+ | 1.1667 | 28 | 0.052 | - |
201
+ | 1.2083 | 29 | 0.0399 | - |
202
+ | 1.25 | 30 | 0.0189 | - |
203
+ | 1.2917 | 31 | 0.0341 | - |
204
+ | 1.3333 | 32 | 0.0259 | - |
205
+ | 1.375 | 33 | 0.0844 | - |
206
+ | 1.4167 | 34 | 0.0322 | - |
207
+ | 1.4583 | 35 | 0.0186 | - |
208
+ | 1.5 | 36 | 0.0328 | - |
209
+ | 1.5417 | 37 | 0.0107 | - |
210
+ | 1.5833 | 38 | 0.027 | - |
211
+ | 1.625 | 39 | 0.0311 | - |
212
+ | 1.6667 | 40 | 0.0244 | - |
213
+ | 1.7083 | 41 | 0.0277 | - |
214
+ | 1.75 | 42 | 0.0132 | - |
215
+ | 1.7917 | 43 | 0.0153 | - |
216
+ | 1.8333 | 44 | 0.0147 | - |
217
+ | 1.875 | 45 | 0.0074 | - |
218
+ | 1.9167 | 46 | 0.0142 | - |
219
+ | 1.9583 | 47 | 0.0189 | - |
220
+ | **2.0** | **48** | **0.0095** | **0.2139** |
221
+
222
+ * The bold row denotes the saved checkpoint.
223
+ ### Framework Versions
224
+ - Python: 3.10.12
225
+ - SetFit: 1.0.3
226
+ - Sentence Transformers: 3.0.1
227
+ - Transformers: 4.41.2
228
+ - PyTorch: 2.3.0+cu121
229
+ - Datasets: 2.19.2
230
+ - Tokenizers: 0.19.1
231
+
232
+ ## Citation
233
+
234
+ ### BibTeX
235
+ ```bibtex
236
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
237
+ doi = {10.48550/ARXIV.2209.11055},
238
+ url = {https://arxiv.org/abs/2209.11055},
239
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
240
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
241
+ title = {Efficient Few-Shot Learning Without Prompts},
242
+ publisher = {arXiv},
243
+ year = {2022},
244
+ copyright = {Creative Commons Attribution 4.0 International}
245
+ }
246
+ ```
247
+
248
+ <!--
249
+ ## Glossary
250
+
251
+ *Clearly define terms in order to be accessible across audiences.*
252
+ -->
253
+
254
+ <!--
255
+ ## Model Card Authors
256
+
257
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
258
+ -->
259
+
260
+ <!--
261
+ ## Model Card Contact
262
+
263
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
264
+ -->
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "checkpoints/step_48",
3
+ "_num_labels": 5,
4
+ "architectures": [
5
+ "BertModel"
6
+ ],
7
+ "attention_probs_dropout_prob": 0.1,
8
+ "classifier_dropout": null,
9
+ "directionality": "bidi",
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 768,
13
+ "id2label": {
14
+ "0": "LABEL_0",
15
+ "1": "LABEL_1",
16
+ "2": "LABEL_2",
17
+ "3": "LABEL_3",
18
+ "4": "LABEL_4"
19
+ },
20
+ "initializer_range": 0.02,
21
+ "intermediate_size": 3072,
22
+ "label2id": {
23
+ "LABEL_0": 0,
24
+ "LABEL_1": 1,
25
+ "LABEL_2": 2,
26
+ "LABEL_3": 3,
27
+ "LABEL_4": 4
28
+ },
29
+ "layer_norm_eps": 1e-12,
30
+ "max_position_embeddings": 512,
31
+ "model_type": "bert",
32
+ "num_attention_heads": 12,
33
+ "num_hidden_layers": 12,
34
+ "output_past": true,
35
+ "pad_token_id": 0,
36
+ "pooler_fc_size": 768,
37
+ "pooler_num_attention_heads": 12,
38
+ "pooler_num_fc_layers": 3,
39
+ "pooler_size_per_head": 128,
40
+ "pooler_type": "first_token_transform",
41
+ "position_embedding_type": "absolute",
42
+ "torch_dtype": "float32",
43
+ "transformers_version": "4.41.2",
44
+ "type_vocab_size": 2,
45
+ "use_cache": true,
46
+ "vocab_size": 50000
47
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.0.1",
4
+ "transformers": "4.41.2",
5
+ "pytorch": "2.3.0+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
10
+ }
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:8bc9fd46b19dbb7be1ebfb36f446fe0a8d6b49a79d9797972019e4e24a9923a2
3
+ size 497787752
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3404f041a045271a7e39045d4890366533666624dca03d3ae02e7437996a0948
3
+ size 19327
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,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "1": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
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_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "mask_token": "[MASK]",
49
+ "max_length": 512,
50
+ "model_max_length": 512,
51
+ "never_split": null,
52
+ "pad_to_multiple_of": null,
53
+ "pad_token": "[PAD]",
54
+ "pad_token_type_id": 0,
55
+ "padding_side": "right",
56
+ "sep_token": "[SEP]",
57
+ "stride": 0,
58
+ "strip_accents": null,
59
+ "tokenize_chinese_chars": true,
60
+ "tokenizer_class": "BertTokenizer",
61
+ "truncation_side": "right",
62
+ "truncation_strategy": "longest_first",
63
+ "unk_token": "[UNK]"
64
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff