SetFit with JohanHeinsen/Old_News_Segmentation_SBERT_V0.1
This is a SetFit model that can be used for Text Classification. This SetFit model uses JohanHeinsen/Old_News_Segmentation_SBERT_V0.1 as the Sentence Transformer embedding model. 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
- Model Type: SetFit
- Sentence Transformer body: JohanHeinsen/Old_News_Segmentation_SBERT_V0.1
- Classification head: a LogisticRegression instance
- Maximum Sequence Length: 512 tokens
- Number of Classes: 2 classes
Model Sources
- Repository: SetFit on GitHub
- Paper: Efficient Few-Shot Learning Without Prompts
- Blogpost: SetFit: Efficient Few-Shot Learning Without Prompts
Model Labels
| Label | Examples |
|---|---|
| 0 |
|
| 1 |
|
Evaluation
Metrics
| Label | Accuracy | F1 | Precision | Recall |
|---|---|---|---|---|
| all | 0.9990 | 0.9916 | 0.9833 | 1.0 |
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("En ganske nye Vand-Filtrum af Holms Fabrik i Kjøbenhavn, destillerende 50 Potter Vand om Dagen er tilkjøbs i Stokkemarke Præstegaard.")
Training Details
Training Set Metrics
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 5 | 88.9318 | 1999 |
| Label | Training Sample Count |
|---|---|
| 0 | 2093 |
| 1 | 149 |
Training Hyperparameters
- batch_size: (12, 12)
- num_epochs: (2, 2)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 12
- 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.0002 | 1 | 0.5665 | - |
| 0.0112 | 50 | 0.4302 | - |
| 0.0223 | 100 | 0.3677 | - |
| 0.0335 | 150 | 0.1981 | - |
| 0.0446 | 200 | 0.0642 | - |
| 0.0558 | 250 | 0.0272 | - |
| 0.0669 | 300 | 0.0083 | - |
| 0.0781 | 350 | 0.0114 | - |
| 0.0892 | 400 | 0.0038 | - |
| 0.1004 | 450 | 0.0036 | - |
| 0.1115 | 500 | 0.0023 | - |
| 0.1227 | 550 | 0.005 | - |
| 0.1338 | 600 | 0.0031 | - |
| 0.1450 | 650 | 0.0011 | - |
| 0.1561 | 700 | 0.0038 | - |
| 0.1673 | 750 | 0.0001 | - |
| 0.1784 | 800 | 0.0005 | - |
| 0.1896 | 850 | 0.0019 | - |
| 0.2007 | 900 | 0.0016 | - |
| 0.2119 | 950 | 0.0001 | - |
| 0.2230 | 1000 | 0.0014 | - |
| 0.2342 | 1050 | 0.0022 | - |
| 0.2453 | 1100 | 0.0021 | - |
| 0.2565 | 1150 | 0.0018 | - |
| 0.2676 | 1200 | 0.0002 | - |
| 0.2788 | 1250 | 0.0 | - |
| 0.2899 | 1300 | 0.0019 | - |
| 0.3011 | 1350 | 0.0 | - |
| 0.3122 | 1400 | 0.0 | - |
| 0.3234 | 1450 | 0.0036 | - |
| 0.3345 | 1500 | 0.0 | - |
| 0.3457 | 1550 | 0.0 | - |
| 0.3568 | 1600 | 0.0 | - |
| 0.3680 | 1650 | 0.0 | - |
| 0.3791 | 1700 | 0.0 | - |
| 0.3903 | 1750 | 0.0018 | - |
| 0.4014 | 1800 | 0.0001 | - |
| 0.4126 | 1850 | 0.0017 | - |
| 0.4237 | 1900 | 0.0 | - |
| 0.4349 | 1950 | 0.0 | - |
| 0.4460 | 2000 | 0.0 | - |
| 0.4572 | 2050 | 0.0035 | - |
| 0.4683 | 2100 | 0.0034 | - |
| 0.4795 | 2150 | 0.0036 | - |
| 0.4906 | 2200 | 0.0017 | - |
| 0.5018 | 2250 | 0.0056 | - |
| 0.5129 | 2300 | 0.0006 | - |
| 0.5241 | 2350 | 0.0 | - |
| 0.5352 | 2400 | 0.0 | - |
| 0.5464 | 2450 | 0.0 | - |
| 0.5575 | 2500 | 0.0016 | - |
| 0.5687 | 2550 | 0.0014 | - |
| 0.5798 | 2600 | 0.0 | - |
| 0.5910 | 2650 | 0.0012 | - |
| 0.6021 | 2700 | 0.0001 | - |
| 0.6133 | 2750 | 0.0 | - |
| 0.6244 | 2800 | 0.0 | - |
| 0.6356 | 2850 | 0.0 | - |
| 0.6467 | 2900 | 0.0 | - |
| 0.6579 | 2950 | 0.0 | - |
| 0.6690 | 3000 | 0.0016 | - |
| 0.6802 | 3050 | 0.0 | - |
| 0.6913 | 3100 | 0.0 | - |
| 0.7025 | 3150 | 0.0 | - |
| 0.7136 | 3200 | 0.0017 | - |
| 0.7248 | 3250 | 0.0012 | - |
| 0.7360 | 3300 | 0.0002 | - |
| 0.7471 | 3350 | 0.0 | - |
| 0.7583 | 3400 | 0.0 | - |
| 0.7694 | 3450 | 0.0 | - |
| 0.7806 | 3500 | 0.0 | - |
| 0.7917 | 3550 | 0.0 | - |
| 0.8029 | 3600 | 0.0 | - |
| 0.8140 | 3650 | 0.0 | - |
| 0.8252 | 3700 | 0.0 | - |
| 0.8363 | 3750 | 0.0 | - |
| 0.8475 | 3800 | 0.0 | - |
| 0.8586 | 3850 | 0.0 | - |
| 0.8698 | 3900 | 0.0 | - |
| 0.8809 | 3950 | 0.0 | - |
| 0.8921 | 4000 | 0.0 | - |
| 0.9032 | 4050 | 0.0 | - |
| 0.9144 | 4100 | 0.0 | - |
| 0.9255 | 4150 | 0.0 | - |
| 0.9367 | 4200 | 0.0 | - |
| 0.9478 | 4250 | 0.0 | - |
| 0.9590 | 4300 | 0.0 | - |
| 0.9701 | 4350 | 0.0 | - |
| 0.9813 | 4400 | 0.0 | - |
| 0.9924 | 4450 | 0.0 | - |
| 1.0036 | 4500 | 0.0 | - |
| 1.0147 | 4550 | 0.0 | - |
| 1.0259 | 4600 | 0.0 | - |
| 1.0370 | 4650 | 0.0 | - |
| 1.0482 | 4700 | 0.0 | - |
| 1.0593 | 4750 | 0.0 | - |
| 1.0705 | 4800 | 0.0 | - |
| 1.0816 | 4850 | 0.0 | - |
| 1.0928 | 4900 | 0.0 | - |
| 1.1039 | 4950 | 0.0 | - |
| 1.1151 | 5000 | 0.0 | - |
| 1.1262 | 5050 | 0.0 | - |
| 1.1374 | 5100 | 0.0 | - |
| 1.1485 | 5150 | 0.0 | - |
| 1.1597 | 5200 | 0.0 | - |
| 1.1708 | 5250 | 0.0 | - |
| 1.1820 | 5300 | 0.0 | - |
| 1.1931 | 5350 | 0.0 | - |
| 1.2043 | 5400 | 0.0 | - |
| 1.2154 | 5450 | 0.0 | - |
| 1.2266 | 5500 | 0.0 | - |
| 1.2377 | 5550 | 0.0 | - |
| 1.2489 | 5600 | 0.0 | - |
| 1.2600 | 5650 | 0.0 | - |
| 1.2712 | 5700 | 0.0 | - |
| 1.2823 | 5750 | 0.0 | - |
| 1.2935 | 5800 | 0.0 | - |
| 1.3046 | 5850 | 0.0 | - |
| 1.3158 | 5900 | 0.0 | - |
| 1.3269 | 5950 | 0.0 | - |
| 1.3381 | 6000 | 0.0 | - |
| 1.3492 | 6050 | 0.0 | - |
| 1.3604 | 6100 | 0.0 | - |
| 1.3715 | 6150 | 0.0 | - |
| 1.3827 | 6200 | 0.0 | - |
| 1.3938 | 6250 | 0.0 | - |
| 1.4050 | 6300 | 0.0 | - |
| 1.4161 | 6350 | 0.0 | - |
| 1.4273 | 6400 | 0.0 | - |
| 1.4384 | 6450 | 0.0 | - |
| 1.4496 | 6500 | 0.0 | - |
| 1.4607 | 6550 | 0.0 | - |
| 1.4719 | 6600 | 0.0 | - |
| 1.4831 | 6650 | 0.0 | - |
| 1.4942 | 6700 | 0.0 | - |
| 1.5054 | 6750 | 0.0 | - |
| 1.5165 | 6800 | 0.0 | - |
| 1.5277 | 6850 | 0.0 | - |
| 1.5388 | 6900 | 0.0 | - |
| 1.5500 | 6950 | 0.0 | - |
| 1.5611 | 7000 | 0.0 | - |
| 1.5723 | 7050 | 0.0 | - |
| 1.5834 | 7100 | 0.0 | - |
| 1.5946 | 7150 | 0.0 | - |
| 1.6057 | 7200 | 0.0 | - |
| 1.6169 | 7250 | 0.0 | - |
| 1.6280 | 7300 | 0.0 | - |
| 1.6392 | 7350 | 0.0 | - |
| 1.6503 | 7400 | 0.0 | - |
| 1.6615 | 7450 | 0.0 | - |
| 1.6726 | 7500 | 0.0 | - |
| 1.6838 | 7550 | 0.0 | - |
| 1.6949 | 7600 | 0.0 | - |
| 1.7061 | 7650 | 0.0 | - |
| 1.7172 | 7700 | 0.0 | - |
| 1.7284 | 7750 | 0.0 | - |
| 1.7395 | 7800 | 0.0 | - |
| 1.7507 | 7850 | 0.0 | - |
| 1.7618 | 7900 | 0.0 | - |
| 1.7730 | 7950 | 0.0 | - |
| 1.7841 | 8000 | 0.0 | - |
| 1.7953 | 8050 | 0.0 | - |
| 1.8064 | 8100 | 0.0 | - |
| 1.8176 | 8150 | 0.0 | - |
| 1.8287 | 8200 | 0.0 | - |
| 1.8399 | 8250 | 0.0 | - |
| 1.8510 | 8300 | 0.0 | - |
| 1.8622 | 8350 | 0.0 | - |
| 1.8733 | 8400 | 0.0 | - |
| 1.8845 | 8450 | 0.0 | - |
| 1.8956 | 8500 | 0.0 | - |
| 1.9068 | 8550 | 0.0 | - |
| 1.9179 | 8600 | 0.0 | - |
| 1.9291 | 8650 | 0.0 | - |
| 1.9402 | 8700 | 0.0 | - |
| 1.9514 | 8750 | 0.0 | - |
| 1.9625 | 8800 | 0.0 | - |
| 1.9737 | 8850 | 0.0 | - |
| 1.9848 | 8900 | 0.0 | - |
| 1.9960 | 8950 | 0.0 | - |
Framework Versions
- Python: 3.11.12
- SetFit: 1.1.3
- Sentence Transformers: 4.1.0
- Transformers: 4.51.3
- PyTorch: 2.7.0
- Datasets: 2.19.2
- 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
- 48
Model tree for JohanHeinsen/ENO_Runaway_Advertisement_classifier_2.0
Base model
CALDISS-AAU/DA-BERT_Old_News_V1Evaluation results
- Accuracy on Unknowntest set self-reported0.999
- F1 on Unknowntest set self-reported0.992
- Precision on Unknowntest set self-reported0.983
- Recall on Unknowntest set self-reported1.000