Closed nsankar closed 2 years ago
Depends on the usecase and language.
However, you can also download my package fast-sentence-transformers
and use it in combination with classy-classification. I will release this implementation later.
from classy_classification import classyClassifier
from fast_sentence_transformers import FastSentenceTransformer as SentenceTransformer
__all__ = ["SentenceTransformer"]
class FastClassyClassifier(classyClassifier):
def __init__(self, embedding_model, *args, **kwargs):
self.embedding_model = embedding_model
super().__init__(*args, **kwargs)
def set_embedding_model(self, model: str = None, device: str = "cpu"):
self.model = model
self.device = device
pass
This should result in a x5 speedup on CPU.
@davidberenstein1957 appreciate your response.
@nsankar note that you should initialize the classifier with the fast_sentence_transformer embedding model.
Also, you can find a model overview here. https://www.sbert.net/docs/pretrained_models.html
Ok. Thanks
@nsankar I added the speed feature.
@davidberenstein1957 Thanks for developing this interesting and great library.
I was able to test the working with the sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 model.
Can you recommend any other smaller models that works faster as well as with a good accuracy?
Thanks in advance.