setfit safetensors bert sentence-transformers text-classification generated_from_setfit_trainer arxiv:2209.11055 base_model:BAAI/bge-small-en-v1.5 base_model:finetune:BAAI/bge-small-en-v1.5 region:us
---
base_model: BAAI/bge-small-en-v1.5
library_name: setfit
metrics:
- accuracy
pipeline_tag: text-classification
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: the staircase is not ''independently'' notable, as fine a staircase as it
    may have been. For an historical artifact or architectural structure, these are
    extremely weak sources, and two really border on  in that the importance is asserted
    by our article and not our source. I could see an extensive and sourced article
    on ''all'' the ship's notable architecture, but the importance of the staircase
    is as the nominator states a construct of the James Cameron film ''Titanic
- text: Fails the |general notability guidelines.  While mentions of the company pop
    up in the news and we can verify its existance, there is no batch of independant
    reliable third-party sources written about the company to establish its notabilty
- text: 'WP:V failed due to lack of references making it difficult to establish notability.
    From what I gather, there is no real claim to notability and the article fails  and
    the '
- text: Meets . &mdash
- text: as the entire article fails , but '''redirect''' to Taz-Mania
inference: true
---

# SetFit with BAAI/bge-small-en-v1.5

This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) 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-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 512 tokens
- **Number of Classes:** 4 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 2     | <ul><li>"this stub article, though short, is considerably more than a just dictionary definition. I don't see how  applies"</li><li>"I'm not aware of any specific policies that cover obscure ethnic foods, but there seem to be enough results on http://books.google.com/books?&q=%22Rumbledethumps Google Books and http://news.google.com/archivesearch?q=%22Rumbledethumps&cf=all Google News to satisfy "</li><li>'"I most certainly did not remove an AfD tag, which I would never do. I removed a |PROD, which any editor is allowed to do for any good reason. ""PROD must only be used if no opposition is to be expected. The article is marked for seven days; if nobody objects, it is deleted. The first objection kills the PROD."" Opposition can certainly be expected when the article survived an AfD in 2008. I added two sources to the article yesterday. Rather than a brief mention, one of these, http://books.google.com/books?id=mKcFPL4Vn0IC&pg=PA32&dq=%22Sue+Snell%22&hl=en&sa=X&ei=hGG9UffJIoXkrAHDvYGwCA&ved=0CFQQ6AEwCA#v=onepage&q=%22Sue%20Snell%22&f=false Hollywood\'s Stephen King spends two full pages 31-33 in a detailed literary analysis of the character. Reasonable people can differ about whether the coverage I pointed out is significant enough. However, there are other sources that I have not yet had the opportunity to add to the article, and it is worth noting that this fictional character has appeared in a best-selling novel, two Hollywood films, a TV movie and a musical play that was performed in New York and London. The character is also in a film in production now. I believe that the character meets the |General notability guideline"'</li></ul> |
| 1     | <ul><li>'fails .... which guideline is most appropriate here?  '</li><li>'There is sufficient  to support  and simple , bit I totally agree with NOM, '</li><li>'fails  and , as no independent sources seem to exist about them'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 0     | <ul><li>"Having looked at the wikiproject Football's list of fully professional leagues I'am convinced also that Jogurneys claim that this article passes . Therefore I shall change my decsion to '''keep"</li><li>'References on this article and on Comic Valkyrie indicate there is enough coverage of that magazine to make it |notable. Recognizing that notability is not inherited, nonetheless when a company produces a notable product it strongly suggests that the company is notable in some way. Reserving my !vote pending checking whether any of the magazine references also discuss in some way the company as well'</li><li>"tagged for cleanup and verification.  Article reads like complete adcruft, needs to be wikified, given a more encyclopedic tone, and the claims verified/sourced.  It's also scraping  crystalball clause IMO, as a beta of something that won't definitely be popular software when it comes out, or that has been widely adopted in beta.  I could go either way on inclusion/deletion"</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 3     | <ul><li>'obviously  if no content can be derived from reliable sources because nothing has happened yet. Merge to Sporting Clube de Portugal per . –&nbsp'</li><li>'to Vancouver School Board per precedent as stated at '</li><li>"rescuable'' content to police aircraft, the list of incidents involving paragliders where police attended is  and probably unredeemable. Current article title not salvageable though"</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

## 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("research-dump/bge-small-en-v1.5_wikipedia_gr_stance_prediction_en")
# Run inference
preds = model("Meets . &mdash")
```

<!--
### 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   | 2   | 35.91  | 244 |

| Label | Training Sample Count |
|:------|:----------------------|
| 0     | 7                     |
| 1     | 64                    |
| 2     | 25                    |
| 3     | 4                     |

### Training Hyperparameters
- batch_size: (4, 1)
- num_epochs: (5, 5)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 10
- body_learning_rate: (1e-05, 1e-05)
- head_learning_rate: 5e-05
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: True
- use_amp: True
- warmup_proportion: 0.1
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False

### Training Results
| Epoch | Step | Training Loss | Validation Loss |
|:-----:|:----:|:-------------:|:---------------:|
| 0.002 | 1    | 0.2329        | -               |
| 1.0   | 500  | 0.166         | 0.2258          |
| 2.0   | 1000 | 0.02          | 0.2638          |
| 3.0   | 1500 | 0.0068        | 0.2447          |
| 4.0   | 2000 | 0.0042        | 0.2561          |
| 5.0   | 2500 | 0.0036        | 0.2562          |

### Framework Versions
- Python: 3.10.12
- SetFit: 1.1.1
- Sentence Transformers: 3.3.1
- Transformers: 4.48.2
- PyTorch: 2.2.1+cu121
- Datasets: 2.21.0
- Tokenizers: 0.21.0

## 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.*
-->