Integrate SetFit library by tomaarsen · Pull Request #1150 · huggingface/hub-docs (original) (raw)

Hello!

Pull Request overview

Details

SetFit is a library for text classification with ~1200 models on the Hub at the time of writing. A v1.0.0 release is upcoming, and it's a good time to add this widget support, etc. It can be used like so:

from setfit import SetFitModel

model = SetFitModel.from_pretrained("tomaarsen/span-marker-bert-base-fewnerd-fine-super")

model.predict(["That was an awful movie"])
# => ["negative"]

I've followed the documentation here, but it seems to be a bit outdated compared to the last time that I added an integration. It still mentions to edit model-libraries.ts with a snippet like

const asteroid = (model: ModelData) => `from asteroid.models import BaseModel

model = BaseModel.from_pretrained("${model.id}")`;

But that type of data isn't in that file anymore. (cc: @coyotte508 ?)
Presumably I also have to update that in huggingface.js?

Note: Some of the links, e.g. https://huggingface.co/docs/setfit/reference/main#setfit.SetFitModel.predict, do not currently work, but will start working when SetFit v1.0.0 releases next week.

Related PRs: