Corran commited on
Commit
8b14c0a
1 Parent(s): 2889ed1

Add SetFit model

Browse files
1_Pooling/config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "word_embedding_dimension": 384,
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,
README.md CHANGED
@@ -23,9 +23,9 @@ widget:
23
  fish, suggesting the need for further research into mitigation strategies.
24
  pipeline_tag: text-classification
25
  inference: true
26
- base_model: sentence-transformers/all-MiniLM-L6-v2
27
  model-index:
28
- - name: SetFit with sentence-transformers/all-MiniLM-L6-v2
29
  results:
30
  - task:
31
  type: text-classification
@@ -36,13 +36,13 @@ model-index:
36
  split: test
37
  metrics:
38
  - type: accuracy
39
- value: 0.7492307692307693
40
  name: Accuracy
41
  ---
42
 
43
- # SetFit with sentence-transformers/all-MiniLM-L6-v2
44
 
45
- 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.
46
 
47
  The model has been trained using an efficient few-shot learning technique that involves:
48
 
@@ -53,9 +53,9 @@ The model has been trained using an efficient few-shot learning technique that i
53
 
54
  ### Model Description
55
  - **Model Type:** SetFit
56
- - **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
57
  - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
58
- - **Maximum Sequence Length:** 256 tokens
59
  - **Number of Classes:** 13 classes
60
  <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
61
  <!-- - **Language:** Unknown -->
@@ -89,7 +89,7 @@ The model has been trained using an efficient few-shot learning technique that i
89
  ### Metrics
90
  | Label | Accuracy |
91
  |:--------|:---------|
92
- | **all** | 0.7492 |
93
 
94
  ## Uses
95
 
@@ -160,11 +160,11 @@ preds = model("Further investigations are required to determine the nature of th
160
  | Uncertainty | 100 |
161
 
162
  ### Training Hyperparameters
163
- - batch_size: (128, 128)
164
  - num_epochs: (1, 1)
165
  - max_steps: -1
166
  - sampling_strategy: oversampling
167
- - num_iterations: 30
168
  - body_learning_rate: (2e-05, 1e-05)
169
  - head_learning_rate: 0.01
170
  - loss: CosineSimilarityLoss
@@ -180,22 +180,12 @@ preds = model("Further investigations are required to determine the nature of th
180
  ### Training Results
181
  | Epoch | Step | Training Loss | Validation Loss |
182
  |:------:|:----:|:-------------:|:---------------:|
183
- | 0.0098 | 1 | 0.4492 | - |
184
- | 0.4902 | 50 | 0.1916 | - |
185
- | 0.9804 | 100 | 0.1761 | - |
186
- | 0.0016 | 1 | 0.1839 | - |
187
- | 0.0820 | 50 | 0.1739 | - |
188
- | 0.1639 | 100 | 0.145 | - |
189
- | 0.2459 | 150 | 0.1549 | - |
190
- | 0.3279 | 200 | 0.1319 | - |
191
- | 0.4098 | 250 | 0.084 | - |
192
- | 0.4918 | 300 | 0.1165 | - |
193
- | 0.5738 | 350 | 0.0836 | - |
194
- | 0.6557 | 400 | 0.0813 | - |
195
- | 0.7377 | 450 | 0.0852 | - |
196
- | 0.8197 | 500 | 0.0854 | - |
197
- | 0.9016 | 550 | 0.0932 | - |
198
- | 0.9836 | 600 | 0.0955 | - |
199
 
200
  ### Framework Versions
201
  - Python: 3.10.12
 
23
  fish, suggesting the need for further research into mitigation strategies.
24
  pipeline_tag: text-classification
25
  inference: true
26
+ base_model: sentence-transformers/paraphrase-mpnet-base-v2
27
  model-index:
28
+ - name: SetFit with sentence-transformers/paraphrase-mpnet-base-v2
29
  results:
30
  - task:
31
  type: text-classification
 
36
  split: test
37
  metrics:
38
  - type: accuracy
39
+ value: 0.803076923076923
40
  name: Accuracy
41
  ---
42
 
43
+ # SetFit with sentence-transformers/paraphrase-mpnet-base-v2
44
 
45
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-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.
46
 
47
  The model has been trained using an efficient few-shot learning technique that involves:
48
 
 
53
 
54
  ### Model Description
55
  - **Model Type:** SetFit
56
+ - **Sentence Transformer body:** [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
57
  - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
58
+ - **Maximum Sequence Length:** 512 tokens
59
  - **Number of Classes:** 13 classes
60
  <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
61
  <!-- - **Language:** Unknown -->
 
89
  ### Metrics
90
  | Label | Accuracy |
91
  |:--------|:---------|
92
+ | **all** | 0.8031 |
93
 
94
  ## Uses
95
 
 
160
  | Uncertainty | 100 |
161
 
162
  ### Training Hyperparameters
163
+ - batch_size: (156, 156)
164
  - num_epochs: (1, 1)
165
  - max_steps: -1
166
  - sampling_strategy: oversampling
167
+ - num_iterations: 15
168
  - body_learning_rate: (2e-05, 1e-05)
169
  - head_learning_rate: 0.01
170
  - loss: CosineSimilarityLoss
 
180
  ### Training Results
181
  | Epoch | Step | Training Loss | Validation Loss |
182
  |:------:|:----:|:-------------:|:---------------:|
183
+ | 0.0003 | 1 | 0.2399 | - |
184
+ | 0.2 | 50 | 0.1454 | - |
185
+ | 0.4 | 100 | 0.142 | - |
186
+ | 0.6 | 150 | 0.1014 | - |
187
+ | 0.8 | 200 | 0.0914 | - |
188
+ | 1.0 | 250 | 0.0784 | - |
 
 
 
 
 
 
 
 
 
 
189
 
190
  ### Framework Versions
191
  - Python: 3.10.12
config.json CHANGED
@@ -1,26 +1,24 @@
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
  }
 
1
  {
2
+ "_name_or_path": "/root/.cache/torch/sentence_transformers/sentence-transformers_paraphrase-mpnet-base-v2/",
3
  "architectures": [
4
+ "MPNetModel"
5
  ],
6
  "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "eos_token_id": 2,
9
  "hidden_act": "gelu",
10
  "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
  "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-05,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "mpnet",
17
  "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 1,
20
+ "relative_attention_num_buckets": 32,
21
  "torch_dtype": "float32",
22
  "transformers_version": "4.35.2",
23
+ "vocab_size": 30527
 
 
24
  }
config_sentence_transformers.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "__version__": {
3
  "sentence_transformers": "2.0.0",
4
- "transformers": "4.6.1",
5
- "pytorch": "1.8.1"
6
  }
7
  }
 
1
  {
2
  "__version__": {
3
  "sentence_transformers": "2.0.0",
4
+ "transformers": "4.7.0",
5
+ "pytorch": "1.9.0+cu102"
6
  }
7
  }
config_setfit.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "normalize_embeddings": false,
3
  "labels": [
4
  "Aims",
5
  "Background",
@@ -14,5 +13,6 @@
14
  "Reccomendations",
15
  "Result",
16
  "Uncertainty"
17
- ]
 
18
  }
 
