Edit model card

SetFit

This is a SetFit model that can be used for Text Classification. A SVC instance is used for classification.

The model has been trained using an efficient few-shot learning technique that involves:

  1. Fine-tuning a Sentence Transformer with contrastive learning.
  2. Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

  • Model Type: SetFit
  • Classification head: a SVC instance
  • Maximum Sequence Length: 256 tokens
  • Number of Classes: 2 classes

Model Sources

Model Labels

Label Examples
SUBJ
  • 'Gone are the days when they led the world in recession-busting'
  • 'Who so mean that he will not himself be taxed, who so mindful of wealth that he will not favor increasing the popular taxes, in aid of these defective children?'
  • 'That state has sixty-two counties and sixty cities … In addition there are 932 towns, 507 villages, and, at the last count, 9,600 school districts … Just try to render efficient service … amid the diffused identities and inevitable jealousies of, roughly, 11,000 independent administrative officers or boards!'
OBJ
  • 'Is this a warning of what’s to come?'
  • 'This unique set of circumstances has brought PCL back into focus as the safe haven of choice for global players seeking somewhere to stash their cash.'
  • 'Socialists believe that, if everyone cannot have something, no one shall.'

Evaluation

Metrics

Label F1
all 0.7526

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("SOUMYADEEPSAR/Setfit_subj_SVC")
# Run inference
preds = model("That can happen again.")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 3 35.9834 97
Label Training Sample Count
OBJ 117
SUBJ 124

Training Hyperparameters

  • batch_size: (8, 8)
  • num_epochs: (5, 5)
  • max_steps: -1
  • sampling_strategy: oversampling
  • num_iterations: 20
  • body_learning_rate: (1e-05, 1e-05)
  • head_learning_rate: 1e-05
  • loss: CosineSimilarityLoss
  • distance_metric: cosine_distance
  • margin: 0.25
  • end_to_end: False
  • use_amp: False
  • warmup_proportion: 0.1
  • seed: 42
  • eval_max_steps: -1
  • load_best_model_at_end: False

Training Results

Epoch Step Training Loss Validation Loss
0.0008 1 0.3862 -
0.0415 50 0.4092 -
0.0830 100 0.3596 -
0.1245 150 0.2618 -
0.1660 200 0.2447 -
0.2075 250 0.263 -
0.2490 300 0.2583 -
0.2905 350 0.3336 -
0.3320 400 0.2381 -
0.3734 450 0.2454 -
0.4149 500 0.259 -
0.4564 550 0.2083 -
0.4979 600 0.2437 -
0.5394 650 0.2231 -
0.5809 700 0.0891 -
0.6224 750 0.1164 -
0.6639 800 0.0156 -
0.7054 850 0.0394 -
0.7469 900 0.0065 -
0.7884 950 0.0024 -
0.8299 1000 0.0012 -
0.8714 1050 0.0014 -
0.9129 1100 0.0039 -
0.9544 1150 0.0039 -
0.9959 1200 0.001 -
1.0373 1250 0.0007 -
1.0788 1300 0.0003 -
1.1203 1350 0.001 -
1.1618 1400 0.0003 -
1.2033 1450 0.0003 -
1.2448 1500 0.0014 -
1.2863 1550 0.0003 -
1.3278 1600 0.0003 -
1.3693 1650 0.0001 -
1.4108 1700 0.0004 -
1.4523 1750 0.0003 -
1.4938 1800 0.0008 -
1.5353 1850 0.0002 -
1.5768 1900 0.0005 -
1.6183 1950 0.0002 -
1.6598 2000 0.0004 -
1.7012 2050 0.0001 -
1.7427 2100 0.0002 -
1.7842 2150 0.0002 -
1.8257 2200 0.0002 -
1.8672 2250 0.0003 -
1.9087 2300 0.0001 -
1.9502 2350 0.0002 -
1.9917 2400 0.0001 -
2.0332 2450 0.0003 -
2.0747 2500 0.0002 -
2.1162 2550 0.0001 -
2.1577 2600 0.0001 -
2.1992 2650 0.0004 -
2.2407 2700 0.0002 -
2.2822 2750 0.0001 -
2.3237 2800 0.0005 -
2.3651 2850 0.0002 -
2.4066 2900 0.0003 -
2.4481 2950 0.0001 -
2.4896 3000 0.0001 -
2.5311 3050 0.0001 -
2.5726 3100 0.0001 -
2.6141 3150 0.0002 -
2.6556 3200 0.0001 -
2.6971 3250 0.0002 -
2.7386 3300 0.0002 -
2.7801 3350 0.0001 -
2.8216 3400 0.0001 -
2.8631 3450 0.0001 -
2.9046 3500 0.0001 -
2.9461 3550 0.0 -
2.9876 3600 0.0002 -
3.0290 3650 0.0001 -
3.0705 3700 0.0 -
3.1120 3750 0.0001 -
3.1535 3800 0.0001 -
3.1950 3850 0.0001 -
3.2365 3900 0.0001 -
3.2780 3950 0.0001 -
3.3195 4000 0.0001 -
3.3610 4050 0.0001 -
3.4025 4100 0.0 -
3.4440 4150 0.0001 -
3.4855 4200 0.0001 -
3.5270 4250 0.0001 -
3.5685 4300 0.0001 -
3.6100 4350 0.0002 -
3.6515 4400 0.0001 -
3.6929 4450 0.0001 -
3.7344 4500 0.0 -
3.7759 4550 0.0 -
3.8174 4600 0.0001 -
3.8589 4650 0.0001 -
3.9004 4700 0.0001 -
3.9419 4750 0.0 -
3.9834 4800 0.0001 -
4.0249 4850 0.0001 -
4.0664 4900 0.0001 -
4.1079 4950 0.0001 -
4.1494 5000 0.0 -
4.1909 5050 0.0 -
4.2324 5100 0.0 -
4.2739 5150 0.0 -
4.3154 5200 0.0001 -
4.3568 5250 0.0001 -
4.3983 5300 0.0001 -
4.4398 5350 0.0 -
4.4813 5400 0.0001 -
4.5228 5450 0.0 -
4.5643 5500 0.0001 -
4.6058 5550 0.0001 -
4.6473 5600 0.0001 -
4.6888 5650 0.0 -
4.7303 5700 0.0001 -
4.7718 5750 0.0001 -
4.8133 5800 0.0001 -
4.8548 5850 0.0 -
4.8963 5900 0.0 -
4.9378 5950 0.0 -
4.9793 6000 0.0001 -

Framework Versions

  • Python: 3.10.12
  • SetFit: 1.0.3
  • Sentence Transformers: 2.7.0
  • Transformers: 4.40.1
  • PyTorch: 2.2.1+cu121
  • Datasets: 2.19.0
  • 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}
}
Downloads last month
31
Safetensors
Model size
22.7M params
Tensor type
F32
·

Evaluation results