Add SetFit model
Browse files- README.md +45 -39
- config.json +1 -1
- model.safetensors +1 -1
- model_head.pkl +1 -1
README.md
CHANGED
@@ -9,14 +9,34 @@ base_model: sentence-transformers/all-MiniLM-L6-v2
|
|
9 |
metrics:
|
10 |
- accuracy
|
11 |
widget:
|
12 |
-
- text:
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
pipeline_tag: text-classification
|
21 |
inference: true
|
22 |
model-index:
|
@@ -31,26 +51,12 @@ model-index:
|
|
31 |
split: test
|
32 |
metrics:
|
33 |
- type: accuracy
|
34 |
-
value: 0.
|
35 |
name: Accuracy
|
36 |
-
license: mit
|
37 |
-
datasets:
|
38 |
-
- chibao24/gpt_routing
|
39 |
-
language:
|
40 |
-
- vi
|
41 |
-
- en
|
42 |
---
|
43 |
|
44 |
# SetFit with sentence-transformers/all-MiniLM-L6-v2
|
45 |
|
46 |
-
This model is gpt routing between gpt.5 and gpt-4o based on my prompt (to reduce cost). You can take a look at the dataset for more information.
|
47 |
-
I got the idea from this [LLM classifier](https://github.com/lamini-ai/llm-classifier)
|
48 |
-
|
49 |
-
The model utilizes Few-Shot Learning techniques through SetFit, requiring only 8 examples per class. It can be trained in less than 1 minute on an RTX 3060 graphics card.
|
50 |
-
This method provides an efficient solution for developing lightweight models suitable for real-world applications.
|
51 |
-
|
52 |
-
The source code can be found in my repo [mrzaizai2k/LLM-with-RAG](https://github.com/mrzaizai2k/LLM-with-RAG)
|
53 |
-
|
54 |
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-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.
|
55 |
|
56 |
The model has been trained using an efficient few-shot learning technique that involves:
|
@@ -77,17 +83,17 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
77 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
78 |
|
79 |
### Model Labels
|
80 |
-
| Label | Examples
|
81 |
-
|
82 |
-
| 1 | <ul><li>'
|
83 |
-
| 0 | <ul><li>'
|
84 |
|
85 |
## Evaluation
|
86 |
|
87 |
### Metrics
|
88 |
| Label | Accuracy |
|
89 |
|:--------|:---------|
|
90 |
-
| **all** | 0.
|
91 |
|
92 |
## Uses
|
93 |
|
@@ -107,7 +113,7 @@ from setfit import SetFitModel
|
|
107 |
# Download from the 🤗 Hub
|
108 |
model = SetFitModel.from_pretrained("chibao24/model_routing_few_shot")
|
109 |
# Run inference
|
110 |
-
preds = model("
|
111 |
```
|
112 |
|
113 |
<!--
|
@@ -139,7 +145,7 @@ preds = model("What are the benefits of using cloud storage?")
|
|
139 |
### Training Set Metrics
|
140 |
| Training set | Min | Median | Max |
|
141 |
|:-------------|:----|:--------|:----|
|
142 |
-
| Word count | 4 |
|
143 |
|
144 |
| Label | Training Sample Count |
|
145 |
|:------|:----------------------|
|
@@ -166,15 +172,15 @@ preds = model("What are the benefits of using cloud storage?")
|
|
166 |
### Training Results
|
167 |
| Epoch | Step | Training Loss | Validation Loss |
|
168 |
|:-------:|:-------:|:-------------:|:---------------:|
|
169 |
-
| 0.0164 | 1 | 0.
|
170 |
-
| 0.8197 | 50 | 0.
|
171 |
-
| 1.0 | 61 | - | 0.
|
172 |
-
| 1.6393 | 100 | 0.
|
173 |
-
| 2.0
|
174 |
-
| 2.4590 | 150 | 0.
|
175 |
-
|
|
176 |
-
| 3.2787 | 200 | 0.
|
177 |
-
| 4.0 | 244 | - | 0.
|
178 |
|
179 |
* The bold row denotes the saved checkpoint.
|
180 |
### Framework Versions
|
|
|
9 |
metrics:
|
10 |
- accuracy
|
11 |
widget:
|
12 |
+
- text: 'Which of the following is a Code-Based Test Coverage Metrics(E. F. Miller,
|
13 |
+
1977 dissertation)?
|
14 |
+
|
15 |
+
Câu hỏi 1Trả lời
|
16 |
+
|
17 |
+
|
18 |
+
a.
|
19 |
+
|
20 |
+
C1c: Every condition outcome
|
21 |
+
|
22 |
+
|
23 |
+
b.
|
24 |
+
|
25 |
+
MMCC: Multiple Module condition coverage
|
26 |
+
|
27 |
+
|
28 |
+
c.
|
29 |
+
|
30 |
+
Cx - Every "x" statement ("x" can be single, double, triple)
|
31 |
+
|
32 |
+
|
33 |
+
d.
|
34 |
+
|
35 |
+
C2: C0 coverage + loop coverage'
|
36 |
+
- text: Phần mềm kiểm thử là gì?
|
37 |
+
- text: Giải thích sự khác biệt giữa kiểm thử hộp đen và kiểm thử hộp trắng. Cung
|
38 |
+
cấp ví dụ cho từng loại. (ít nhất 150 từ)
|
39 |
+
- text: Thủ đô của nước Pháp là gì?
|
40 |
pipeline_tag: text-classification
|
41 |
inference: true
|
42 |
model-index:
|
|
|
51 |
split: test
|
52 |
metrics:
|
53 |
- type: accuracy
|
54 |
+
value: 0.5
|
55 |
name: Accuracy
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
---
|
57 |
|
58 |
# SetFit with sentence-transformers/all-MiniLM-L6-v2
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-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.
|
61 |
|
62 |
The model has been trained using an efficient few-shot learning technique that involves:
|
|
|
83 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
84 |
|
85 |
### Model Labels
|
86 |
+
| Label | Examples |
|
87 |
+
|:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
88 |
+
| 1 | <ul><li>'Giải thích sự khác biệt giữa mô hình học có giám sát và không giám sát. Cung cấp ví dụ cho từng loại. (ít nhất 150 từ)'</li><li>'Analyze the time complexity of the merge sort algorithm.'</li><li>'Xác suất để trúng giải thưởng khi bạn mua một tờ vé số là 0.05%. Giả sử mỗi ngày bạn mua 1 tờ vé số, vậy\nchúng ta cần bao nhiêu ngày (trung bình) để có 98% cơ hội trúng?'</li></ul> |
|
89 |
+
| 0 | <ul><li>'Nêu ngắn gọn về quá trình quang hợp.'</li><li>'Viết một hàm Python tính giai thừa của một số.'</li><li>'Briefly describe the concept of photosynthesis.'</li></ul> |
|
90 |
|
91 |
## Evaluation
|
92 |
|
93 |
### Metrics
|
94 |
| Label | Accuracy |
|
95 |
|:--------|:---------|
|
96 |
+
| **all** | 0.5 |
|
97 |
|
98 |
## Uses
|
99 |
|
|
|
113 |
# Download from the 🤗 Hub
|
114 |
model = SetFitModel.from_pretrained("chibao24/model_routing_few_shot")
|
115 |
# Run inference
|
116 |
+
preds = model("Phần mềm kiểm thử là gì?")
|
117 |
```
|
118 |
|
119 |
<!--
|
|
|
145 |
### Training Set Metrics
|
146 |
| Training set | Min | Median | Max |
|
147 |
|:-------------|:----|:--------|:----|
|
148 |
+
| Word count | 4 | 24.7619 | 115 |
|
149 |
|
150 |
| Label | Training Sample Count |
|
151 |
|:------|:----------------------|
|
|
|
172 |
### Training Results
|
173 |
| Epoch | Step | Training Loss | Validation Loss |
|
174 |
|:-------:|:-------:|:-------------:|:---------------:|
|
175 |
+
| 0.0164 | 1 | 0.1956 | - |
|
176 |
+
| 0.8197 | 50 | 0.1926 | - |
|
177 |
+
| 1.0 | 61 | - | 0.1463 |
|
178 |
+
| 1.6393 | 100 | 0.0228 | - |
|
179 |
+
| **2.0** | **122** | **-** | **0.0374** |
|
180 |
+
| 2.4590 | 150 | 0.017 | - |
|
181 |
+
| 3.0 | 183 | - | 0.0507 |
|
182 |
+
| 3.2787 | 200 | 0.003 | - |
|
183 |
+
| 4.0 | 244 | - | 0.0443 |
|
184 |
|
185 |
* The bold row denotes the saved checkpoint.
|
186 |
### Framework Versions
|
config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "checkpoints/
|
3 |
"architectures": [
|
4 |
"BertModel"
|
5 |
],
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "checkpoints/step_122",
|
3 |
"architectures": [
|
4 |
"BertModel"
|
5 |
],
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 90864192
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2d69287a4f05099e3df3bcaec8f2156239fae83be7bb0c746d805ed7d0badafe
|
3 |
size 90864192
|
model_head.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 3935
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a0a75388482e120e36096e869ba84a8cfc7f08ec8bc417ed76de308380402661
|
3 |
size 3935
|