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 OneVsRestClassifier 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 OneVsRestClassifier 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.5241 |
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("foreign-body reaction: Chronic inflammation and granuloma formation around irritating foreign bodies.")
Training Details
Training Set Metrics
Training set | Min | Median | Max |
---|---|---|---|
Word count | 2 | 30.4473 | 134 |
Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 20
- 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.0003 | 1 | 0.2929 | - |
0.0136 | 50 | 0.2377 | - |
0.0272 | 100 | 0.2321 | - |
0.0408 | 150 | 0.2199 | - |
0.0544 | 200 | 0.1726 | - |
0.0680 | 250 | 0.1355 | - |
0.0816 | 300 | 0.1207 | - |
0.0952 | 350 | 0.1138 | - |
0.1088 | 400 | 0.1154 | - |
0.1223 | 450 | 0.095 | - |
0.1359 | 500 | 0.106 | - |
0.1495 | 550 | 0.0913 | - |
0.1631 | 600 | 0.0943 | - |
0.1767 | 650 | 0.0974 | - |
0.1903 | 700 | 0.0923 | - |
0.2039 | 750 | 0.0893 | - |
0.2175 | 800 | 0.0804 | - |
0.2311 | 850 | 0.0849 | - |
0.2447 | 900 | 0.0766 | - |
0.2583 | 950 | 0.0838 | - |
0.2719 | 1000 | 0.0725 | - |
0.2855 | 1050 | 0.073 | - |
0.2991 | 1100 | 0.055 | - |
0.3127 | 1150 | 0.0758 | - |
0.3263 | 1200 | 0.0709 | - |
0.3399 | 1250 | 0.0569 | - |
0.3535 | 1300 | 0.0535 | - |
0.3670 | 1350 | 0.0557 | - |
0.3806 | 1400 | 0.0596 | - |
0.3942 | 1450 | 0.0453 | - |
0.4078 | 1500 | 0.0428 | - |
0.4214 | 1550 | 0.0482 | - |
0.4350 | 1600 | 0.0465 | - |
0.4486 | 1650 | 0.0469 | - |
0.4622 | 1700 | 0.0479 | - |
0.4758 | 1750 | 0.0451 | - |
0.4894 | 1800 | 0.0613 | - |
0.5030 | 1850 | 0.0533 | - |
0.5166 | 1900 | 0.0476 | - |
0.5302 | 1950 | 0.0449 | - |
0.5438 | 2000 | 0.0543 | - |
0.5574 | 2050 | 0.0509 | - |
0.5710 | 2100 | 0.043 | - |
0.5846 | 2150 | 0.0482 | - |
0.5982 | 2200 | 0.0513 | - |
0.6117 | 2250 | 0.0366 | - |
0.6253 | 2300 | 0.0385 | - |
0.6389 | 2350 | 0.0446 | - |
0.6525 | 2400 | 0.0411 | - |
0.6661 | 2450 | 0.037 | - |
0.6797 | 2500 | 0.0321 | - |
0.6933 | 2550 | 0.0468 | - |
0.7069 | 2600 | 0.0331 | - |
0.7205 | 2650 | 0.0315 | - |
0.7341 | 2700 | 0.0435 | - |
0.7477 | 2750 | 0.0394 | - |
0.7613 | 2800 | 0.0381 | - |
0.7749 | 2850 | 0.0418 | - |
0.7885 | 2900 | 0.0347 | - |
0.8021 | 2950 | 0.0468 | - |
0.8157 | 3000 | 0.0352 | - |
0.8293 | 3050 | 0.0416 | - |
0.8428 | 3100 | 0.0354 | - |
0.8564 | 3150 | 0.0329 | - |
0.8700 | 3200 | 0.0359 | - |
0.8836 | 3250 | 0.036 | - |
0.8972 | 3300 | 0.0362 | - |
0.9108 | 3350 | 0.0296 | - |
0.9244 | 3400 | 0.041 | - |
0.9380 | 3450 | 0.0375 | - |
0.9516 | 3500 | 0.0282 | - |
0.9652 | 3550 | 0.0341 | - |
0.9788 | 3600 | 0.0283 | - |
0.9924 | 3650 | 0.0339 | - |
Framework Versions
- Python: 3.11.11
- SetFit: 1.1.1
- Sentence Transformers: 3.4.1
- Transformers: 4.50.0
- PyTorch: 2.6.0+cu124
- Datasets: 3.4.1
- Tokenizers: 0.21.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}
}
- Downloads last month
- 0
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support