SetFit
This is a SetFit model that can be used for Text Classification. A LogisticRegression instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
- Fine-tuning a Sentence Transformer with contrastive learning.
- Training a classification head with features from the fine-tuned Sentence Transformer.
Model Details
Model Description
- Model Type: SetFit
- Classification head: a LogisticRegression instance
- Maximum Sequence Length: 512 tokens
- Number of Classes: 5 classes
Model Sources
Model Labels
| Label |
Examples |
| INFORMATION |
- 'We lose a lot of time on the streets, easy laptop.'
- 'Okay, Lucid Gap 1.2, nice work. Right, eight laps to go once you cross the line.'
- "Well done, Daniel. That's the checkered flag. P7, buddy. P7 is a good start. Well defended at the end. That was great driving last few laps. Cheers, guys. Good start. Obviously, I'll learn a bit from today. We'll keep getting better, but not a bad first weekend. Congrats."
|
| PROBLEM |
- 'I think I have still some damage. Balance is quite a bit off. Understood. We do see from data.'
- 'So that floor damage looks like it picked up at turn 8, so right hand side.'
- 'Okay, so switch off the engine please Lewis.'
|
| ORDER |
- 'Okay, mode race and focus on turn two preparation, turn two and three for this lap.'
- 'Okay, that last lap, same pace as signs. And mode seven. Mode seven.'
- 'Yuki, we are rear left limited, so watch we spin and we can push in the high speed. Push in the high speed.'
|
| WARNING |
- 'Be careful, a lot of people in the pit lane, so obviously they will move, but watch yourself as well.'
- "The only concern I have, if the safety car comes out and we have to pit for that hard tyre and I can't get any temperature into it, we're in trouble. Yeah, copy Lewis, we're not concerned, we think everyone will be in the same boat, if not worse."
- "So, Max, for info, you've been given a 10 second penalty for forcing Lando off track at turn 4. So, head down. 10. That's quite impressive. That was a lot of whinging. A lot."
|
| QUESTION |
- "Do you want to flap adjust Nico? Not really, but it's new sticky tires. Let's maybe try. Which way would you go? I would take off, yeah. I would try less, I guess, and see what it feels like. Okay, copy. Take like half percent down. Turn 10 feels pretty low in grip, like tailwind, I think. The rear is pretty unhappy there. Yes, on the tailwind into 10. Also, 1 and 6 and 7 are tailwind. Okay, so we've taken off 0.5. We'll get a feel. One more grid. Go to the grid after this. Close the radio rear, it's too loud."
- "That's it, mate. You are world champion. World champion. What a mate. I'm so proud. Lando, this is Zach from McLaren. Is this the world champion hotline? Yeah. You did it! You did it! Arthur! Woo! Thank you, guys. Oh my god. You made a kid's dream come true. Thank you so much. I love you guys. Thanks for everything. You deserve it. I love you, Mum. I love you, Dad. Thanks for everything. I'm not crying."
- "And Lando, do you think you can get past? Otherwise, what about plan B? Remember R switch, R switch. Yeah, if you've got the goblins, go for it."
|
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
model = SetFitModel.from_pretrained("setfit_model_id")
preds = model("Don't go too crazy on the brake warm up.")
Training Details
Training Set Metrics
| Training set |
Min |
Median |
Max |
| Word count |
2 |
27.2063 |
386 |
| Label |
Training Sample Count |
| INFORMATION |
32 |
| PROBLEM |
32 |
| ORDER |
32 |
| WARNING |
32 |
| QUESTION |
32 |
Training Hyperparameters
- batch_size: (8, 8)
- num_epochs: (1, 1)
- 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: True
Training Results
| Epoch |
Step |
Training Loss |
Validation Loss |
| 0.0013 |
1 |
0.1755 |
- |
| 0.0625 |
50 |
0.3393 |
- |
| 0.125 |
100 |
0.3649 |
- |
| 0.1875 |
150 |
0.4159 |
- |
| 0.25 |
200 |
0.3289 |
- |
| 0.3125 |
250 |
0.3171 |
- |
| 0.375 |
300 |
0.2952 |
- |
| 0.4375 |
350 |
0.3004 |
- |
| 0.5 |
400 |
0.3111 |
- |
| 0.5625 |
450 |
0.3039 |
- |
| 0.625 |
500 |
0.2702 |
- |
| 0.6875 |
550 |
0.2891 |
- |
| 0.75 |
600 |
0.2793 |
- |
| 0.8125 |
650 |
0.2652 |
- |
| 0.875 |
700 |
0.2761 |
- |
| 0.9375 |
750 |
0.2603 |
- |
| 1.0 |
800 |
0.2543 |
0.5 |
Framework Versions
- Python: 3.12.13
- SetFit: 1.1.3
- Sentence Transformers: 5.4.1
- Transformers: 5.0.0
- PyTorch: 2.10.0+cu128
- Datasets: 5.0.0
- 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}
}