Prepare SetFit for upcoming 2.3.0 release of SentenceTransformers #463
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 :)