TRUEnder commited on
Commit
6f0243a
1 Parent(s): f6ee16e

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,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.7676767676767676
42
+ name: Accuracy
43
+ - type: precision
44
+ value: 0.7676767676767676
45
+ name: Precision
46
+ - type: recall
47
+ value: 0.7676767676767676
48
+ name: Recall
49
+ - type: f1
50
+ value: 0.7676767676767676
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>'hampir semua musala di stasiun jalur ke bogor kondisi nya juga terlalu sempit dan fasilitas wudhu yang kurang . bahkan sekelas stasiun besar bogor .'</li><li>'tangkap saja pak si penyanyi gadungan itu . kerjaan nya cuma fitnah di media sosial saja .'</li><li>'saya di cgv marvel city sby mau verifikasi sms redam , tapi di informasi telkomsel trobel , menyebalkan !'</li></ul> |
85
+ | 1 | <ul><li>'bapak berkumis lebat itu menyebrang menggunakan zebra cross'</li><li>'kaitan kalung cantik bahan perak / silver 925'</li><li>'duo red bull mendominasi latihan bebas pertama f1 gp singapura'</li></ul> |
86
+ | 0 | <ul><li>'jokowi sayang dan cinta kepada rakyat nya'</li><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>'rasanya lumayan . sambel nya juga enak . apalagi disajikan 3 macam model begitu . terus banyak pilihan sih sebenarnya mau makan apa di sini . mau gurame , mau kakap , bawal , kerang , cumi , udang . macem-macem deh . asal jangan pesan ikan kembung saja . tidak ada di sini .'</li></ul> |
87
+
88
+ ## Evaluation
89
+
90
+ ### Metrics
91
+ | Label | Accuracy | Precision | Recall | F1 |
92
+ |:--------|:---------|:----------|:-------|:-------|
93
+ | **all** | 0.7677 | 0.7677 | 0.7677 | 0.7677 |
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-16-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 | 1 | 21.4792 | 64 |
146
+
147
+ | Label | Training Sample Count |
148
+ |:------|:----------------------|
149
+ | 0 | 16 |
150
+ | 1 | 16 |
151
+ | 2 | 16 |
152
+
153
+ ### Training Hyperparameters
154
+ - batch_size: (16, 2)
155
+ - num_epochs: (6, 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
+ | **1.0** | **96** | **0.0009** | **0.1923** |
174
+ | 2.0 | 192 | 0.0002 | 0.1977 |
175
+ | 3.0 | 288 | 0.0002 | 0.2011 |
176
+ | 4.0 | 384 | 0.0002 | 0.203 |
177
+ | 5.0 | 480 | 0.0001 | 0.2042 |
178
+ | 6.0 | 576 | 0.0001 | 0.2046 |
179
+
180
+ * The bold row denotes the saved checkpoint.
181
+ ### Framework Versions
182
+ - Python: 3.10.12
183
+ - SetFit: 1.0.3
184
+ - Sentence Transformers: 3.0.1
185
+ - Transformers: 4.41.2
186
+ - PyTorch: 2.3.0+cu121
187
+ - Datasets: 2.19.2
188
+ - Tokenizers: 0.19.1
189
+
190
+ ## Citation
191
+
192
+ ### BibTeX
193
+ ```bibtex
194
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
195
+ doi = {10.48550/ARXIV.2209.11055},
196
+ url = {https://arxiv.org/abs/2209.11055},
197
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
198
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
199
+ title = {Efficient Few-Shot Learning Without Prompts},
200
+ publisher = {arXiv},
201
+ year = {2022},
202
+ copyright = {Creative Commons Attribution 4.0 International}
203
+ }
204
+ ```
205
+
206
+ <!--
207
+ ## Glossary
208
+
209
+ *Clearly define terms in order to be accessible across audiences.*
210
+ -->
211
+
212
+ <!--
213
+ ## Model Card Authors
214
+
215
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
216
+ -->
217
+
218
+ <!--
219
+ ## Model Card Contact
220
+
221
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
222
+ -->
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "checkpoints/step_96",
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
+ "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:f50adf334a998f747978da877711115619ef7215e8911f68cdb0a922ed1044f9
3
+ size 497787752
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:babe846dbb4a00d0b3f89e51cc2b3b9bcb2073b6d9dd50c8a57c1564aa48aee2
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