metadata
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
base_model: jhu-clsp/mmBERT-base
model-index:
- name: SetFit with jhu-clsp/mmBERT-base
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: Unknown
type: unknown
split: test
metrics:
- type: accuracy
value: 0.9878113407525172
name: Accuracy
SetFit with jhu-clsp/mmBERT-base
This is a SetFit model that can be used for Text Classification. This SetFit model uses jhu-clsp/mmBERT-base 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: jhu-clsp/mmBERT-base
- Classification head: a LogisticRegression instance
- Maximum Sequence Length: 8192 tokens
- Number of Classes: 2 classes
Model Sources
- Repository: SetFit on GitHub
- Paper: Efficient Few-Shot Learning Without Prompts
- Blogpost: SetFit: Efficient Few-Shot Learning Without Prompts
Evaluation
Metrics
| Label | Accuracy |
|---|---|
| all | 0.9878 |
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("johnpaulbin/toxicity-setfit-3-large")
# Run inference
preds = model("just here")
Training Details
Training Set Metrics
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 1 | 4.8969 | 81 |
| Label | Training Sample Count |
|---|---|
| not toxic | 9846 |
| toxic | 7132 |
Training Hyperparameters
- batch_size: (128, 128)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: num_iterations
- num_iterations: 8
- 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: True
- 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.0005 | 1 | 0.3202 | - |
| 0.0236 | 50 | 0.2709 | - |
| 0.0471 | 100 | 0.1783 | - |
| 0.0707 | 150 | 0.0719 | - |
| 0.0942 | 200 | 0.0453 | - |
| 0.1178 | 250 | 0.0266 | - |
| 0.1413 | 300 | 0.0175 | - |
| 0.1649 | 350 | 0.0158 | - |
| 0.1884 | 400 | 0.0102 | - |
| 0.2120 | 450 | 0.0075 | - |
| 0.2355 | 500 | 0.0072 | - |
| 0.2591 | 550 | 0.0064 | - |
| 0.2826 | 600 | 0.0041 | - |
| 0.3062 | 650 | 0.0028 | - |
| 0.3297 | 700 | 0.003 | - |
| 0.3533 | 750 | 0.0029 | - |
| 0.3768 | 800 | 0.0026 | - |
| 0.4004 | 850 | 0.0028 | - |
| 0.4239 | 900 | 0.0026 | - |
| 0.4475 | 950 | 0.0023 | - |
| 0.4710 | 1000 | 0.002 | - |
| 0.4946 | 1050 | 0.0009 | - |
| 0.5181 | 1100 | 0.0018 | - |
| 0.5417 | 1150 | 0.0008 | - |
| 0.5652 | 1200 | 0.0011 | - |
| 0.5888 | 1250 | 0.0019 | - |
| 0.6123 | 1300 | 0.001 | - |
| 0.6359 | 1350 | 0.0005 | - |
| 0.6594 | 1400 | 0.0012 | - |
| 0.6830 | 1450 | 0.0013 | - |
| 0.7065 | 1500 | 0.0003 | - |
| 0.7301 | 1550 | 0.0008 | - |
| 0.7537 | 1600 | 0.001 | - |
| 0.7772 | 1650 | 0.0009 | - |
| 0.8008 | 1700 | 0.001 | - |
| 0.8243 | 1750 | 0.0007 | - |
| 0.8479 | 1800 | 0.0009 | - |
| 0.8714 | 1850 | 0.0005 | - |
| 0.8950 | 1900 | 0.0005 | - |
| 0.9185 | 1950 | 0.0004 | - |
| 0.9421 | 2000 | 0.0004 | - |
| 0.9656 | 2050 | 0.0004 | - |
| 0.9892 | 2100 | 0.0011 | - |
| 1.0 | 2123 | - | 0.0231 |
Framework Versions
- Python: 3.12.12
- SetFit: 1.2.0.dev0
- Sentence Transformers: 5.2.0
- Transformers: 4.57.3
- PyTorch: 2.9.0+cu126
- Datasets: 4.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}
}