SetFit
This is a SetFit model that can be used for Text Classification. A LogisticRegression instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
- Fine-tuning a Sentence Transformer with contrastive learning.
- Training a classification head with features from the fine-tuned Sentence Transformer.
Model Details
Model Description
- Classification head: a LogisticRegression instance
- Maximum Sequence Length: 512 tokens
- Number of Classes: 16 classes
Model Sources
Model Labels
| Label | Examples |
|---|
| Appetite | 'I consider myself to be a spiritual person''I would feel out of place eating fruits and vegetables at a party where everyone is eating other foods''I cook healthy foods' |
| Future | 'I have the impression that the world tends toward collapse (apocalyptic end)''I feel anxious about death''I am uneasy about possible mishaps' |
| Concentration | 'I have to push myself to get things done because I am tired''I have trouble remembering things because I am tired''I have enough energy to exercise strenuously' |
| Financial Worries | 'Is your financial condition worsening as a result of your cancer diagnosis or treatment?''I am satisfied with my current financial situation''I am frustrated that I cannot work or contribute as much as I usually do' |
| Outcome | 'I can make sense of my life''I have very clear goals and aims for my life''I am confident in this treatment' |
| Alcohol | 'Alcohol makes it easier to talk to people''I drank because I had nothing to do''Drinking can be harmful to physical health' |
| Present | 'My life is meaningful''I feel disconnected from others''I make time for family and friends' |
| Physical Function | 'Are you able to climb up five steps?''Body pain impedes my exercise participation.''Are you able to use a hammer to pound a nail?' |
| Spiritual Concerns | 'I ask people to pray for me''My illness has strengthened my faith or spiritual beliefs ''My life lacks meaning and purpose ' |
| Drugs | 'I did risky things while using drugs''When I used drugs, I felt alone''I experienced cravings for pain medication' |
| Loss of Usual Health | 'I can rely on my judgment to manage my symptoms, even when others disagree with me''I am unable to do the things I want to do because of my medical condition''My medical condition makes it hard for me to take care of myself' |
| Smoking | 'I am tempted to smoke when I have arguments or conflicts with others'"When I'm alone, a cigarette can help me pass the time"'Smoking keeps me from overeating' |
| Treatment UX | 'Overall, how bothered were you by the amount of time it took to take your cancer therapy?''I am angry about the lack of care coordination for my healthcare.'"I feel like I don't have access to all the healthcare services I need" |
| Support | 'Do you have someone to help with your daily chores if you are sick?''Someone to give you information to help you understand a situation''I have someone I trust to talk with about my problems' |
| Feeling Out of Control | 'I have trouble doing all of my usual work (include work at home)''How much did pain interfere with your ability to participate in leisure activities?''How often was pain distressing to you?' |
| Sleep | 'I felt tired''I tossed and turned at night''I was satisfied with my sleep' |
Evaluation
Metrics
Uses
Direct Use for Inference
First install the SetFit library:
pip install setfit
Then you can load this model and run inference.
from setfit import SetFitModel
# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("brendaac/setfit-prom-bac")
# Run inference
preds = model("My sleep was deep")
Training Details
Training Set Metrics
| Training set | Min | Median | Max |
|---|
| Word count | 3 | 9.625 | 20 |
| Label | Training Sample Count |
|---|
| Alcohol | 8 |
| Appetite | 8 |
| Concentration | 8 |
| Drugs | 8 |
| Feeling Out of Control | 8 |
| Financial Worries | 8 |
| Future | 8 |
| Loss of Usual Health | 8 |
| Outcome | 8 |
| Physical Function | 8 |
| Present | 8 |
| Sleep | 8 |
| Smoking | 8 |
| Spiritual Concerns | 8 |
| Support | 8 |
| Treatment UX | 8 |
Training Hyperparameters
- batch_size: (32, 32)
- num_epochs: (2, 2)
- max_steps: -1
- sampling_strategy: oversampling
- body_learning_rate: (2e-05, 1e-05)
- head_learning_rate: 0.01
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: True
- use_amp: False
- warmup_proportion: 0.1
- l2_weight: 0.01
- seed: 101010
- eval_max_steps: -1
- load_best_model_at_end: True
Training Results
| Epoch | Step | Training Loss | Validation Loss |
|---|
| 0.0021 | 1 | 0.1955 | - |
| 0.1042 | 50 | 0.1787 | - |
| 0.2083 | 100 | 0.1152 | - |
| 0.3125 | 150 | 0.0475 | - |
| 0.4167 | 200 | 0.0276 | - |
| 0.5208 | 250 | 0.0161 | - |
| 0.625 | 300 | 0.0114 | - |
| 0.7292 | 350 | 0.0094 | - |
| 0.8333 | 400 | 0.007 | - |
| 0.9375 | 450 | 0.0063 | - |
| 1.0 | 480 | - | 0.0585 |
| 1.0417 | 500 | 0.0055 | - |
| 1.1458 | 550 | 0.0051 | - |
| 1.25 | 600 | 0.0047 | - |
| 1.3542 | 650 | 0.0043 | - |
| 1.4583 | 700 | 0.0042 | - |
| 1.5625 | 750 | 0.004 | - |
| 1.6667 | 800 | 0.0039 | - |
| 1.7708 | 850 | 0.0037 | - |
| 1.875 | 900 | 0.0037 | - |
| 1.9792 | 950 | 0.0038 | - |
| 2.0 | 960 | - | 0.0577 |
Framework Versions
- Python: 3.10.20
- SetFit: 1.1.3
- Sentence Transformers: 3.4.1
- Transformers: 4.41.0
- PyTorch: 2.10.0
- Datasets: 3.3.2
- Tokenizers: 0.19.1
Citation
BibTeX
@article{https://doi.org/10.48550/arxiv.2209.11055,
doi = {10.48550/ARXIV.2209.11055},
url = {https://arxiv.org/abs/2209.11055},
author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {Efficient Few-Shot Learning Without Prompts},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}