yaniseuranova's picture
Add SetFit model
2765549 verified
---
base_model: BAAI/bge-m3
library_name: setfit
metrics:
- accuracy
pipeline_tag: text-classification
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: How does technology impact our daily lives and what benefits can it bring
to various activities?
- text: How do organizations effectively deploy and manage machine learning algorithms
to drive business value?
- text: What are the key considerations for organizing and managing computer lab resources
and tracking their status?
- text: How can batch processing improve the efficiency of data lake operations?
- text: What is the purpose of setting up a CUPS on a server?
inference: true
model-index:
- name: SetFit with BAAI/bge-m3
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: Unknown
type: unknown
split: test
metrics:
- type: accuracy
value: 0.8947368421052632
name: Accuracy
---
# SetFit with BAAI/bge-m3
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [BAAI/bge-m3](https://huggingface.co./BAAI/bge-m3) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) 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](https://www.sbert.net) with contrastive learning.
2. Training a classification head with features from the fine-tuned Sentence Transformer.
## Model Details
### Model Description
- **Model Type:** SetFit
- **Sentence Transformer body:** [BAAI/bge-m3](https://huggingface.co./BAAI/bge-m3)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 8192 tokens
- **Number of Classes:** 2 classes
<!-- - **Training Dataset:** [Unknown](https://huggingface.co./datasets/unknown) -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->
### Model Sources
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co./blog/setfit)
### Model Labels
| Label | Examples |
|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| lexical | <ul><li>"How does Happeo's search AI work to provide answers to user queries?"</li><li>'What are the primary areas of focus in the domain of Data Science and Analysis?'</li><li>'How can one organize a running event in Belgium?'</li></ul> |
| semantic | <ul><li>'What changes can be made to a channel header?'</li><li>'How can hardware capabilities impact the accuracy of motion and object detections?'</li><li>'Who is responsible for managing guarantees and prolongations?'</li></ul> |
## Evaluation
### Metrics
| Label | Accuracy |
|:--------|:---------|
| **all** | 0.8947 |
## 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 the 🤗 Hub
model = SetFitModel.from_pretrained("yaniseuranova/setfit-rag-hybrid-search-query-router")
# Run inference
preds = model("What is the purpose of setting up a CUPS on a server?")
```
<!--
### 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 set | Min | Median | Max |
|:-------------|:----|:--------|:----|
| Word count | 4 | 13.7407 | 28 |
| Label | Training Sample Count |
|:---------|:----------------------|
| lexical | 44 |
| semantic | 118 |
### Training Hyperparameters
- batch_size: (8, 8)
- num_epochs: (3, 3)
- max_steps: -1
- sampling_strategy: oversampling
- 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
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: True
### Training Results
| Epoch | Step | Training Loss | Validation Loss |
|:-------:|:--------:|:-------------:|:---------------:|
| 0.0005 | 1 | 0.257 | - |
| 0.0250 | 50 | 0.1944 | - |
| 0.0499 | 100 | 0.2383 | - |
| 0.0749 | 150 | 0.1279 | - |
| 0.0999 | 200 | 0.0033 | - |
| 0.1248 | 250 | 0.0021 | - |
| 0.1498 | 300 | 0.0012 | - |
| 0.1747 | 350 | 0.0008 | - |
| 0.1997 | 400 | 0.0004 | - |
| 0.2247 | 450 | 0.0006 | - |
| 0.2496 | 500 | 0.0005 | - |
| 0.2746 | 550 | 0.0003 | - |
| 0.2996 | 600 | 0.0003 | - |
| 0.3245 | 650 | 0.0003 | - |
| 0.3495 | 700 | 0.0004 | - |
| 0.3744 | 750 | 0.0005 | - |
| 0.3994 | 800 | 0.0003 | - |
| 0.4244 | 850 | 0.0002 | - |
| 0.4493 | 900 | 0.0002 | - |
| 0.4743 | 950 | 0.0002 | - |
| 0.4993 | 1000 | 0.0001 | - |
| 0.5242 | 1050 | 0.0001 | - |
| 0.5492 | 1100 | 0.0001 | - |
| 0.5741 | 1150 | 0.0002 | - |
| 0.5991 | 1200 | 0.0001 | - |
| 0.6241 | 1250 | 0.0003 | - |
| 0.6490 | 1300 | 0.0002 | - |
| 0.6740 | 1350 | 0.0001 | - |
| 0.6990 | 1400 | 0.0003 | - |
| 0.7239 | 1450 | 0.0001 | - |
| 0.7489 | 1500 | 0.0002 | - |
| 0.7738 | 1550 | 0.0001 | - |
| 0.7988 | 1600 | 0.0002 | - |
| 0.8238 | 1650 | 0.0002 | - |
| 0.8487 | 1700 | 0.0002 | - |
| 0.8737 | 1750 | 0.0002 | - |
| 0.8987 | 1800 | 0.0003 | - |
| 0.9236 | 1850 | 0.0001 | - |
| 0.9486 | 1900 | 0.0001 | - |
| 0.9735 | 1950 | 0.0001 | - |
| 0.9985 | 2000 | 0.0001 | - |
| **1.0** | **2003** | **-** | **0.1735** |
| 1.0235 | 2050 | 0.0001 | - |
| 1.0484 | 2100 | 0.0001 | - |
| 1.0734 | 2150 | 0.0001 | - |
| 1.0984 | 2200 | 0.0 | - |
| 1.1233 | 2250 | 0.0001 | - |
| 1.1483 | 2300 | 0.0001 | - |
| 1.1732 | 2350 | 0.0001 | - |
| 1.1982 | 2400 | 0.0002 | - |
| 1.2232 | 2450 | 0.0001 | - |
| 1.2481 | 2500 | 0.0 | - |
| 1.2731 | 2550 | 0.0001 | - |
| 1.2981 | 2600 | 0.0001 | - |
| 1.3230 | 2650 | 0.0 | - |
| 1.3480 | 2700 | 0.0001 | - |
| 1.3729 | 2750 | 0.0001 | - |
| 1.3979 | 2800 | 0.0001 | - |
| 1.4229 | 2850 | 0.0 | - |
| 1.4478 | 2900 | 0.0001 | - |
| 1.4728 | 2950 | 0.0001 | - |
| 1.4978 | 3000 | 0.0001 | - |
| 1.5227 | 3050 | 0.0001 | - |
| 1.5477 | 3100 | 0.0 | - |
| 1.5726 | 3150 | 0.0 | - |
| 1.5976 | 3200 | 0.0001 | - |
| 1.6226 | 3250 | 0.0001 | - |
| 1.6475 | 3300 | 0.0001 | - |
| 1.6725 | 3350 | 0.0001 | - |
| 1.6975 | 3400 | 0.0001 | - |
| 1.7224 | 3450 | 0.0 | - |
| 1.7474 | 3500 | 0.0002 | - |
| 1.7723 | 3550 | 0.0001 | - |
| 1.7973 | 3600 | 0.0 | - |
| 1.8223 | 3650 | 0.0 | - |
| 1.8472 | 3700 | 0.0001 | - |
| 1.8722 | 3750 | 0.0 | - |
| 1.8972 | 3800 | 0.0001 | - |
| 1.9221 | 3850 | 0.0 | - |
| 1.9471 | 3900 | 0.0 | - |
| 1.9720 | 3950 | 0.0001 | - |
| 1.9970 | 4000 | 0.0 | - |
| 2.0 | 4006 | - | 0.2593 |
| 2.0220 | 4050 | 0.0001 | - |
| 2.0469 | 4100 | 0.0001 | - |
| 2.0719 | 4150 | 0.0 | - |
| 2.0969 | 4200 | 0.0001 | - |
| 2.1218 | 4250 | 0.0 | - |
| 2.1468 | 4300 | 0.0001 | - |
| 2.1717 | 4350 | 0.0001 | - |
| 2.1967 | 4400 | 0.0001 | - |
| 2.2217 | 4450 | 0.0001 | - |
| 2.2466 | 4500 | 0.0001 | - |
| 2.2716 | 4550 | 0.0 | - |
| 2.2966 | 4600 | 0.0 | - |
| 2.3215 | 4650 | 0.0 | - |
| 2.3465 | 4700 | 0.0001 | - |
| 2.3714 | 4750 | 0.0001 | - |
| 2.3964 | 4800 | 0.0002 | - |
| 2.4214 | 4850 | 0.0001 | - |
| 2.4463 | 4900 | 0.0001 | - |
| 2.4713 | 4950 | 0.0 | - |
| 2.4963 | 5000 | 0.0001 | - |
| 2.5212 | 5050 | 0.0001 | - |
| 2.5462 | 5100 | 0.0 | - |
| 2.5711 | 5150 | 0.0001 | - |
| 2.5961 | 5200 | 0.0 | - |
| 2.6211 | 5250 | 0.0 | - |
| 2.6460 | 5300 | 0.0 | - |
| 2.6710 | 5350 | 0.0 | - |
| 2.6960 | 5400 | 0.0 | - |
| 2.7209 | 5450 | 0.0 | - |
| 2.7459 | 5500 | 0.0 | - |
| 2.7708 | 5550 | 0.0 | - |
| 2.7958 | 5600 | 0.0001 | - |
| 2.8208 | 5650 | 0.0 | - |
| 2.8457 | 5700 | 0.0 | - |
| 2.8707 | 5750 | 0.0 | - |
| 2.8957 | 5800 | 0.0 | - |
| 2.9206 | 5850 | 0.0 | - |
| 2.9456 | 5900 | 0.0001 | - |
| 2.9705 | 5950 | 0.0 | - |
| 2.9955 | 6000 | 0.0 | - |
| 3.0 | 6009 | - | 0.2738 |
* The bold row denotes the saved checkpoint.
### Framework Versions
- Python: 3.10.12
- SetFit: 1.0.3
- Sentence Transformers: 2.6.1
- Transformers: 4.39.0
- PyTorch: 2.3.1+cu121
- Datasets: 2.18.0
- Tokenizers: 0.15.2
## 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.*
-->