Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Support SetFit: few-shot fine-tuning of Sentence Transformers, works with about 8 samples per class. #1633

Open
stargazer33 opened this issue Oct 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@stargazer33
Copy link

It would be great to add SetFit to postgresml

See
https://pypi.org/project/setfit/
https://huggingface.co/docs/setfit

SetFit for text classification is different from other libraries: Usually, to train/fine-tune a model you need thousands of samples per class. In this example
https://postgresml.org/docs/open-source/pgml/guides/llms/fine-tuning
the "train" part of IMDB dataset contains 25K rows. There are 2 classes, so 12500 samples per class.

Now I'm quoting the SetFit documentation

It achieves high accuracy with little labeled data - for instance, with only 8 labeled examples per class on the Customer Reviews sentiment dataset

The code where they train a classifier - again they classifying film reviews (nothing really new here)
is here
https://huggingface.co/docs/setfit/main/quickstart#training

the sample_dataset function will sample only 8 samples for each class.

Compare this:
12500 samples per class
vs
8 samples per class with SetFit

In the real life, in many cases, you can collect... 50 samples per class and use SetFit to train a model.
Situations where you have tens of thousands of samples are quite rare.
Let's support SetFit.

@SilasMarvin SilasMarvin added the enhancement New feature or request label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants