Wrapped sentence transformer to allow access to customized encode() and intercepting tokenizer() details.
Needed for IPEX (Intel PyTorch extension) which needs bfloat16 and autocast settings to be effective.
Allows us to get rid of the tokenizer copy that was needed for our desired truncation. Now we leverage the same call SentenceTransformer was already doing anyway.
In order to keep the requested truncation error message, however, there is a re-tokenize just to get the correct error message. This only happens on errors instead of impacting every request.
Wrapped sentence transformer to allow access to customized encode() and intercepting tokenizer() details.
In order to keep the requested truncation error message, however, there is a re-tokenize just to get the correct error message. This only happens on errors instead of impacting every request.