CoolFace
Modelpublic

tomaarsen/setfit-all-MiniLM-L6-v2-sst2-32-shot

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
7likes46downloads
Model Card

SetFit with sentence-transformers/all-MiniLM-L6-v2 on sst2

This is a SetFit model trained on the sst2 dataset that can be used for Text Classification. This SetFit model uses sentence-transformers/all-MiniLM-L6-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. 1.Fine-tuning a Sentence Transformer with contrastive learning.
  2. 2.Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

Model Sources

Model Labels

LabelExamples
negative<ul><li>'a tough pill to swallow and '</li><li>'indignation '</li><li>'that the typical hollywood disregard for historical truth and realism is at work here '</li></ul>
positive<ul><li>"a moving experience for people who have n't read the book "</li><li>'in the best possible senses of both those words '</li><li>'to serve the work especially well '</li></ul>

Evaluation

Metrics

LabelAccuracy
all0.7513

Uses

Direct Use for Inference

First install the SetFit library:

bash
pip install setfit

Then you can load this model and run inference.

python
from setfit import SetFitModel

# Download from 🤗 Hub
model = SetFitModel.from_pretrained("tomaarsen/setfit-all-MiniLM-L6-v2-sst2-8-shot")
# Run inference
preds = model("a fast , funny , highly enjoyable movie . ")

<!--

Downstream Use

List how someone could finetune this model on their own dataset. -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Set Metrics

Training setMinMedianMax
Word count210.281236
LabelTraining Sample Count
negative32
positive32

Training Hyperparameters

  • —batch_size: (16, 16)
  • —num_epochs: (3, 3)
  • —max_steps: -1
  • —sampling_strategy: oversampling
  • —bodylearningrate: (2e-05, 1e-05)
  • —headlearningrate: 0.01
  • —loss: CosineSimilarityLoss
  • —distancemetric: cosinedistance
  • —margin: 0.25
  • —endtoend: False
  • —use_amp: False
  • —warmup_proportion: 0.1
  • —seed: 42
  • —loadbestmodelatend: True

Training Results

EpochStepTraining LossValidation Loss
0.007610.3787-
0.0758100.2855-
0.1515200.34580.29
0.2273300.2496-
0.3030400.23980.2482
0.3788500.2068-
0.4545600.24710.244
0.5303700.2053-
0.6061800.18020.2361
0.6818900.0767-
0.75761000.02790.2365
0.83331100.0192-
0.90911200.00950.2527
0.98481300.0076-
1.06061400.00820.2651
1.13641500.0068-
1.21211600.00520.2722
1.28791700.0029-
1.36361800.00420.273
1.43941900.0026-
1.51522000.00360.2761
1.59092100.0044-
1.66672200.00270.2796
1.74242300.0025-
1.81822400.00250.2817
1.89392500.003-
1.96972600.00260.2817
2.04552700.0035-
2.12122800.0020.2816
2.19702900.0023-
2.27273000.00160.2821
2.34853100.0023-
2.42423200.00150.2838
2.53300.0014-
2.57583400.0020.2842
2.65153500.002-
2.72733600.00130.2847
2.80303700.0009-
2.87883800.00180.2857
2.95453900.0016-
  • —The bold row denotes the saved checkpoint.

Environmental Impact

Carbon emissions were measured using CodeCarbon.

  • —Carbon Emitted: 0.003 kg of CO2
  • —Hours Used: 0.072 hours

Training Hardware

  • —On Cloud: No
  • —GPU Model: 1 x NVIDIA GeForce RTX 3090
  • —CPU Model: 13th Gen Intel(R) Core(TM) i7-13700K
  • —RAM Size: 31.78 GB

Framework Versions

  • —Python: 3.9.16
  • —SetFit: 1.0.0.dev0
  • —Sentence Transformers: 2.2.2
  • —Transformers: 4.29.0
  • —PyTorch: 1.13.1+cu117
  • —Datasets: 2.15.0
  • —Tokenizers: 0.13.3

Citation

BibTeX

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}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->