BarryRL commited on
Commit
72cf1d7
·
verified ·
1 Parent(s): d373608

Upload folder using huggingface_hub

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": true,
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 CHANGED
@@ -1,3 +1,175 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - setfit
4
+ - sentence-transformers
5
+ - text-classification
6
+ - generated_from_setfit_trainer
7
+ widget:
8
+ - text: Small pleural effusion on the left side. Mild cardiomegaly; no acute issues.
9
+ - text: Calcified granuloma in the left lower lobe, incidental finding. Findings
10
+ consistent with COPD exacerbation.
11
+ - text: Right upper lobe consolidation consistent with pneumonia. Findings suggestive
12
+ of community-acquired pneumonia.
13
+ - text: Small pleural effusion on the left side. Suspicious for malignancy; urgent
14
+ CT recommended.
15
+ - text: Suspected rib fracture; follow-up imaging recommended. Mild cardiomegaly;
16
+ no acute issues.
17
+ metrics:
18
+ - accuracy
19
+ pipeline_tag: text-classification
20
+ library_name: setfit
21
+ inference: false
22
+ ---
23
+
24
+ # SetFit
25
+
26
+ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. A OneVsRestClassifier instance is used for classification.
27
+
28
+ The model has been trained using an efficient few-shot learning technique that involves:
29
+
30
+ 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
31
+ 2. Training a classification head with features from the fine-tuned Sentence Transformer.
32
+
33
+ ## Model Details
34
+
35
+ ### Model Description
36
+ - **Model Type:** SetFit
37
+ <!-- - **Sentence Transformer:** [Unknown](https://huggingface.co/unknown) -->
38
+ - **Classification head:** a OneVsRestClassifier instance
39
+ - **Maximum Sequence Length:** 512 tokens
40
+ <!-- - **Number of Classes:** Unknown -->
41
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
42
+ <!-- - **Language:** Unknown -->
43
+ <!-- - **License:** Unknown -->
44
+
45
+ ### Model Sources
46
+
47
+ - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
48
+ - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
49
+ - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
50
+
51
+ ## Uses
52
+
53
+ ### Direct Use for Inference
54
+
55
+ First install the SetFit library:
56
+
57
+ ```bash
58
+ pip install setfit
59
+ ```
60
+
61
+ Then you can load this model and run inference.
62
+
63
+ ```python
64
+ from setfit import SetFitModel
65
+
66
+ # Download from the 🤗 Hub
67
+ model = SetFitModel.from_pretrained("setfit_model_id")
68
+ # Run inference
69
+ preds = model("Small pleural effusion on the left side. Mild cardiomegaly; no acute issues.")
70
+ ```
71
+
72
+ <!--
73
+ ### Downstream Use
74
+
75
+ *List how someone could finetune this model on their own dataset.*
76
+ -->
77
+
78
+ <!--
79
+ ### Out-of-Scope Use
80
+
81
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
82
+ -->
83
+
84
+ <!--
85
+ ## Bias, Risks and Limitations
86
+
87
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
88
+ -->
89
+
90
+ <!--
91
+ ### Recommendations
92
+
93
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
94
+ -->
95
+
96
+ ## Training Details
97
+
98
+ ### Training Set Metrics
99
+ | Training set | Min | Median | Max |
100
+ |:-------------|:----|:--------|:----|
101
+ | Word count | 10 | 23.3913 | 53 |
102
+
103
+ ### Training Hyperparameters
104
+ - batch_size: (8, 8)
105
+ - num_epochs: (10, 10)
106
+ - max_steps: -1
107
+ - sampling_strategy: oversampling
108
+ - body_learning_rate: (2e-05, 1e-05)
109
+ - head_learning_rate: 0.01
110
+ - loss: CosineSimilarityLoss
111
+ - distance_metric: cosine_distance
112
+ - margin: 0.25
113
+ - end_to_end: False
114
+ - use_amp: False
115
+ - warmup_proportion: 0.1
116
+ - l2_weight: 0.01
117
+ - seed: 42
118
+ - eval_max_steps: -1
119
+ - load_best_model_at_end: False
120
+
121
+ ### Training Results
122
+ | Epoch | Step | Training Loss | Validation Loss |
123
+ |:------:|:----:|:-------------:|:---------------:|
124
+ | 0.0238 | 1 | 0.1381 | - |
125
+ | 1.1905 | 50 | 0.1559 | - |
126
+ | 2.3810 | 100 | 0.0962 | - |
127
+ | 3.5714 | 150 | 0.072 | - |
128
+ | 4.7619 | 200 | 0.068 | - |
129
+ | 5.9524 | 250 | 0.0652 | - |
130
+ | 7.1429 | 300 | 0.0574 | - |
131
+ | 8.3333 | 350 | 0.0579 | - |
132
+ | 9.5238 | 400 | 0.0589 | - |
133
+
134
+ ### Framework Versions
135
+ - Python: 3.11.11
136
+ - SetFit: 1.1.2
137
+ - Sentence Transformers: 4.0.2
138
+ - Transformers: 4.51.2
139
+ - PyTorch: 2.6.0
140
+ - Datasets: 3.5.0
141
+ - Tokenizers: 0.21.1
142
+
143
+ ## Citation
144
+
145
+ ### BibTeX
146
+ ```bibtex
147
+ @article{https://doi.org/10.48550/arxiv.2209.11055,
148
+ doi = {10.48550/ARXIV.2209.11055},
149
+ url = {https://arxiv.org/abs/2209.11055},
150
+ author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
151
+ keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
152
+ title = {Efficient Few-Shot Learning Without Prompts},
153
+ publisher = {arXiv},
154
+ year = {2022},
155
+ copyright = {Creative Commons Attribution 4.0 International}
156
+ }
157
+ ```
158
+
159
+ <!--
160
+ ## Glossary
161
+
162
+ *Clearly define terms in order to be accessible across audiences.*
163
+ -->
164
+
165
+ <!--
166
+ ## Model Card Authors
167
+
168
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
169
+ -->
170
+
171
+ <!--
172
+ ## Model Card Contact
173
+
174
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
175
+ -->
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "hidden_act": "gelu",
8
+ "hidden_dropout_prob": 0.1,
9
+ "hidden_size": 768,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 3072,
12
+ "layer_norm_eps": 1e-12,
13
+ "max_position_embeddings": 512,
14
+ "model_type": "bert",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 12,
17
+ "pad_token_id": 0,
18
+ "position_embedding_type": "absolute",
19
+ "torch_dtype": "float32",
20
+ "transformers_version": "4.51.2",
21
+ "type_vocab_size": 2,
22
+ "use_cache": true,
23
+ "vocab_size": 28996
24
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "4.0.2",
4
+ "transformers": "4.51.2",
5
+ "pytorch": "2.6.0"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
config_setfit.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "labels": null,
3
+ "normalize_embeddings": false
4
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:171ef870e7ddddae939a339cd0b9ff7920654acfd0b3c7b74b570a4a03e417ab
3
+ size 433263448
model_head.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:037f1bbdbad74772022dc6e4b3b4e188eae2b2e68a74e8e3db085412f1cdc742
3
+ size 111172
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 512,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "max_length": 512,
51
+ "model_max_length": 512,
52
+ "never_split": null,
53
+ "pad_to_multiple_of": null,
54
+ "pad_token": "[PAD]",
55
+ "pad_token_type_id": 0,
56
+ "padding_side": "right",
57
+ "sep_token": "[SEP]",
58
+ "stride": 0,
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "BertTokenizer",
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "[UNK]"
65
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff