Edit model card

SetFit with Maltehb/danish-bert-botxo

This is a SetFit model that can be used for Text Classification. This SetFit model uses Maltehb/danish-bert-botxo 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:

  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
  • Sentence Transformer body: Maltehb/danish-bert-botxo
  • Classification head: a OneVsRestClassifier instance
  • Maximum Sequence Length: 512 tokens

Model Sources

Evaluation

Metrics

Label Accuracy
all 0.7317

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("OBech/IngroupOutgroup2")
# Run inference
preds = model("Jeg håber jeg igen kan få opbakning og tillid til at blive folketingsmedlem. Jeg kæmper for hjemstavnen. Jeg bor og lever i Vestjylland.")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 1 94.5901 380

Training Hyperparameters

  • batch_size: (8, 8)
  • num_epochs: (2, 2)
  • max_steps: -1
  • sampling_strategy: oversampling
  • 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
  • seed: 42
  • eval_max_steps: -1
  • load_best_model_at_end: True

Training Results

Epoch Step Training Loss Validation Loss
0.0005 1 0.2605 -
0.0235 50 0.3094 -
0.0471 100 0.2222 -
0.0706 150 0.2855 -
0.0941 200 0.1699 -
0.1176 250 0.1467 -
0.1412 300 0.152 -
0.1647 350 0.2407 -
0.1882 400 0.0391 -
0.2118 450 0.0165 -
0.2353 500 0.0009 -
0.2588 550 0.0004 -
0.2824 600 0.0014 -
0.3059 650 0.0006 -
0.3294 700 0.0001 -
0.3529 750 0.0007 -
0.3765 800 0.0002 -
0.4 850 0.0004 -
0.4235 900 0.0003 -
0.4471 950 0.0001 -
0.4706 1000 0.0001 -
0.4941 1050 0.0002 -
0.5176 1100 0.0002 -
0.5412 1150 0.0005 -
0.5647 1200 0.0002 -
0.5882 1250 0.0002 -
0.6118 1300 0.062 -
0.6353 1350 0.0004 -
0.6588 1400 0.0377 -
0.6824 1450 0.0001 -
0.7059 1500 0.0001 -
0.7294 1550 0.0002 -
0.7529 1600 0.0001 -
0.7765 1650 0.0009 -
0.8 1700 0.0002 -
0.8235 1750 0.0003 -
0.8471 1800 0.0001 -
0.8706 1850 0.0068 -
0.8941 1900 0.0002 -
0.9176 1950 0.0001 -
0.9412 2000 0.0 -
0.9647 2050 0.0002 -
0.9882 2100 0.0 -
1.0 2125 - 0.205
1.0118 2150 0.0164 -
1.0353 2200 0.0002 -
1.0588 2250 0.0 -
1.0824 2300 0.0001 -
1.1059 2350 0.0 -
1.1294 2400 0.0001 -
1.1529 2450 0.0001 -
1.1765 2500 0.036 -
1.2 2550 0.0078 -
1.2235 2600 0.0002 -
1.2471 2650 0.0088 -
1.2706 2700 0.0336 -
1.2941 2750 0.0 -
1.3176 2800 0.0001 -
1.3412 2850 0.0387 -
1.3647 2900 0.0 -
1.3882 2950 0.0042 -
1.4118 3000 0.0001 -
1.4353 3050 0.0 -
1.4588 3100 0.0001 -
1.4824 3150 0.0001 -
1.5059 3200 0.0001 -
1.5294 3250 0.002 -
1.5529 3300 0.0001 -
1.5765 3350 0.0055 -
1.6 3400 0.0002 -
1.6235 3450 0.0 -
1.6471 3500 0.0 -
1.6706 3550 0.0 -
1.6941 3600 0.0 -
1.7176 3650 0.0001 -
1.7412 3700 0.0347 -
1.7647 3750 0.0 -
1.7882 3800 0.0 -
1.8118 3850 0.0 -
1.8353 3900 0.0001 -
1.8588 3950 0.0 -
1.8824 4000 0.0001 -
1.9059 4050 0.0 -
1.9294 4100 0.0001 -
1.9529 4150 0.0073 -
1.9765 4200 0.0001 -
2.0 4250 0.0 0.2099
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.10.13
  • SetFit: 1.0.3
  • Sentence Transformers: 2.3.0
  • Transformers: 4.39.0
  • PyTorch: 2.1.2
  • Datasets: 2.20.0
  • Tokenizers: 0.15.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
2
Safetensors
Model size
111M params
Tensor type
F32
·
Inference Examples
Inference API (serverless) is not available, repository is disabled.

Model tree for OBech/IngroupOutgroup2

Finetuned
this model

Evaluation results