1
  {
 
2
  "labels": [
3
  "Aims",
4
  "Background",
 
13
  "Reccomendations",
14
  "Result",
15
  "Uncertainty"
16
+ ],
17
+ "normalize_embeddings": false
18
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:141d914bc4cc7abfdda90db15d9ccc63682fd632af680e852a2910eb1c1fbc88
3
- size 90864192
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e6ed62f9ebe9486c0024d1d67f55b8ac61d89439e4cc86d3d51f234939f864d
3
+ size 437967672
model_head.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:49301dc5cc11c03bd3d73aa723a6c87e4309f65a39936612fb8066235491f488
3
- size 41647
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2114204c6bc943d637082385d7f7a227985229c5aa70612992910807d8009a25
3
+ size 81583
modules.json CHANGED
@@ -10,11 +10,5 @@
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
  ]
 
10
  "name": "1",
11
  "path": "1_Pooling",
12
  "type": "sentence_transformers.models.Pooling"
 
 
 
 
 
 
13
  }
14
  ]
sentence_bert_config.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "max_seq_length": 256,
3
  "do_lower_case": false
4
  }
 
1
  {
2
+ "max_seq_length": 512,
3
  "do_lower_case": false
4
  }
special_tokens_map.json CHANGED
@@ -1,7 +1,51 @@
1
  {
2
- "cls_token": "[CLS]",
3
- "mask_token": "[MASK]",
4
- "pad_token": "[PAD]",
5
- "sep_token": "[SEP]",
6
- "unk_token": "[UNK]"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  }
 
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": true,
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": true,
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 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:851ca67100d372ca3ae031a6abd168f53489eebfd7d89523f35c5c9b4d372c3c
3
- size 711649
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5858fbf3342d891d40efa32ba2478c09c895e7eb3d94cdb721651126f0ba58f9
3
+ size 711831
tokenizer_config.json CHANGED
@@ -1,64 +1,59 @@
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
- "100": {
12
- "content": "[UNK]",
13
  "lstrip": false,
14
  "normalized": false,
15
  "rstrip": false,
16
  "single_word": false,
17
  "special": true
18
  },
19
- "101": {
20
- "content": "[CLS]",
21
  "lstrip": false,
22
  "normalized": false,
23
  "rstrip": false,
24
  "single_word": false,
25
  "special": true
26
  },
27
- "102": {
28
- "content": "[SEP]",
29
  "lstrip": false,
30
  "normalized": false,
31
  "rstrip": false,
32
  "single_word": false,
33
  "special": true
34
  },
35
- "103": {
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": 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
  }
 
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
+ "104": {
28
+ "content": "[UNK]",
29
  "lstrip": false,
30
  "normalized": false,
31
  "rstrip": false,
32
  "single_word": false,
33
  "special": true
34
  },
35
+ "30526": {
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
  "do_basic_tokenize": true,
48
  "do_lower_case": true,
49
+ "eos_token": "</s>",
50
+ "mask_token": "<mask>",
51
  "model_max_length": 512,
52
  "never_split": null,
53
+ "pad_token": "<pad>",
54
+ "sep_token": "</s>",
 
 
 
 
55
  "strip_accents": null,
56
  "tokenize_chinese_chars": true,
57
+ "tokenizer_class": "MPNetTokenizer",
 
 
58
  "unk_token": "[UNK]"
59
  }
vocab.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  [PAD]
2
  [unused0]
3
  [unused1]
@@ -30520,3 +30524,4 @@ necessitated
30520
  ##:
30521
  ##?
30522
  ##~
 
 
1
+ <s>
2
+ <pad>
3
+ </s>
4
+ <unk>
5
  [PAD]
6
  [unused0]
7
  [unused1]
 
30524
  ##:
30525
  ##?
30526
  ##~
30527
+ <mask>