SetFit is an efficient and prompt-free framework for few-shot fine-tuning of Sentence Transformers. It achieves high accuracy with little labeled data - for instance, with only 8 labeled examples per class on the Customer Reviews sentiment dataset, SetFit is competitive with fine-tuning RoBERTa Large on the full training set of 3k examples ๐คฏ!
Compared to other few-shot learning methods, SetFit has several unique features:
You can find SetFit models by filtering at the left of the models page.
All models on the Hub come with these useful features:
To get started, you can follow the SetFit installation guide. You can also use the following one-line install through pip:
pip install -U setfit
All setfit
models can easily be loaded from the Hub.
from setfit import SetFitModel
model = SetFitModel.from_pretrained("tomaarsen/setfit-paraphrase-mpnet-base-v2-sst2-8-shot")
Once loaded, you can use SetFitModel.predict
to perform inference.
model.predict("Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.")
['positive', 'negative']
If you want to load a specific SetFit model, you can click Use in SetFit
and you will be given a working snippet!