SetFit with sentence-transformers/all-MiniLM-L12-v2

This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/all-MiniLM-L12-v2 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

Evaluation

Metrics

Label Accuracy
all 0.8776

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("Food and Bons Drinks included")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 2 6.5514 23
Label Training Sample Count
Housing / rent 3
Housing / house loan 14
Housing / utilities & bills 17
Housing / services & maintenance 1
Housing / other 1
Food & Drinks / groceries 0
Food & Drinks / eating out 1
Food & Drinks / other 10
Leisure & Entertainment / sports & hobbies 2
Leisure & Entertainment / culture & events 1
Leisure & Entertainment / travel 1
Leisure & Entertainment / other 51
Transportation / car loan & leasing 13
Transportation / fuel 10
Transportation / public transportation 3
Transportation / taxi & carpool 5
Transportation / maitenance 22
Transportation / other 158
Recurrent Payments / loans 9
Recurrent Payments / insurance 28
Recurrent Payments / subscription 10
Recurrent Payments / other 2
Investment / securities 1
Investment / retirement & savings 0
Investment / real estate 5
Investment / other 4
Shopping / clothing 8
Shopping / electronics & multimedia 2
Shopping / sporting goods 24
Shopping / housing equipment 2
Shopping / other 21
Healthy & Beauty / doctor fees 13
Healthy & Beauty / pharmacy 9
Healthy & Beauty / beauty & self-care 5
Healthy & Beauty / veterinary 4
Healthy & Beauty / other 8
Bank services / transfers 2
Bank services / withdrawal 3
Bank services / general fees 1
Bank services / other 2
Other / taxes 0
Other / kids 6
Other / pets 5
Other / other 12

Training Hyperparameters

  • batch_size: (32, 32)
  • num_epochs: (1, 1)
  • max_steps: -1
  • sampling_strategy: oversampling
  • num_iterations: 10
  • 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.0027 1 0.1199 -
0.1370 50 0.0613 -
0.2740 100 0.0247 -
0.4110 150 0.0174 -
0.5479 200 0.0125 -
0.6849 250 0.011 -
0.8219 300 0.0143 -
0.9589 350 0.0127 -

Framework Versions

  • Python: 3.12.6
  • SetFit: 1.1.2
  • Sentence Transformers: 3.3.1
  • Transformers: 4.46.3
  • PyTorch: 2.5.1+cpu
  • Datasets: 3.5.0
  • Tokenizers: 0.20.3

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
18
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 yassine123Z/EmissionFactor-mapper2-v2

Finetuned
(52)
this model

Spaces using yassine123Z/EmissionFactor-mapper2-v2 3

Paper for yassine123Z/EmissionFactor-mapper2-v2

Evaluation results