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/main/README.md
- Command line
-
hf download hf://baunef/PopFit/README.md
-
curl -L -o README.md https://huggingface.co/baunef/PopFit/resolve/main/README.md
1.18 kB
| 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 🤮"]) | |
| ``` |