Edit model card

SetFit with sentence-transformers/paraphrase-mpnet-base-v2

This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/paraphrase-mpnet-base-v2 as the Sentence Transformer embedding model. A SetFitHead 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
6
  • 'The girl does 2 perfect flips. The girls'
  • 'Emerging in open water, he does a breaststroke toward the murky. He'
  • 'A young child is moving back and fourth on a swing while laughing and smiling to the camera. The child'
4
  • 'He turns away and covers his face with one hand. Someone'
  • 'With a nod, the man hands it over to the defeated boy. Someone'
  • "On the shop floor, his little helper helps himself to an expensive handbag from a display cabinet, then some women's designer shoes, all of which are detailed on a list. He"
1
  • 'A lot of people are sitting on terraces in a big field and people is walking in the entrance of a big stadium. men'
  • 'The water gets rough as the past through some rocks. Several people'
  • 'We see a man dunk the ball twice. We'
5
  • 'A man wearing a safari hat leads a group of camels with riders in a single file. The camera'
  • 'Someone stirs the cookie dough in a bowl. The dough'
  • 'A logo for a sports even is shown. There'
8
  • 'A girl is shown several times running on a track. She'
  • 'Someone peers out from the cabin. As she emerges, someone'
  • 'Someone and someone swap looks. She'
2
  • 'In slow motion, both the Russians and Americans celebrate. Someone'
  • 'Through a window, we watch someone raise his teacup to his companions. At home, someone'
  • 'People stand by the wall, laughing. He'
7
  • 'Someone turns at the sound of the distant horns. 6000 horsemen, lead by people,'
  • "The man plays the video in reverse to look as if he's putting shaving cream on with the razor. The men then"
  • 'He eyes someone with a furrowed brow, then springs up and hurries after her. Someone and someone'
0
  • 'She opens a small metal box on a desk and pushes a button inside. Someone'
  • 'Someone starts to say something then thinks better of it, and remains silent. Someone'
  • "Someone changes into a Spanish policeman's outfit and heads down an outside staircase with the packed up rifle. As someone leaves, someone"
3
  • 'He is shown playing a game with a virtual sumo wrestler. The shorter man'
  • 'The girls flips, then runs, flips and dismounts. The cloud'
  • 'The official extends a red flag. As Master someone'

Evaluation

Metrics

Label Accuracy
all 0.1148

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("HelgeKn/Swag-multi-class-4")
# Run inference
preds = model("He approaches the object and reads a plaque on its side. Someone")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 6 13.25 31
Label Training Sample Count
0 4
1 4
2 4
3 4
4 4
5 4
6 4
7 4
8 4

Training Hyperparameters

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

Training Results

Epoch Step Training Loss Validation Loss
0.0111 1 0.2285 -
0.5556 50 0.0567 -
1.1111 100 0.0083 -
1.6667 150 0.0084 -

Framework Versions

  • Python: 3.9.13
  • SetFit: 1.0.1
  • Sentence Transformers: 2.2.2
  • Transformers: 4.36.0
  • PyTorch: 2.1.1+cpu
  • Datasets: 2.15.0
  • Tokenizers: 0.15.0

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
6
Safetensors
Model size
109M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for HelgeKn/Swag-multi-class-4

Finetuned
(247)
this model

Evaluation results