SetFit with cambridgeltl/SapBERT-from-PubMedBERT-fulltext
This is a SetFit model that can be used for Text Classification. This SetFit model uses cambridgeltl/SapBERT-from-PubMedBERT-fulltext as the Sentence Transformer embedding model. A MultiOutputClassifier 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
- Model Type: SetFit
- Sentence Transformer body: cambridgeltl/SapBERT-from-PubMedBERT-fulltext
- Classification head: a MultiOutputClassifier instance
- Maximum Sequence Length: 512 tokens
Model Sources
- Repository: SetFit on GitHub
- Paper: Efficient Few-Shot Learning Without Prompts
- Blogpost: SetFit: Efficient Few-Shot Learning Without Prompts
Evaluation
Metrics
Label | Accuracy |
---|---|
all | 0.1757 |
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("setfit_model_id")
# Run inference
preds = model("caspases")
Training Details
Training Set Metrics
Training set | Min | Median | Max |
---|---|---|---|
Word count | 1 | 1.7652 | 5 |
Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (3, 3)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 15
- body_learning_rate: (2e-05, 2e-05)
- head_learning_rate: 2e-05
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False
Training Results
Epoch | Step | Training Loss | Validation Loss |
---|---|---|---|
0.0009 | 1 | 0.2361 | - |
0.0463 | 50 | 0.2377 | - |
0.0927 | 100 | 0.2269 | - |
0.1390 | 150 | 0.2104 | - |
0.1854 | 200 | 0.1871 | - |
0.2317 | 250 | 0.1437 | - |
0.2780 | 300 | 0.1322 | - |
0.3244 | 350 | 0.1365 | - |
0.3707 | 400 | 0.1155 | - |
0.4171 | 450 | 0.1144 | - |
0.4634 | 500 | 0.1068 | - |
0.5097 | 550 | 0.1011 | - |
0.5561 | 600 | 0.095 | - |
0.6024 | 650 | 0.0933 | - |
0.6487 | 700 | 0.1063 | - |
0.6951 | 750 | 0.0999 | - |
0.7414 | 800 | 0.0823 | - |
0.7878 | 850 | 0.0877 | - |
0.8341 | 900 | 0.0767 | - |
0.8804 | 950 | 0.0849 | - |
0.9268 | 1000 | 0.0796 | - |
0.9731 | 1050 | 0.0877 | - |
1.0195 | 1100 | 0.0759 | - |
1.0658 | 1150 | 0.0705 | - |
1.1121 | 1200 | 0.0728 | - |
1.1585 | 1250 | 0.0738 | - |
1.2048 | 1300 | 0.0767 | - |
1.2512 | 1350 | 0.0692 | - |
1.2975 | 1400 | 0.0697 | - |
1.3438 | 1450 | 0.0639 | - |
1.3902 | 1500 | 0.0729 | - |
1.4365 | 1550 | 0.0759 | - |
1.4829 | 1600 | 0.0786 | - |
1.5292 | 1650 | 0.0618 | - |
1.5755 | 1700 | 0.0722 | - |
1.6219 | 1750 | 0.0719 | - |
1.6682 | 1800 | 0.072 | - |
1.7146 | 1850 | 0.0654 | - |
1.7609 | 1900 | 0.0683 | - |
1.8072 | 1950 | 0.0654 | - |
1.8536 | 2000 | 0.0679 | - |
1.8999 | 2050 | 0.0643 | - |
1.9462 | 2100 | 0.0662 | - |
1.9926 | 2150 | 0.0642 | - |
2.0389 | 2200 | 0.0812 | - |
2.0853 | 2250 | 0.068 | - |
2.1316 | 2300 | 0.0583 | - |
2.1779 | 2350 | 0.0627 | - |
2.2243 | 2400 | 0.0654 | - |
2.2706 | 2450 | 0.0571 | - |
2.3170 | 2500 | 0.0623 | - |
2.3633 | 2550 | 0.0639 | - |
2.4096 | 2600 | 0.059 | - |
2.4560 | 2650 | 0.0637 | - |
2.5023 | 2700 | 0.0675 | - |
2.5487 | 2750 | 0.0696 | - |
2.5950 | 2800 | 0.0669 | - |
2.6413 | 2850 | 0.0633 | - |
2.6877 | 2900 | 0.0606 | - |
2.7340 | 2950 | 0.0609 | - |
2.7804 | 3000 | 0.054 | - |
2.8267 | 3050 | 0.0598 | - |
2.8730 | 3100 | 0.0597 | - |
2.9194 | 3150 | 0.0618 | - |
2.9657 | 3200 | 0.065 | - |
Framework Versions
- Python: 3.10.12
- SetFit: 1.1.0
- Sentence Transformers: 3.1.1
- Transformers: 4.39.0
- PyTorch: 2.4.1+cu121
- Datasets: 3.0.0
- Tokenizers: 0.15.2
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}
}
- Downloads last month
- 0
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support