qxuanson commited on
Commit
7654000
·
verified ·
1 Parent(s): 2501948

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": 768,
3
+ "pooling_mode_cls_token": true,
4
+ "pooling_mode_mean_tokens": false,
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,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Cổ phiếu nào giao dịch mạnh và sôi động nhất rổ VN30 phiên chiều ngày 11/6/2025?
9
+ - text: Chỉ số VN-Index đã tăng bao nhiêu điểm và đạt mức nào vào cuối phiên giao
10
+ dịch ngày 12/5?
11
+ - text: Hợp đồng VN30F2506 đóng cửa tại mức điểm nào vào ngày 28/5?
12
+ - text: Khối lượng giao dịch bình quân sản phẩm hợp đồng tương lai chỉ số VN30 trong
13
+ tháng 4/2025 đã tăng bao nhiêu phần trăm so với tháng trước?
14
+ - text: Tính đến cuối năm 2024, tổng thu ngân sách nhà nước đạt được là bao nhiêu
15
+ và đạt tỷ lệ nào so với mục tiêu giai đoạn 2021-2025?
16
+ metrics:
17
+ - accuracy
18
+ pipeline_tag: text-classification
19
+ library_name: setfit
20
+ inference: true
21
+ base_model: Alibaba-NLP/gte-multilingual-base
22
+ model-index:
23
+ - name: SetFit with Alibaba-NLP/gte-multilingual-base
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: accuracy
34
+ value: 0.95
35
+ name: Accuracy
36
+ ---
37
+
38
+ # SetFit with Alibaba-NLP/gte-multilingual-base
39
+
40
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [Alibaba-NLP/gte-multilingual-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-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.
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:** [Alibaba-NLP/gte-multilingual-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-base)
52
+ - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
53
+ - **Maximum Sequence Length:** 8192 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
+ | index | <ul><li>'Giá vàng thế giới quy đổi theo tỷ giá hiện hành tại Vietcombank là bao nhiêu, chưa tính thuế và phí?'</li><li>'Chỉ số VN-Index đã tăng bao nhiêu điểm và đạt mức nào vào cuối phiên giao dịch ngày 12/5?'</li><li>'VN-Index đã thay đổi như thế nào và đóng cửa ở mức bao nhiêu điểm trong phiên giao dịch ngày 16/5/2025?'</li></ul> |
69
+ | news | <ul><li>'Theo giải trình từ PHR, yếu tố nào đã giúp lợi nhuận ròng quý I/2025 tăng trưởng dù doanh thu giảm?'</li><li>'Giá trị mua ròng của khối ngoại trên thị trường chứng khoán Việt Nam trong phiên giao dịch ngày 14/5 là bao nhiêu?'</li><li>'Vì sao HOSE đưa cổ phiếu PSH sang diện kiểm soát từ ngày 14/5/2025?'</li></ul> |
70
+
71
+ ## Evaluation
72
+
73
+ ### Metrics
74
+ | Label | Accuracy |
75
+ |:--------|:---------|
76
+ | **all** | 0.95 |
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("qxuanson/setfit-gte-base-20-shot")
95
+ # Run inference
96
+ preds = model("Hợp đồng VN30F2506 đóng cửa tại mức điểm nào vào ngày 28/5?")
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 | 12 | 19.3 | 28 |
129
+
130
+ | Label | Training Sample Count |
131
+ |:------|:----------------------|
132
+ | index | 20 |
133
+ | news | 20 |
134
+
135
+ ### Training Hyperparameters
136
+ - batch_size: (32, 32)
137
+ - num_epochs: (10, 10)
138
+ - max_steps: -1
139
+ - sampling_strategy: oversampling
140
+ - body_learning_rate: (2e-05, 1e-05)
141
+ - head_learning_rate: 0.01
142
+ - loss: CosineSimilarityLoss
143
+ - distance_metric: cosine_distance
144
+ - margin: 0.25
145
+ - end_to_end: False
146
+ - use_amp: False
147
+ - warmup_proportion: 0.1
148
+ - l2_weight: 0.01
149
+ - seed: 42
150
+ - eval_max_steps: -1
151
+ - load_best_model_at_end: False
152
+
153
+ ### Training Results
154
+ | Epoch | Step | Training Loss | Validation Loss |
155
+ |:------:|:----:|:-------------:|:---------------:|
156
+ | 0.0714 | 1 | 0.234 | - |
157
+ | 3.5714 | 50 | 0.0868 | - |
158
+ | 7.1429 | 100 | 0.0015 | - |
159
+
160
+ ### Framework Versions
161
+ - Python: 3.11.11
162
+ - SetFit: 1.1.2
163
+ - Sentence Transformers: 3.4.1
164
+ - Transformers: 4.51.3
165
+ - PyTorch: 2.6.0+cu124
166
+ - Datasets: 3.6.0
167
+ - Tokenizers: 0.21.1
168
+
169
+ ## Citation
170
+
171
+ ### BibTeX
172
+ ```bibtex
173
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
174
+ doi = {10.48550/ARXIV.2209.11055},
175
+ url = {https://arxiv.org/abs/2209.11055},
176
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
177
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
178
+ title = {Efficient Few-Shot Learning Without Prompts},
179
+ publisher = {arXiv},
180
+ year = {2022},
181
+ copyright = {Creative Commons Attribution 4.0 International}
182
+ }
183
+ ```
184
+
185
+ <!--
186
+ ## Glossary
187
+
188
+ *Clearly define terms in order to be accessible across audiences.*
189
+ -->
190
+
191
+ <!--
192
+ ## Model Card Authors
193
+
194
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
195
+ -->
196
+
197
+ <!--
198
+ ## Model Card Contact
199
+
200
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
201
+ -->
config.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "NewModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "Alibaba-NLP/new-impl--configuration.NewConfig",
8
+ "AutoModel": "Alibaba-NLP/new-impl--modeling.NewModel",
9
+ "AutoModelForMaskedLM": "Alibaba-NLP/new-impl--modeling.NewForMaskedLM",
10
+ "AutoModelForMultipleChoice": "Alibaba-NLP/new-impl--modeling.NewForMultipleChoice",
11
+ "AutoModelForQuestionAnswering": "Alibaba-NLP/new-impl--modeling.NewForQuestionAnswering",
12
+ "AutoModelForSequenceClassification": "Alibaba-NLP/new-impl--modeling.NewForSequenceClassification",
13
+ "AutoModelForTokenClassification": "Alibaba-NLP/new-impl--modeling.NewForTokenClassification"
14
+ },
15
+ "classifier_dropout": 0.0,
16
+ "hidden_act": "gelu",
17
+ "hidden_dropout_prob": 0.1,
18
+ "hidden_size": 768,
19
+ "id2label": {
20
+ "0": "LABEL_0"
21
+ },
22
+ "initializer_range": 0.02,
23
+ "intermediate_size": 3072,
24
+ "label2id": {
25
+ "LABEL_0": 0
26
+ },
27
+ "layer_norm_eps": 1e-12,
28
+ "layer_norm_type": "layer_norm",
29
+ "logn_attention_clip1": false,
30
+ "logn_attention_scale": false,
31
+ "max_position_embeddings": 8192,
32
+ "model_type": "new",
33
+ "num_attention_heads": 12,
34
+ "num_hidden_layers": 12,
35
+ "pack_qkv": true,
36
+ "pad_token_id": 1,
37
+ "position_embedding_type": "rope",
38
+ "rope_scaling": {
39
+ "factor": 8.0,
40
+ "type": "ntk"
41
+ },
42
+ "rope_theta": 20000,
43
+ "torch_dtype": "float32",
44
+ "transformers_version": "4.51.3",
45
+ "type_vocab_size": 1,
46
+ "unpad_inputs": false,
47
+ "use_memory_efficient_attention": false,
48
+ "vocab_size": 250048
49
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.4.1",
4
+ "transformers": "4.51.3",
5
+ "pytorch": "2.6.0+cu124"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
config_setfit.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "normalize_embeddings": false,
3
+ "labels": [
4
+ "index",
5
+ "news"
6
+ ]
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b254be3f61f138f57c634390e29082ab58048746fb25c18bed151c76f645ff22
3
+ size 1221487872
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ddb41028c3f3a1f2cbc3bc3bca84bc3a5eaae15da91b83a24a233ced4324ac9
3
+ size 7007
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 8192,
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:aa7a6ad87a7ce8fe196787355f6af7d03aee94d19c54a5eb1392ed18c8ef451a
3
+ size 17082988
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "eos_token": "</s>",
48
+ "extra_special_tokens": {},
49
+ "mask_token": "<mask>",
50
+ "model_max_length": 8192,
51
+ "pad_token": "<pad>",
52
+ "sep_token": "</s>",
53
+ "tokenizer_class": "XLMRobertaTokenizerFast",
54
+ "unk_token": "<unk>"
55
+ }