SetFit with sentence-transformers/all-mpnet-base-v2
This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/all-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:
- 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
- Sentence Transformer body: sentence-transformers/all-mpnet-base-v2
- Classification head: a LogisticRegression instance
- Maximum Sequence Length: 384 tokens
- Number of Classes: 11 classes
Model Sources
- Repository: SetFit on GitHub
- Paper: Efficient Few-Shot Learning Without Prompts
- Blogpost: SetFit: Efficient Few-Shot Learning Without Prompts
Model Labels
Label | Examples |
---|---|
theater |
|
party |
|
rock & pop |
|
carlos manucci |
|
atletico grau |
|
alianza lima |
|
art-culture |
|
food-drinks |
|
metal |
|
kids |
|
cinema |
|
Evaluation
Metrics
Label | Accuracy |
---|---|
all | 0.375 |
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("DiegoGCh/setfit-tryv1")
# Run inference
preds = model("Tono 80 90 la máquina del tiempo Fiesta 80 90 con los videos de la época, artistas invitados Leslie Stewart, Renato Rossini una noche de motos en el escenario rock & roll wave y más!!! .....Que empiece la juerga, anfitrión Renato Rossini.")
Training Details
Training Set Metrics
Training set | Min | Median | Max |
---|---|---|---|
Word count | 6 | 56.2632 | 155 |
Label | Training Sample Count |
---|---|
alianza atletico | 0 |
alianza lima | 1 |
andean | 0 |
art-culture | 1 |
ayacucho fc | 0 |
cinema | 1 |
folklore | 0 |
futsal | 0 |
hip hop | 0 |
others | 0 |
party | 5 |
rock & pop | 1 |
sport boys | 0 |
sporting cristal | 0 |
stand-up | 0 |
theater | 5 |
Training Hyperparameters
- batch_size: (8, 8)
- num_epochs: (3, 3)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 20
- body_learning_rate: (5e-05, 5e-05)
- head_learning_rate: 5e-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.004 | 1 | 0.2656 | - |
0.2 | 50 | 0.0891 | - |
0.4 | 100 | 0.062 | - |
0.6 | 150 | 0.0021 | - |
0.8 | 200 | 0.0006 | - |
1.0 | 250 | 0.0003 | - |
1.2 | 300 | 0.0078 | - |
1.4 | 350 | 0.0003 | - |
1.6 | 400 | 0.0001 | - |
1.8 | 450 | 0.0001 | - |
2.0 | 500 | 0.0002 | - |
2.2 | 550 | 0.0001 | - |
2.4 | 600 | 0.0004 | - |
2.6 | 650 | 0.0001 | - |
2.8 | 700 | 0.0 | - |
3.0 | 750 | 0.0003 | - |
0.004 | 1 | 0.3778 | - |
0.2 | 50 | 0.0361 | - |
0.4 | 100 | 0.0069 | - |
0.6 | 150 | 0.0041 | - |
0.8 | 200 | 0.0018 | - |
1.0 | 250 | 0.1319 | - |
1.2 | 300 | 0.0011 | - |
1.4 | 350 | 0.0023 | - |
1.6 | 400 | 0.0011 | - |
1.8 | 450 | 0.0013 | - |
2.0 | 500 | 0.0005 | - |
2.2 | 550 | 0.0002 | - |
2.4 | 600 | 0.0007 | - |
2.6 | 650 | 0.0001 | - |
2.8 | 700 | 0.0001 | - |
3.0 | 750 | 0.0002 | - |
0.0105 | 1 | 0.2121 | - |
0.5263 | 50 | 0.0011 | - |
1.0526 | 100 | 0.0083 | - |
1.5789 | 150 | 0.0005 | - |
2.1053 | 200 | 0.0002 | - |
2.6316 | 250 | 0.0003 | - |
Framework Versions
- Python: 3.10.14
- SetFit: 1.0.3
- Sentence Transformers: 3.0.1
- Transformers: 4.39.0
- PyTorch: 2.3.1+cu121
- Datasets: 2.21.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
- 4
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 DiegoGCh/setfit-tryv1
Base model
sentence-transformers/all-mpnet-base-v2