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
|
Download README.md from baunef/PopFit: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/baunef/PopFit/resolve/refs%2Fpr%2F1/README.md
- Command line
-
hf download hf://baunef/PopFit@refs/pr/1/README.md
-
curl -L -o README.md https://huggingface.co/baunef/PopFit/resolve/refs%2Fpr%2F1/README.md
1.18 kB
metadata
pipeline_tag: text-classification
PopFit
This is a SetFit model 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 and 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.
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:
python -m pip install setfit
You can then run inference as follows:
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 🤮"])