Add SetFit model
Browse files- 1_Pooling/config.json +1 -1
- README.md +52 -55
- config.json +9 -19
- config_sentence_transformers.json +3 -3
- model.safetensors +2 -2
- model_head.pkl +2 -2
- modules.json +6 -0
- sentence_bert_config.json +1 -1
- tokenizer.json +2 -8
- tokenizer_config.json +8 -1
- vocab.txt +0 -6
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": 384,
|
3 |
"pooling_mode_cls_token": false,
|
4 |
"pooling_mode_mean_tokens": true,
|
5 |
"pooling_mode_max_tokens": false,
|
README.md
CHANGED
@@ -8,23 +8,27 @@ tags:
|
|
8 |
metrics:
|
9 |
- accuracy
|
10 |
widget:
|
11 |
-
- text:
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
pipeline_tag: text-classification
|
24 |
inference: true
|
25 |
-
base_model:
|
26 |
model-index:
|
27 |
-
- name: SetFit with
|
28 |
results:
|
29 |
- task:
|
30 |
type: text-classification
|
@@ -35,13 +39,13 @@ model-index:
|
|
35 |
split: test
|
36 |
metrics:
|
37 |
- type: accuracy
|
38 |
-
value: 0.
|
39 |
name: Accuracy
|
40 |
---
|
41 |
|
42 |
-
# SetFit with
|
43 |
|
44 |
-
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [
|
45 |
|
46 |
The model has been trained using an efficient few-shot learning technique that involves:
|
47 |
|
@@ -52,9 +56,9 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
52 |
|
53 |
### Model Description
|
54 |
- **Model Type:** SetFit
|
55 |
-
- **Sentence Transformer body:** [
|
56 |
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
57 |
-
- **Maximum Sequence Length:**
|
58 |
- **Number of Classes:** 9 classes
|
59 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
60 |
<!-- - **Language:** Unknown -->
|
@@ -84,7 +88,7 @@ The model has been trained using an efficient few-shot learning technique that i
|
|
84 |
### Metrics
|
85 |
| Label | Accuracy |
|
86 |
|:--------|:---------|
|
87 |
-
| **all** | 0.
|
88 |
|
89 |
## Uses
|
90 |
|
@@ -104,7 +108,7 @@ from setfit import SetFitModel
|
|
104 |
# Download from the 🤗 Hub
|
105 |
model = SetFitModel.from_pretrained("Corran/Jina_Sci")
|
106 |
# Run inference
|
107 |
-
preds = model("
|
108 |
```
|
109 |
|
110 |
<!--
|
@@ -136,26 +140,26 @@ preds = model("It is therefore likely that many PEV chargers will trip in the 0.
|
|
136 |
### Training Set Metrics
|
137 |
| Training set | Min | Median | Max |
|
138 |
|:-------------|:----|:--------|:----|
|
139 |
-
| Word count | 5 |
|
140 |
|
141 |
| Label | Training Sample Count |
|
142 |
|:------|:----------------------|
|
143 |
-
| 1 |
|
144 |
-
| 2 |
|
145 |
-
| 3 |
|
146 |
-
| 4 |
|
147 |
-
| 5 |
|
148 |
-
| 6 |
|
149 |
-
| 7 |
|
150 |
-
| 8 |
|
151 |
-
| 9 |
|
152 |
|
153 |
### Training Hyperparameters
|
154 |
-
- batch_size: (
|
155 |
- num_epochs: (1, 1)
|
156 |
- max_steps: -1
|
157 |
- sampling_strategy: oversampling
|
158 |
-
- num_iterations:
|
159 |
- body_learning_rate: (2e-05, 2e-05)
|
160 |
- head_learning_rate: 2e-05
|
161 |
- loss: CosineSimilarityLoss
|
@@ -171,28 +175,21 @@ preds = model("It is therefore likely that many PEV chargers will trip in the 0.
|
|
171 |
### Training Results
|
172 |
| Epoch | Step | Training Loss | Validation Loss |
|
173 |
|:------:|:----:|:-------------:|:---------------:|
|
174 |
-
| 0.
|
175 |
-
| 0.
|
176 |
-
| 0.
|
177 |
-
| 0.
|
178 |
-
| 0.
|
179 |
-
| 0.
|
180 |
-
| 0.
|
181 |
-
| 0.
|
182 |
-
| 0.
|
183 |
-
| 0.
|
184 |
-
| 0.
|
185 |
-
| 0.
|
186 |
-
| 0.
|
187 |
-
| 0.
|
188 |
-
| 0.
|
189 |
-
| 0.6944 | 750 | 0.0006 | - |
|
190 |
-
| 0.7407 | 800 | 0.0006 | - |
|
191 |
-
| 0.7870 | 850 | 0.0006 | - |
|
192 |
-
| 0.8333 | 900 | 0.0007 | - |
|
193 |
-
| 0.8796 | 950 | 0.0005 | - |
|
194 |
-
| 0.9259 | 1000 | 0.0004 | - |
|
195 |
-
| 0.9722 | 1050 | 0.0003 | - |
|
196 |
|
197 |
### Framework Versions
|
198 |
- Python: 3.10.12
|
|
|
8 |
metrics:
|
9 |
- accuracy
|
10 |
widget:
|
11 |
+
- text: '6) , it is interesting to note how, going from lateral to downstream positions,
|
12 |
+
from 1 to 13: -charged hadrons (protons, pions, kaons) contribution rises from
|
13 |
+
34% to 48%; -electrons and positrons contribution rises from 30% to 40%; -muons
|
14 |
+
doses are stable around the 3-4%, representing an almost negligible portion of
|
15 |
+
the total; -photons doses decrease from 24% to 7% in terms of contribution to
|
16 |
+
the total; -neutrons contribution goes down from 8.5% to 2.5% in terms of contribution
|
17 |
+
to the total.'
|
18 |
+
- text: the study was conducted in 2015 on adolescent undergraduate university students
|
19 |
+
of three fields of study -humanities, as well as medical and technical courses.
|
20 |
+
- text: For this purpose, it was first necessary to discover the interdependencies
|
21 |
+
of the data attributes.
|
22 |
+
- text: The patients included in this study were recruited from the Vascular Department
|
23 |
+
of West China Hospital, Sichuan University, between January 2009 and January 2011.
|
24 |
+
- text: 1 Likewise, age at diagnosis (P Ͻ 0.001), primary site (P ϭ 0.04), number
|
25 |
+
of positive nodes (P Ͻ 0.001), and depth of invasion (P Ͻ 0.001) had a significant
|
26 |
+
impact on diseasespecific survival of the MRI patients.
|
27 |
pipeline_tag: text-classification
|
28 |
inference: true
|
29 |
+
base_model: sentence-transformers/all-MiniLM-L6-v2
|
30 |
model-index:
|
31 |
+
- name: SetFit with sentence-transformers/all-MiniLM-L6-v2
|
32 |
results:
|
33 |
- task:
|
34 |
type: text-classification
|
|
|
39 |
split: test
|
40 |
metrics:
|
41 |
- type: accuracy
|
42 |
+
value: 0.9433333333333334
|
43 |
name: Accuracy
|
44 |
---
|
45 |
|
46 |
+
# SetFit with sentence-transformers/all-MiniLM-L6-v2
|
47 |
|
48 |
+
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.
|
49 |
|
50 |
The model has been trained using an efficient few-shot learning technique that involves:
|
51 |
|
|
|
56 |
|
57 |
### Model Description
|
58 |
- **Model Type:** SetFit
|
59 |
+
- **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
|
60 |
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
61 |
+
- **Maximum Sequence Length:** 256 tokens
|
62 |
- **Number of Classes:** 9 classes
|
63 |
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
64 |
<!-- - **Language:** Unknown -->
|
|
|
88 |
### Metrics
|
89 |
| Label | Accuracy |
|
90 |
|:--------|:---------|
|
91 |
+
| **all** | 0.9433 |
|
92 |
|
93 |
## Uses
|
94 |
|
|
|
108 |
# Download from the 🤗 Hub
|
109 |
model = SetFitModel.from_pretrained("Corran/Jina_Sci")
|
110 |
# Run inference
|
111 |
+
preds = model("For this purpose, it was first necessary to discover the interdependencies of the data attributes.")
|
112 |
```
|
113 |
|
114 |
<!--
|
|
|
140 |
### Training Set Metrics
|
141 |
| Training set | Min | Median | Max |
|
142 |
|:-------------|:----|:--------|:----|
|
143 |
+
| Word count | 5 | 26.2526 | 128 |
|
144 |
|
145 |
| Label | Training Sample Count |
|
146 |
|:------|:----------------------|
|
147 |
+
| 1 | 300 |
|
148 |
+
| 2 | 300 |
|
149 |
+
| 3 | 300 |
|
150 |
+
| 4 | 300 |
|
151 |
+
| 5 | 300 |
|
152 |
+
| 6 | 300 |
|
153 |
+
| 7 | 300 |
|
154 |
+
| 8 | 300 |
|
155 |
+
| 9 | 300 |
|
156 |
|
157 |
### Training Hyperparameters
|
158 |
+
- batch_size: (75, 75)
|
159 |
- num_epochs: (1, 1)
|
160 |
- max_steps: -1
|
161 |
- sampling_strategy: oversampling
|
162 |
+
- num_iterations: 10
|
163 |
- body_learning_rate: (2e-05, 2e-05)
|
164 |
- head_learning_rate: 2e-05
|
165 |
- loss: CosineSimilarityLoss
|
|
|
175 |
### Training Results
|
176 |
| Epoch | Step | Training Loss | Validation Loss |
|
177 |
|:------:|:----:|:-------------:|:---------------:|
|
178 |
+
| 0.0014 | 1 | 0.4034 | - |
|
179 |
+
| 0.0694 | 50 | 0.2314 | - |
|
180 |
+
| 0.1389 | 100 | 0.1816 | - |
|
181 |
+
| 0.2083 | 150 | 0.1708 | - |
|
182 |
+
| 0.2778 | 200 | 0.1079 | - |
|
183 |
+
| 0.3472 | 250 | 0.1407 | - |
|
184 |
+
| 0.4167 | 300 | 0.0788 | - |
|
185 |
+
| 0.4861 | 350 | 0.0565 | - |
|
186 |
+
| 0.5556 | 400 | 0.0651 | - |
|
187 |
+
| 0.625 | 450 | 0.0402 | - |
|
188 |
+
| 0.6944 | 500 | 0.0468 | - |
|
189 |
+
| 0.7639 | 550 | 0.055 | - |
|
190 |
+
| 0.8333 | 600 | 0.0473 | - |
|
191 |
+
| 0.9028 | 650 | 0.0605 | - |
|
192 |
+
| 0.9722 | 700 | 0.03 | - |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
### Framework Versions
|
195 |
- Python: 3.10.12
|
config.json
CHANGED
@@ -1,36 +1,26 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "/root/.cache/torch/sentence_transformers/
|
3 |
"architectures": [
|
4 |
-
"
|
5 |
],
|
6 |
-
"attention_probs_dropout_prob": 0.
|
7 |
-
"attn_implementation": "torch",
|
8 |
-
"auto_map": {
|
9 |
-
"AutoConfig": "configuration_bert.JinaBertConfig",
|
10 |
-
"AutoModel": "modeling_bert.JinaBertModel",
|
11 |
-
"AutoModelForMaskedLM": "jinaai/jina-bert-implementation--modeling_bert.JinaBertForMaskedLM",
|
12 |
-
"AutoModelForSequenceClassification": "jinaai/jina-bert-implementation--modeling_bert.JinaBertForSequenceClassification"
|
13 |
-
},
|
14 |
"classifier_dropout": null,
|
15 |
-
"emb_pooler": "mean",
|
16 |
-
"feed_forward_type": "geglu",
|
17 |
"gradient_checkpointing": false,
|
18 |
"hidden_act": "gelu",
|
19 |
"hidden_dropout_prob": 0.1,
|
20 |
-
"hidden_size":
|
21 |
"initializer_range": 0.02,
|
22 |
-
"intermediate_size":
|
23 |
"layer_norm_eps": 1e-12,
|
24 |
-
"max_position_embeddings":
|
25 |
-
"model_max_length": 8192,
|
26 |
"model_type": "bert",
|
27 |
"num_attention_heads": 12,
|
28 |
-
"num_hidden_layers":
|
29 |
"pad_token_id": 0,
|
30 |
-
"position_embedding_type": "
|
31 |
"torch_dtype": "float32",
|
32 |
"transformers_version": "4.35.2",
|
33 |
"type_vocab_size": 2,
|
34 |
"use_cache": true,
|
35 |
-
"vocab_size":
|
36 |
}
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "/root/.cache/torch/sentence_transformers/sentence-transformers_all-MiniLM-L6-v2/",
|
3 |
"architectures": [
|
4 |
+
"BertModel"
|
5 |
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
"classifier_dropout": null,
|
|
|
|
|
8 |
"gradient_checkpointing": false,
|
9 |
"hidden_act": "gelu",
|
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": "bert",
|
17 |
"num_attention_heads": 12,
|
18 |
+
"num_hidden_layers": 6,
|
19 |
"pad_token_id": 0,
|
20 |
+
"position_embedding_type": "absolute",
|
21 |
"torch_dtype": "float32",
|
22 |
"transformers_version": "4.35.2",
|
23 |
"type_vocab_size": 2,
|
24 |
"use_cache": true,
|
25 |
+
"vocab_size": 30522
|
26 |
}
|
config_sentence_transformers.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"__version__": {
|
3 |
-
"sentence_transformers": "2.
|
4 |
-
"transformers": "4.
|
5 |
-
"pytorch": "
|
6 |
}
|
7 |
}
|
|
|
1 |
{
|
2 |
"__version__": {
|
3 |
+
"sentence_transformers": "2.0.0",
|
4 |
+
"transformers": "4.6.1",
|
5 |
+
"pytorch": "1.8.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:0cd93b873f934fbe3a1d10049c161f170826c92f8a75494c1691c4e1f3e9806e
|
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
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d0850ce8fb35582a08b67fcbbf3b3dc95f9aa97fdc04ba4004288df94a163c2f
|
3 |
+
size 28623
|
modules.json
CHANGED
@@ -10,5 +10,11 @@
|
|
10 |
"name": "1",
|
11 |
"path": "1_Pooling",
|
12 |
"type": "sentence_transformers.models.Pooling"
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
]
|
|
|
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
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
{
|
2 |
-
"max_seq_length":
|
3 |
"do_lower_case": false
|
4 |
}
|
|
|
1 |
{
|
2 |
+
"max_seq_length": 256,
|
3 |
"do_lower_case": false
|
4 |
}
|
tokenizer.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"version": "1.0",
|
3 |
"truncation": {
|
4 |
"direction": "Right",
|
5 |
-
"max_length":
|
6 |
"strategy": "LongestFirst",
|
7 |
"stride": 0
|
8 |
},
|
@@ -30678,13 +30678,7 @@
|
|
30678 |
"##/": 30518,
|
30679 |
"##:": 30519,
|
30680 |
"##?": 30520,
|
30681 |
-
"##~": 30521
|
30682 |
-
"bowang": 30522,
|
30683 |
-
"georgiosmastrapas": 30523,
|
30684 |
-
"jackminong": 30524,
|
30685 |
-
"alaeddineabdessalem": 30525,
|
30686 |
-
"isabellemohr": 30526,
|
30687 |
-
"michaelguenther": 30527
|
30688 |
}
|
30689 |
}
|
30690 |
}
|
|
|
2 |
"version": "1.0",
|
3 |
"truncation": {
|
4 |
"direction": "Right",
|
5 |
+
"max_length": 256,
|
6 |
"strategy": "LongestFirst",
|
7 |
"stride": 0
|
8 |
},
|
|
|
30678 |
"##/": 30518,
|
30679 |
"##:": 30519,
|
30680 |
"##?": 30520,
|
30681 |
+
"##~": 30521
|
|
|
|
|
|
|
|
|
|
|
|
|
30682 |
}
|
30683 |
}
|
30684 |
}
|
tokenizer_config.json
CHANGED
@@ -46,12 +46,19 @@
|
|
46 |
"do_basic_tokenize": true,
|
47 |
"do_lower_case": true,
|
48 |
"mask_token": "[MASK]",
|
49 |
-
"
|
|
|
50 |
"never_split": null,
|
|
|
51 |
"pad_token": "[PAD]",
|
|
|
|
|
52 |
"sep_token": "[SEP]",
|
|
|
53 |
"strip_accents": null,
|
54 |
"tokenize_chinese_chars": true,
|
55 |
"tokenizer_class": "BertTokenizer",
|
|
|
|
|
56 |
"unk_token": "[UNK]"
|
57 |
}
|
|
|
46 |
"do_basic_tokenize": true,
|
47 |
"do_lower_case": true,
|
48 |
"mask_token": "[MASK]",
|
49 |
+
"max_length": 128,
|
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
CHANGED
@@ -30520,9 +30520,3 @@ necessitated
|
|
30520 |
##:
|
30521 |
##?
|
30522 |
##~
|
30523 |
-
bowang
|
30524 |
-
georgiosmastrapas
|
30525 |
-
jackminong
|
30526 |
-
alaeddineabdessalem
|
30527 |
-
isabellemohr
|
30528 |
-
michaelguenther
|
|
|
30520 |
##:
|
30521 |
##?
|
30522 |
##~
|
|
|
|
|
|
|
|
|
|
|
|