Open koaning opened 1 year ago
I even wrote some code for this, just as a proof of concept.
This isn't an all-encompassing benchmark or anything. But it does seem to "kind of work" and might be a nice starting point for something more general than setfit
. The main goal here, again, is to make the rapid prototyping awesome.
I think there's an opportunity for this library to make it much easier to finetune embeddings for models. So I figured I might write up an API proposal for myself. Here's some of the additions I'd like to add.
Right now, it feels like it makes sense to implement all of this in keras. With the advent of keras-core we may yet have an opportunity to keep things flexible for jax/tf/torch users.
Here's the components that I'd like to add.
Contrastive Model
This encoder assumes that you'll assume the same encoder for X1 and X2. This is quite reasonable for text comparison tasks, but won't hold for image/text multimodal situations.
Such a contrastive fine-tuner might also allow folks to pretrain on their own datasets too. We can even make helpers for that, but this model only accepts binary values for
y
.MultiClassifier
With such a constrastive model, we might be able to build a multi-label/multi-head classifier. I've always found it annoying that it's hard to create a model that is able to train on non-overlapping labels. The
MultiClassifier
can be that categoriser that I've wanted to have for a while.The goal is to offer few hyperparams and to just offer a reasonable starting point. Again
y
is binary, but you can pass the labelname via the**kwargs
infit_pairs
.ContrastiveMultiModalModel
This encoder is more complex because it does not assume that X1 and X2 have the same encoder.
This can be useful for folks in recommender-land.