SetFit with BAAI/bge-small-en-v1.5

This is a SetFit model trained on the davanstrien/blbooksgenre dataset that can be used for Text Classification. This SetFit model uses BAAI/bge-small-en-v1.5 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:

  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 Sources

Model Labels

Label Examples
1
  • 'Resa i Förenta Staterna'
  • 'The Great Country; or, Impressions of America'
  • "The Visitor's Guide to Oxford. (Abridged ... from the 'Handbook for Visitors to Oxford.') A new edition, with 110 illustrations [The preface is signed, J. P.]"
0
  • 'Cousin Simon [A novel.]'
  • 'Geschied- en oudheidkundige beschrijving van de pleinen, straten, stegen, waterleidingen, wedden, putten en pompen der stad Utrecht, etc'
  • 'The Mystic Quest. A tale of two incarnations'

Evaluation

Metrics

Label Accuracy
all 0.8793

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("Mirabelle [A novel.]")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 1 13.0836 77
Label Training Sample Count
0 348
1 1040

Training Hyperparameters

  • batch_size: (32, 32)
  • num_epochs: (3, 3)
  • max_steps: -1
  • sampling_strategy: oversampling
  • num_iterations: 20
  • body_learning_rate: (2e-05, 1e-05)
  • head_learning_rate: 0.01
  • 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.0006 1 0.2366 -
0.0288 50 0.2442 -
0.0576 100 0.2335 -
0.0865 150 0.2212 -
0.1153 200 0.1858 -
0.1441 250 0.1551 -
0.1729 300 0.1409 -
0.2017 350 0.1148 -
0.2305 400 0.0867 -
0.2594 450 0.0546 -
0.2882 500 0.0326 -
0.3170 550 0.0256 -
0.3458 600 0.0145 -
0.3746 650 0.0137 -
0.4035 700 0.0134 -
0.4323 750 0.0072 -
0.4611 800 0.0144 -
0.4899 850 0.0059 -
0.5187 900 0.0088 -
0.5476 950 0.011 -
0.5764 1000 0.0048 -
0.6052 1050 0.0026 -
0.6340 1100 0.0077 -
0.6628 1150 0.0022 -
0.6916 1200 0.0023 -
0.7205 1250 0.0022 -
0.7493 1300 0.0018 -
0.7781 1350 0.0032 -
0.8069 1400 0.0016 -
0.8357 1450 0.0013 -
0.8646 1500 0.0032 -
0.8934 1550 0.0022 -
0.9222 1600 0.0025 -
0.9510 1650 0.0005 -
0.9798 1700 0.001 -
1.0086 1750 0.0019 -
1.0375 1800 0.0025 -
1.0663 1850 0.0019 -
1.0951 1900 0.0021 -
1.1239 1950 0.0016 -
1.1527 2000 0.0016 -
1.1816 2050 0.0016 -
1.2104 2100 0.0011 -
1.2392 2150 0.0026 -
1.2680 2200 0.0021 -
1.2968 2250 0.0019 -
1.3256 2300 0.001 -
1.3545 2350 0.0015 -
1.3833 2400 0.0028 -
1.4121 2450 0.0023 -
1.4409 2500 0.0016 -
1.4697 2550 0.0024 -
1.4986 2600 0.0035 -
1.5274 2650 0.0021 -
1.5562 2700 0.0015 -
1.5850 2750 0.0009 -
1.6138 2800 0.0009 -
1.6427 2850 0.0018 -
1.6715 2900 0.0004 -
1.7003 2950 0.0006 -
1.7291 3000 0.0004 -
1.7579 3050 0.0011 -
1.7867 3100 0.0004 -
1.8156 3150 0.0004 -
1.8444 3200 0.0006 -
1.8732 3250 0.0005 -
1.9020 3300 0.0003 -
1.9308 3350 0.0004 -
1.9597 3400 0.0003 -
1.9885 3450 0.0003 -
2.0173 3500 0.0003 -
2.0461 3550 0.0003 -
2.0749 3600 0.0003 -
2.1037 3650 0.0003 -
2.1326 3700 0.0003 -
2.1614 3750 0.0003 -
2.1902 3800 0.0003 -
2.2190 3850 0.0009 -
2.2478 3900 0.0003 -
2.2767 3950 0.0003 -
2.3055 4000 0.0003 -
2.3343 4050 0.0003 -
2.3631 4100 0.0003 -
2.3919 4150 0.0003 -
2.4207 4200 0.0003 -
2.4496 4250 0.0003 -
2.4784 4300 0.0003 -
2.5072 4350 0.0003 -
2.5360 4400 0.0003 -
2.5648 4450 0.0003 -
2.5937 4500 0.0003 -
2.6225 4550 0.0003 -
2.6513 4600 0.0003 -
2.6801 4650 0.0003 -
2.7089 4700 0.0003 -
2.7378 4750 0.0003 -
2.7666 4800 0.0003 -
2.7954 4850 0.0003 -
2.8242 4900 0.0003 -
2.8530 4950 0.0003 -
2.8818 5000 0.0003 -
2.9107 5050 0.0003 -
2.9395 5100 0.0003 -
2.9683 5150 0.0003 -
2.9971 5200 0.0003 -

Framework Versions

  • Python: 3.12.9
  • SetFit: 1.1.3
  • Sentence Transformers: 5.3.0
  • Transformers: 4.57.6
  • PyTorch: 2.11.0
  • Datasets: 4.8.4
  • Tokenizers: 0.22.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
16
Safetensors
Model size
33.4M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for davanstrien/blbooksgenre-setfit

Finetuned
(296)
this model

Dataset used to train davanstrien/blbooksgenre-setfit

Paper for davanstrien/blbooksgenre-setfit

Evaluation results