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

Model Labels

Label Examples
1
  • 'Injuries prevent Fox from continuing career Rick Fox made it official yesterday: He will not be coming through any door to have a second go-round with the Celtics. As shockers go, this one is slightly behind quot;Dewey Defeats Truman. quot;'
  • 'Sack-happy #39;D #39; bags Bills defenders got a piece of Bledsoe, and the Raiders offense did just enough -- as in a 43-yard touchdown pass from Rich Gannon to Ronald Curry and two Sebastian Janikowski field '
  • 'Aussies ready for Sachin On Wednesday morning Sachin Tendulkar was at the Brabourne stadium, to egg on his Mumbai teammates. Not only did he have a chat with the Mumbai captain and coach and see the practice session through, but also '
2
  • 'Costello to steer Group of 20 TREASURER Peter Costello will chair the 2006 meeting of the Group of 20, which brings together the finance ministers and central bankers from the leading industrial and developing nations.'
  • 'Bye-bye, floppy. It #39;s been good to know you If you #39;re a computer user, you may have several of them stacked on your desk. We #39;re talking about floppy disks - and they are pretty much becoming extinct.'
  • 'Eisner #39;s Exit Plan Good for Disney -Analysts While fans of Michael Eisner argue that his 20-year legacy of continued financial and stock growth at the Walt Disney Co. is a strong achievement, Wall Street observers say his record is more mixed.'
0
  • "Militants beat man thought to be from US HENDALA, Sri Lanka -- Day after day, locked in a cement room somewhere in Iraq, the hooded men beat him. They told him he would be beheaded. ''Ameriqi! quot; they shouted, even though he comes from this poor Sri Lankan fishing village."
  • 'World News gt; Indians unfazed by Kathmandu blockade - but panic in India: Kanaiyalal Jiwanlal, a businessman from Valsad in Gujarat, has seen sectarian violence and a killer earthquake devastate parts of the western Indian state. Compared to such upheavals, the blockade of Kathmandu, called by Maoists, holds no terror for him. '
  • 'Mosque on Fire After U.S. Air Strikes in West Iraq BAGHDAD (Reuters) - U.S. marines engaged in heavy clashes with scores of insurgents near a mosque in western Iraq on Monday, leading to U.S. air strikes which damaged the shrine and left it ablaze, the U.S. military said.'
3
  • 'Philips Electronics resumes marketing PCs After an absence of a decade, Philips Electronics is making personal computers again, the company said yesterday. The Netherlands-based electronics conglomerate, which abandoned the PC business in the early '
  • 'Microsoft is ready to remove media player for EU Microsoft will be ready to comply with European Commission demands for changes to its Windows operating systems if a European court does not suspend the antitrust remedy, a company spokesman said today.'
  • 'NASA #39;s chief quitting post Sean O #39;Keefe on Monday officially resigned as the head of NASA to interview as the chancellor at Louisiana State University in Baton Rouge.'

Evaluation

Metrics

Label Accuracy
all 0.8567

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("vidhi0206/setfit-paraphrase-mpnet-ag_news")
# Run inference
preds = model("Mauresmo confident of LA victory Amelie Mauresmo insists she can win the Tour Championships this week and finish the year as world number one. The Frenchwoman could overtake Lindsay Davenport with a win in Los Angeles.")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 25 40.0938 56
Label Training Sample Count
0 8
1 8
2 8
3 8

Training Hyperparameters

  • batch_size: (8, 8)
  • num_epochs: (1, 1)
  • 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.0063 1 0.1756 -
0.3125 50 0.0433 -
0.625 100 0.0022 -
0.9375 150 0.0011 -

Framework Versions

  • Python: 3.8.10
  • SetFit: 1.0.3
  • Sentence Transformers: 2.3.1
  • Transformers: 4.37.2
  • PyTorch: 2.2.0+cu121
  • Datasets: 2.17.0
  • Tokenizers: 0.15.1

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
109M params
Tensor type
F32
·

Finetuned from

Evaluation results