Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,196 +1,30 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
- setfit
|
| 5 |
-
- sentence-transformers
|
| 6 |
-
- text-classification
|
| 7 |
-
- generated_from_setfit_trainer
|
| 8 |
-
base_model: sentence-transformers/paraphrase-mpnet-base-v2
|
| 9 |
-
metrics:
|
| 10 |
-
- accuracy
|
| 11 |
-
widget:
|
| 12 |
-
- text: What should I do if my tire pressure warning light comes on?
|
| 13 |
-
- text: What is the best way to store tires when not in use?
|
| 14 |
-
- text: How often should I rotate my tires?
|
| 15 |
-
- text: Is it okay to slightly overinflate my tires?
|
| 16 |
-
- text: What are the signs of a tire that needs to be replaced?
|
| 17 |
-
pipeline_tag: text-classification
|
| 18 |
-
inference: true
|
| 19 |
-
model-index:
|
| 20 |
-
- name: SetFit with sentence-transformers/paraphrase-mpnet-base-v2
|
| 21 |
-
results:
|
| 22 |
-
- task:
|
| 23 |
-
type: text-classification
|
| 24 |
-
name: Text Classification
|
| 25 |
-
dataset:
|
| 26 |
-
name: Unknown
|
| 27 |
-
type: unknown
|
| 28 |
-
split: test
|
| 29 |
-
metrics:
|
| 30 |
-
- type: accuracy
|
| 31 |
-
value: 1.0
|
| 32 |
-
name: Accuracy
|
| 33 |
---
|
| 34 |
|
| 35 |
-
#
|
| 36 |
|
| 37 |
-
This is a
|
| 38 |
|
| 39 |
-
The model has been trained using an efficient few-shot learning technique
|
| 40 |
|
| 41 |
-
|
| 42 |
-
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
| 43 |
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
-
- **Model Type:** SetFit
|
| 48 |
-
- **Sentence Transformer body:** [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
|
| 49 |
-
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
| 50 |
-
- **Maximum Sequence Length:** 512 tokens
|
| 51 |
-
- **Number of Classes:** 2 classes
|
| 52 |
-
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
| 53 |
-
<!-- - **Language:** Unknown -->
|
| 54 |
-
<!-- - **License:** Unknown -->
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
|
| 59 |
-
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
| 60 |
-
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
| 61 |
-
|
| 62 |
-
### Model Labels
|
| 63 |
-
| Label | Examples |
|
| 64 |
-
|:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 65 |
-
| 1 | <ul><li>'Is it okay to slightly overinflate my tires?'</li><li>'What is the recommended tire pressure for towing a trailer?'</li><li>'How can I check if my tire pressure is correct?'</li></ul> |
|
| 66 |
-
| 0 | <ul><li>'How do I know if my tire has a slow leak?'</li><li>'How can I extend the life of my tires?'</li><li>'What is the best way to store tires when not in use?'</li></ul> |
|
| 67 |
-
|
| 68 |
-
## Evaluation
|
| 69 |
-
|
| 70 |
-
### Metrics
|
| 71 |
-
| Label | Accuracy |
|
| 72 |
-
|:--------|:---------|
|
| 73 |
-
| **all** | 1.0 |
|
| 74 |
-
|
| 75 |
-
## Uses
|
| 76 |
-
|
| 77 |
-
### Direct Use for Inference
|
| 78 |
-
|
| 79 |
-
First install the SetFit library:
|
| 80 |
-
|
| 81 |
-
```bash
|
| 82 |
-
pip install setfit
|
| 83 |
-
```
|
| 84 |
-
|
| 85 |
-
Then you can load this model and run inference.
|
| 86 |
-
|
| 87 |
-
```python
|
| 88 |
-
from setfit import SetFitModel
|
| 89 |
-
|
| 90 |
-
# Download from the 🤗 Hub
|
| 91 |
-
model = SetFitModel.from_pretrained("phospho-app/MODEL_ID")
|
| 92 |
-
# Run inference
|
| 93 |
-
preds = model("How often should I rotate my tires?")
|
| 94 |
-
```
|
| 95 |
-
|
| 96 |
-
<!--
|
| 97 |
-
### Downstream Use
|
| 98 |
-
|
| 99 |
-
*List how someone could finetune this model on their own dataset.*
|
| 100 |
-
-->
|
| 101 |
-
|
| 102 |
-
<!--
|
| 103 |
-
### Out-of-Scope Use
|
| 104 |
-
|
| 105 |
-
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 106 |
-
-->
|
| 107 |
-
|
| 108 |
-
<!--
|
| 109 |
-
## Bias, Risks and Limitations
|
| 110 |
-
|
| 111 |
-
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
| 112 |
-
-->
|
| 113 |
-
|
| 114 |
-
<!--
|
| 115 |
-
### Recommendations
|
| 116 |
-
|
| 117 |
-
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 118 |
-
-->
|
| 119 |
-
|
| 120 |
-
## Training Details
|
| 121 |
-
|
| 122 |
-
### Training Set Metrics
|
| 123 |
-
| Training set | Min | Median | Max |
|
| 124 |
-
|:-------------|:----|:-------|:----|
|
| 125 |
-
| Word count | 7 | 9.5 | 12 |
|
| 126 |
-
|
| 127 |
-
| Label | Training Sample Count |
|
| 128 |
-
|:------|:----------------------|
|
| 129 |
-
| 0 | 7 |
|
| 130 |
-
| 1 | 9 |
|
| 131 |
-
|
| 132 |
-
### Training Hyperparameters
|
| 133 |
-
- batch_size: (16, 16)
|
| 134 |
-
- num_epochs: (1, 1)
|
| 135 |
-
- max_steps: -1
|
| 136 |
-
- sampling_strategy: oversampling
|
| 137 |
-
- num_iterations: 20
|
| 138 |
-
- body_learning_rate: (2e-05, 2e-05)
|
| 139 |
-
- head_learning_rate: 2e-05
|
| 140 |
-
- loss: CosineSimilarityLoss
|
| 141 |
-
- distance_metric: cosine_distance
|
| 142 |
-
- margin: 0.25
|
| 143 |
-
- end_to_end: False
|
| 144 |
-
- use_amp: False
|
| 145 |
-
- warmup_proportion: 0.1
|
| 146 |
-
- seed: 42
|
| 147 |
-
- eval_max_steps: -1
|
| 148 |
-
- load_best_model_at_end: False
|
| 149 |
-
|
| 150 |
-
### Training Results
|
| 151 |
-
| Epoch | Step | Training Loss | Validation Loss |
|
| 152 |
-
|:-----:|:----:|:-------------:|:---------------:|
|
| 153 |
-
| 0.025 | 1 | 0.2202 | - |
|
| 154 |
-
|
| 155 |
-
### Framework Versions
|
| 156 |
-
- Python: 3.11.0
|
| 157 |
-
- SetFit: 1.0.3
|
| 158 |
-
- Sentence Transformers: 2.7.0
|
| 159 |
-
- Transformers: 4.40.1
|
| 160 |
-
- PyTorch: 2.3.0+cu121
|
| 161 |
-
- Datasets: 2.19.0
|
| 162 |
-
- Tokenizers: 0.19.1
|
| 163 |
-
|
| 164 |
-
## Citation
|
| 165 |
-
|
| 166 |
-
### BibTeX
|
| 167 |
-
```bibtex
|
| 168 |
-
@article{https://doi.org/10.48550/arxiv.2209.11055,
|
| 169 |
-
doi = {10.48550/ARXIV.2209.11055},
|
| 170 |
-
url = {https://arxiv.org/abs/2209.11055},
|
| 171 |
-
author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
|
| 172 |
-
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
|
| 173 |
-
title = {Efficient Few-Shot Learning Without Prompts},
|
| 174 |
-
publisher = {arXiv},
|
| 175 |
-
year = {2022},
|
| 176 |
-
copyright = {Creative Commons Attribution 4.0 International}
|
| 177 |
-
}
|
| 178 |
```
|
| 179 |
|
| 180 |
-
|
| 181 |
-
## Glossary
|
| 182 |
-
|
| 183 |
-
*Clearly define terms in order to be accessible across audiences.*
|
| 184 |
-
-->
|
| 185 |
|
| 186 |
-
|
| 187 |
-
## Model Card Authors
|
| 188 |
|
| 189 |
-
|
| 190 |
-
-->
|
| 191 |
|
| 192 |
-
|
| 193 |
-
## Model Card Contact
|
| 194 |
|
| 195 |
-
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 196 |
-
-->
|
|
|
|
| 1 |
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
+
# phospho-small
|
| 7 |
|
| 8 |
+
This is a SetFit model that can be used for Text Classification on CPU.
|
| 9 |
|
| 10 |
+
The model has been trained using an efficient few-shot learning technique.
|
| 11 |
|
| 12 |
+
## Usage
|
|
|
|
| 13 |
|
| 14 |
+
```python
|
| 15 |
+
from setfit import SetFitModel
|
| 16 |
|
| 17 |
+
model = SetFitModel.from_pretrained("MODEL_ID")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
outputs = model.predict(["This is a sentence to classify", "Another sentence"])
|
| 20 |
+
# tensor([1, 0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
```
|
| 22 |
|
| 23 |
+
## References
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
This work was possible thanks to the SetFit library and the work of:
|
|
|
|
| 26 |
|
| 27 |
+
Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren (2022). Efficient Few-Shot Learning Without Prompts.
|
|
|
|
| 28 |
|
| 29 |
+
ArXiv: [https://doi.org/10.48550/arxiv.2209.11055](https://doi.org/10.48550/arxiv.2209.11055)
|
|
|
|
| 30 |
|
|
|
|
|
|