Instructions to use baunef/PopFit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use baunef/PopFit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="baunef/PopFit")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("baunef/PopFit") model = AutoModel.from_pretrained("baunef/PopFit", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,180 Bytes
0a4fb7a af9602c 0a4fb7a af9602c bb4d6c1 af9602c 08dc1f6 bb4d6c1 08dc1f6 af9602c 08dc1f6 af9602c 24e74f1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ---
pipeline_tag: text-classification
---
# PopFit
This is a [SetFit model](https://github.com/huggingface/setfit) for German-language populism detection in news and media content. It was created as part of master thesis at the Hochschule für Politik @TUM.
The model is based on [deutsche-telekom/gbert-large-paraphrase-cosine](https://huggingface.co/deutsche-telekom/gbert-large-paraphrase-cosine) and 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.
The model generates binary classification labels with 0 as the `non-populist` and 1 as the `populist` class.
## Usage
To use this model for inference, first install the SetFit library:
```bash
python -m pip install setfit
```
You can then run inference as follows:
```python
from setfit import SetFitModel
# Download from Hub and run inference
model = SetFitModel.from_pretrained("baunef/PopFit")
# Run inference
preds = model(["i loved the spiderman movie!", "pineapple on pizza is the worst 🤮"])
``` |