Is it possible to deploy Sentence BERT?
Hi, I am building a semantic search application and I have been using Sentence BERT (https://github.com/UKPLab/sentence-transformers). Can I use torch serve to deploy such a model that is developed based on the SentenceTransformer class (https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/SentenceTransformer.py) in this repo? Thanks a lot in advance.
@ar3717 You can use the custom service handler for this. Check out mnist digit classifier handler as an example.
Further in the upcoming release we are also adding examples for BERT models - check out the PR https://github.com/pytorch/serve/pull/302 (under test) for more details.
@ar3717 - You can use this example for semantic search created using the example given here https://github.com/UKPLab/sentence-transformers/blob/master/examples/applications/semantic_search.py .
Created a simple custom handler to demonstrate your use case. Go to this https://github.com/pytorch/serve/tree/issue_390/examples/semantic_search and follow the instruction on this page. As indicated by @chauhang, you can refer to those links to make this example more generic/specific per your need.
@chauhang Let me know if we can add this as an example. Its 90% complete.
Great, thank you so much. I was able to successfully deploy my fine-tuned model on AWS Sagemaker using this guide. I greatly appreciate your help.
Closing this as OP has accepted the answer.
Is there a more recent example? The SentenceTransformer model files are different now so creating the mar does not work anymore.
I modified the original example to work for the new files and dockerized it. Hope this helps! https://github.com/BryanWBear/sentence-transformers-torchserve