Prepare SetFit for upcoming 2.3.0 release of SentenceTransformers
Store sentence transformer loading kwargs in the SetFitModel, required for loading the best checkpoint.
Add trust_remote_code to from_pretrained, required for custom models, such as jinaai/jina-embeddings-v2-base-en.
Details
Note: Sentence Transformers 2.3.0 will be backwards compatible, and not having these changes in your SetFit install just means that you get a warning that you won't get with these changes.
In short, Sentence Transformers 2.3.0 will fix the currently broken model_body.device, allowing us to actually use that one again instead of the hacky model_body._target_device.
We also add trust_remote_code, mirroring the upcoming support for Sentence Transformers. This PR also stores the loading kwargs from Sentence Transformers into the model, so that we can correctly load the best checkpoint (even if that requires trust_remote_code=True for example)
cc @bwanglzu If you're interested, this PR should allow Jina embeddings to be used for efficient text classification models :)
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Hello!
Pull Request overview
SetFitModel
, required for loading the best checkpoint.trust_remote_code
tofrom_pretrained
, required for custom models, such asjinaai/jina-embeddings-v2-base-en
.Details
Note: Sentence Transformers 2.3.0 will be backwards compatible, and not having these changes in your SetFit install just means that you get a warning that you won't get with these changes.
In short, Sentence Transformers 2.3.0 will fix the currently broken
model_body.device
, allowing us to actually use that one again instead of the hackymodel_body._target_device
.We also add
trust_remote_code
, mirroring the upcoming support for Sentence Transformers. This PR also stores the loading kwargs from Sentence Transformers into the model, so that we can correctly load the best checkpoint (even if that requirestrust_remote_code=True
for example)cc @bwanglzu If you're interested, this PR should allow Jina embeddings to be used for efficient text classification models :)