Bảo Mai Chí
commited on
Add SetFit model
Browse files- 1_Pooling/config.json +1 -1
- 2_Dense/config.json +1 -0
- 2_Dense/model.safetensors +3 -0
- README.md +34 -27
- config.json +17 -17
- config_setfit.json +2 -2
- model.safetensors +2 -2
- model_head.pkl +2 -2
- modules.json +2 -2
- sentence_bert_config.json +1 -1
- tokenizer.json +0 -0
- tokenizer_config.json +5 -3
- vocab.txt +0 -0
1_Pooling/config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"word_embedding_dimension":
|
3 |
"pooling_mode_cls_token": false,
|
4 |
"pooling_mode_mean_tokens": true,
|
5 |
"pooling_mode_max_tokens": false,
|
|
|
1 |
{
|
2 |
+
"word_embedding_dimension": 768,
|
3 |
"pooling_mode_cls_token": false,
|
4 |
"pooling_mode_mean_tokens": true,
|
5 |
"pooling_mode_max_tokens": false,
|
2_Dense/config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"in_features": 768, "out_features": 512, "bias": true, "activation_function": "torch.nn.modules.activation.Tanh"}
|
2_Dense/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:075d536dea66f90ccb766d9d3ed550f94b9331872d9e564a8cd65159ff61ddbf
|
3 |
+
size 1575072
|
README.md
CHANGED
@@ -5,10 +5,14 @@ tags:
|
|
5 |
- sentence-transformers
|
6 |
- text-classification
|
7 |
- generated_from_setfit_trainer
|
8 |
-
base_model: sentence-transformers/
|
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 |
|
@@ -33,14 +37,11 @@ widget:
|
|
33 |
d.
|
34 |
|
35 |
C2: C0 coverage + loop coverage'
|
36 |
-
- text:
|
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:
|
43 |
-
- name: SetFit with sentence-transformers/
|
44 |
results:
|
45 |
- task:
|
46 |
type: text-classification
|
@@ -55,9 +56,9 @@ model-index:
|
|
55 |
name: Accuracy
|
56 |
---
|
57 |
|
58 |
-
# SetFit with sentence-transformers/
|
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/
|
61 |
|
62 |
The model has been trained using an efficient few-shot learning technique that involves:
|
63 |
|
@@ -68,9 +69,9 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
68 |
|
69 |
### Model Description
|
70 |
- **Model Type:** SetFit
|
71 |
-
- **Sentence Transformer body:** [sentence-transformers/
|
72 |
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
73 |
-
- **Maximum Sequence Length:**
|
74 |
- **Number of Classes:** 2 classes
|
75 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
76 |
<!-- - **Language:** Unknown -->
|
@@ -83,10 +84,10 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
83 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
84 |
|
85 |
### Model Labels
|
86 |
-
| Label | Examples
|
87 |
-
|
88 |
-
|
|
89 |
-
|
|
90 |
|
91 |
## Evaluation
|
92 |
|
@@ -113,7 +114,7 @@ from setfit import SetFitModel
|
|
113 |
# Download from the 🤗 Hub
|
114 |
model = SetFitModel.from_pretrained("chibao24/model_routing_few_shot")
|
115 |
# Run inference
|
116 |
-
preds = model("
|
117 |
```
|
118 |
|
119 |
<!--
|
@@ -145,12 +146,12 @@ preds = model("Phần mềm kiểm thử là gì?")
|
|
145 |
### Training Set Metrics
|
146 |
| Training set | Min | Median | Max |
|
147 |
|:-------------|:----|:--------|:----|
|
148 |
-
| Word count |
|
149 |
|
150 |
| Label | Training Sample Count |
|
151 |
|:------|:----------------------|
|
152 |
-
| 0 |
|
153 |
-
| 1 |
|
154 |
|
155 |
### Training Hyperparameters
|
156 |
- batch_size: (4, 4)
|
@@ -172,15 +173,21 @@ preds = model("Phần mềm kiểm thử là gì?")
|
|
172 |
### Training Results
|
173 |
| Epoch | Step | Training Loss | Validation Loss |
|
174 |
|:-------:|:-------:|:-------------:|:---------------:|
|
175 |
-
| 0.
|
176 |
-
| 0.
|
177 |
-
|
|
178 |
-
| 1.
|
179 |
-
|
|
180 |
-
|
|
181 |
-
|
|
182 |
-
|
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
* The bold row denotes the saved checkpoint.
|
186 |
### Framework Versions
|
|
|
5 |
- sentence-transformers
|
6 |
- text-classification
|
7 |
- generated_from_setfit_trainer
|
8 |
+
base_model: sentence-transformers/distiluse-base-multilingual-cased-v2
|
9 |
metrics:
|
10 |
- accuracy
|
11 |
widget:
|
12 |
+
- text: explain in detail what is FFT and the complexity of it
|
13 |
+
- text: The p success of karger min cut after k steps
|
14 |
+
- text: 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
|
15 |
+
cấp ví dụ cho từng loại. (ít nhất 150 từ)
|
16 |
- text: 'Which of the following is a Code-Based Test Coverage Metrics(E. F. Miller,
|
17 |
1977 dissertation)?
|
18 |
|
|
|
37 |
d.
|
38 |
|
39 |
C2: C0 coverage + loop coverage'
|
40 |
+
- text: What is software testing?
|
|
|
|
|
|
|
41 |
pipeline_tag: text-classification
|
42 |
inference: true
|
43 |
model-index:
|
44 |
+
- name: SetFit with sentence-transformers/distiluse-base-multilingual-cased-v2
|
45 |
results:
|
46 |
- task:
|
47 |
type: text-classification
|
|
|
56 |
name: Accuracy
|
57 |
---
|
58 |
|
59 |
+
# SetFit with sentence-transformers/distiluse-base-multilingual-cased-v2
|
60 |
|
61 |
+
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/distiluse-base-multilingual-cased-v2](https://huggingface.co/sentence-transformers/distiluse-base-multilingual-cased-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.
|
62 |
|
63 |
The model has been trained using an efficient few-shot learning technique that involves:
|
64 |
|
|
|
69 |
|
70 |
### Model Description
|
71 |
- **Model Type:** SetFit
|
72 |
+
- **Sentence Transformer body:** [sentence-transformers/distiluse-base-multilingual-cased-v2](https://huggingface.co/sentence-transformers/distiluse-base-multilingual-cased-v2)
|
73 |
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
74 |
+
- **Maximum Sequence Length:** 128 tokens
|
75 |
- **Number of Classes:** 2 classes
|
76 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
77 |
<!-- - **Language:** Unknown -->
|
|
|
84 |
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
85 |
|
86 |
### Model Labels
|
87 |
+
| Label | Examples |
|
88 |
+
|:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
89 |
+
| 0 | <ul><li>'What is the capital of France?'</li><li>'Nêu ngắn gọn về quá trình quang hợp.'</li><li>'Briefly describe the concept of photosynthesis.'</li></ul> |
|
90 |
+
| 1 | <ul><li>'What is White-box testing?\nCâu hỏi 7Trả lời\n\na.\nAll of the other answers.\n\nb.\nA testing technique in which internal structure, design and coding of software are tested.\n\nc.\nIts foundation is to execute every part of the code at least once.\n\nd.\nIn this technique, code is visible to testers.'</li><li>'For the expression "(a AND (b OR c))", which of the following test-cases is Multiple Condition Coverage (MCC)?'</li><li>'The p success of karger min cut after k steps. Tell me the detail of the equation'</li></ul> |
|
91 |
|
92 |
## Evaluation
|
93 |
|
|
|
114 |
# Download from the 🤗 Hub
|
115 |
model = SetFitModel.from_pretrained("chibao24/model_routing_few_shot")
|
116 |
# Run inference
|
117 |
+
preds = model("What is software testing?")
|
118 |
```
|
119 |
|
120 |
<!--
|
|
|
146 |
### Training Set Metrics
|
147 |
| Training set | Min | Median | Max |
|
148 |
|:-------------|:----|:--------|:----|
|
149 |
+
| Word count | 3 | 20.2903 | 115 |
|
150 |
|
151 |
| Label | Training Sample Count |
|
152 |
|:------|:----------------------|
|
153 |
+
| 0 | 16 |
|
154 |
+
| 1 | 15 |
|
155 |
|
156 |
### Training Hyperparameters
|
157 |
- batch_size: (4, 4)
|
|
|
173 |
### Training Results
|
174 |
| Epoch | Step | Training Loss | Validation Loss |
|
175 |
|:-------:|:-------:|:-------------:|:---------------:|
|
176 |
+
| 0.0078 | 1 | 0.4319 | - |
|
177 |
+
| 0.3906 | 50 | 0.1028 | - |
|
178 |
+
| 0.7812 | 100 | 0.0021 | - |
|
179 |
+
| **1.0** | **128** | **-** | **0.2328** |
|
180 |
+
| 1.1719 | 150 | 0.0002 | - |
|
181 |
+
| 1.5625 | 200 | 0.0 | - |
|
182 |
+
| 1.9531 | 250 | 0.0001 | - |
|
183 |
+
| 2.0 | 256 | - | 0.3315 |
|
184 |
+
| 2.3438 | 300 | 0.0 | - |
|
185 |
+
| 2.7344 | 350 | 0.0002 | - |
|
186 |
+
| 3.0 | 384 | - | 0.2364 |
|
187 |
+
| 3.125 | 400 | 0.0001 | - |
|
188 |
+
| 3.5156 | 450 | 0.0 | - |
|
189 |
+
| 3.9062 | 500 | 0.0001 | - |
|
190 |
+
| 4.0 | 512 | - | 0.3333 |
|
191 |
|
192 |
* The bold row denotes the saved checkpoint.
|
193 |
### Framework Versions
|
config.json
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "checkpoints/
|
|
|
3 |
"architectures": [
|
4 |
-
"
|
5 |
],
|
6 |
-
"
|
7 |
-
"
|
8 |
-
"
|
9 |
-
"
|
10 |
-
"hidden_dropout_prob": 0.1,
|
11 |
-
"hidden_size": 384,
|
12 |
"initializer_range": 0.02,
|
13 |
-
"intermediate_size": 1536,
|
14 |
-
"layer_norm_eps": 1e-12,
|
15 |
"max_position_embeddings": 512,
|
16 |
-
"model_type": "
|
17 |
-
"
|
18 |
-
"
|
|
|
|
|
19 |
"pad_token_id": 0,
|
20 |
-
"
|
|
|
|
|
|
|
21 |
"torch_dtype": "float32",
|
22 |
"transformers_version": "4.41.2",
|
23 |
-
"
|
24 |
-
"use_cache": true,
|
25 |
-
"vocab_size": 30522
|
26 |
}
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "checkpoints/step_128",
|
3 |
+
"activation": "gelu",
|
4 |
"architectures": [
|
5 |
+
"DistilBertModel"
|
6 |
],
|
7 |
+
"attention_dropout": 0.1,
|
8 |
+
"dim": 768,
|
9 |
+
"dropout": 0.1,
|
10 |
+
"hidden_dim": 3072,
|
|
|
|
|
11 |
"initializer_range": 0.02,
|
|
|
|
|
12 |
"max_position_embeddings": 512,
|
13 |
+
"model_type": "distilbert",
|
14 |
+
"n_heads": 12,
|
15 |
+
"n_layers": 6,
|
16 |
+
"output_hidden_states": true,
|
17 |
+
"output_past": true,
|
18 |
"pad_token_id": 0,
|
19 |
+
"qa_dropout": 0.1,
|
20 |
+
"seq_classif_dropout": 0.2,
|
21 |
+
"sinusoidal_pos_embds": false,
|
22 |
+
"tie_weights_": true,
|
23 |
"torch_dtype": "float32",
|
24 |
"transformers_version": "4.41.2",
|
25 |
+
"vocab_size": 119547
|
|
|
|
|
26 |
}
|
config_setfit.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
|
|
2 |
"labels": [
|
3 |
0,
|
4 |
1
|
5 |
-
]
|
6 |
-
"normalize_embeddings": false
|
7 |
}
|
|
|
1 |
{
|
2 |
+
"normalize_embeddings": false,
|
3 |
"labels": [
|
4 |
0,
|
5 |
1
|
6 |
+
]
|
|
|
7 |
}
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:699c83648fa8570f6733bd6022605955a6fd5cb9f189f6b21d7e076466ea8357
|
3 |
+
size 538947416
|
model_head.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:846cbc06ae8101739d4132eefe3efa2ad30a334c426d9ba19156743aefac24c8
|
3 |
+
size 4959
|
modules.json
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
{
|
15 |
"idx": 2,
|
16 |
"name": "2",
|
17 |
-
"path": "
|
18 |
-
"type": "sentence_transformers.models.
|
19 |
}
|
20 |
]
|
|
|
14 |
{
|
15 |
"idx": 2,
|
16 |
"name": "2",
|
17 |
+
"path": "2_Dense",
|
18 |
+
"type": "sentence_transformers.models.Dense"
|
19 |
}
|
20 |
]
|
sentence_bert_config.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
{
|
2 |
-
"max_seq_length":
|
3 |
"do_lower_case": false
|
4 |
}
|
|
|
1 |
{
|
2 |
+
"max_seq_length": 128,
|
3 |
"do_lower_case": false
|
4 |
}
|
tokenizer.json
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
CHANGED
@@ -44,10 +44,12 @@
|
|
44 |
"clean_up_tokenization_spaces": true,
|
45 |
"cls_token": "[CLS]",
|
46 |
"do_basic_tokenize": true,
|
47 |
-
"do_lower_case":
|
|
|
48 |
"mask_token": "[MASK]",
|
|
|
49 |
"max_length": 128,
|
50 |
-
"model_max_length":
|
51 |
"never_split": null,
|
52 |
"pad_to_multiple_of": null,
|
53 |
"pad_token": "[PAD]",
|
@@ -57,7 +59,7 @@
|
|
57 |
"stride": 0,
|
58 |
"strip_accents": null,
|
59 |
"tokenize_chinese_chars": true,
|
60 |
-
"tokenizer_class": "
|
61 |
"truncation_side": "right",
|
62 |
"truncation_strategy": "longest_first",
|
63 |
"unk_token": "[UNK]"
|
|
|
44 |
"clean_up_tokenization_spaces": true,
|
45 |
"cls_token": "[CLS]",
|
46 |
"do_basic_tokenize": true,
|
47 |
+
"do_lower_case": false,
|
48 |
+
"full_tokenizer_file": null,
|
49 |
"mask_token": "[MASK]",
|
50 |
+
"max_len": 512,
|
51 |
"max_length": 128,
|
52 |
+
"model_max_length": 128,
|
53 |
"never_split": null,
|
54 |
"pad_to_multiple_of": null,
|
55 |
"pad_token": "[PAD]",
|
|
|
59 |
"stride": 0,
|
60 |
"strip_accents": null,
|
61 |
"tokenize_chinese_chars": true,
|
62 |
+
"tokenizer_class": "DistilBertTokenizer",
|
63 |
"truncation_side": "right",
|
64 |
"truncation_strategy": "longest_first",
|
65 |
"unk_token": "[UNK]"
|
vocab.txt
CHANGED
The diff for this file is too large to render.
See raw diff
|
|