SetFit is a framework for training text classification models using relatively small amounts of labelled data. It is designed for situations where collecting and annotating large training datasets would be expensive or impractical.
The framework builds on Sentence Transformers and uses a two-stage training approach. It first adapts a sentence embedding model to the task, then trains a classification component to predict labels from the resulting representations.
SetFit is suitable for sentiment analysis, document categorization, intent detection, and other supervised text classification tasks. Its emphasis on data efficiency makes it useful for developing specialized classifiers without the computational requirements associated with fine-tuning much larger language models.
This is free and open source software.
Key Features
- Few-shot text classification using small labelled training datasets.
- Contrastive fine-tuning improves sentence embeddings for specific classification tasks.
- Prompt-free learning avoids the need to construct textual prompts or verbalizers.
- Combines pre-trained sentence embedding models with lightweight classification heads.
- Supports scikit-learn classifiers and differentiable classification heads.
- Binary and multiclass classification for categorizing text into predefined labels.
- Multilabel classification supports assigning multiple categories to individual texts.
- Configurable training parameters control batch sizes, learning rates, and training epochs.
- Dataset sampling facilities help prepare small training sets with examples from each class.
- Training and evaluation interfaces provide a consistent workflow for building classifiers.
- Supports multilingual classification through compatible multilingual sentence embedding models.
- Model evaluation facilities measure classification accuracy and other performance metrics.
- Save and reload trained models for subsequent inference.
- Hugging Face Hub integration provides access to pre-trained models and allows sharing fine-tuned classifiers.
- Includes examples for adapting classification models to specialized datasets.
Website: github.com/huggingface/setfit
Support:
Developer: Hugging Face and contributors
License: Apache License 2.0
SetFit is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| Python Natural Language Processing Tools | |
|---|---|
| PyTorch-Transformers | Library of state-of-the-art pre-trained models for NLP |
| NLTK | Natural Language Toolkit |
| spaCy | Industrial strength natural language processing |
| scikit-learn | Machine learning library |
| Haystack | AI orchestration framework |
| Gensim | Vector space modeling and topic modeling toolkit |
| flair | Simple framework for state-of-the-art NLP |
| TextBlob | Python (2 and 3) library for processing textual data |
| doccano | Data labelling and text annotation platform |
| BERTopic | Topic modeling |
| textacy | Python library for performing NLP tasks |
| Presidio | Data protection and de-identification SDK |
| polyglot | Multilingual text (NLP) processing toolkit |
| AllenNLP | Apache 2.0 NLP research library |
| Snips NLU | Natural Language Understanding Python library |
| PyNLPI | Various modules useful for common, and less common, NLP tasks |
| nlpnet | Natural Language Processing with neural networks |
| Pattern | Web mining module |
| GluonNLP | Deep Learning for NLP |
| PyTorch-NLP | Neural network layers, text processing modules and datasets |
| NLP Architect | Deep Learning NLP/NLU library |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.