sentence-transformers

How to add a dense layer on top of SentenceTransformer?

How to add a dense layer on top of SentenceTransformer? Question: In this tutorial (Train and Fine-Tune Sentence Transformers Models) they go through creating a SentenceTransformer by combining a word embedding module with a pooling layer: from sentence_transformers import SentenceTransformer, models ## Step 1: use an existing language model word_embedding_model = models.Transformer(‘distilroberta-base’) ## Step 2: …

Total answers: 1

cannot import name 'GenerationMixin' from 'transformers.generation' while running executable file creating using pyinstaller

cannot import name 'GenerationMixin' from 'transformers.generation' while running executable file creating using pyinstaller Question: I am trying to create a application which checks for sentence similarity. Exe file got created. Getting the below error message while executing .exe file after giving required inputs. code model = pickle.load(open(r"miniLM.sav", "rb")) sentences_embeddings = model.encode(desc_corpus) c_matrix = cosine_similarity(sentences_embeddings, sentences_embeddings) …

Total answers: 1

Python sentence transformer community detection code getting stuck on line 16

Python sentence transformer community detection code getting stuck on line 16 Question: Hi I have been playing with this code from last 3-4 days but no luck. Here is the code from sentence_transformers import SentenceTransformer, util model = SentenceTransformer(‘all-MiniLM-L6-v2’) sentences3 = [‘USPS IV USA Tracking Status WTA Portal to content Home ures Plans About Us …

Total answers: 1

GPU out of memory when FastAPI is used with SentenceTransformers inference

GPU out of memory when FastAPI is used with SentenceTransformers inference Question: I’m currently using FastAPI with Gunicorn/Uvicorn as my server engine. Inside FastAPI GET method I’m using SentenceTransformer model with GPU: # … from sentence_transformers import SentenceTransformer encoding_model = SentenceTransformer(model_name, device=’cuda’) # … app = FastAPI() @app.get("/search/") def encode(query): return encoding_model.encode(query).tolist() # … def …

Total answers: 1

How to enable GPU for SetFit?

How to enable GPU for SetFit? Question: I am following this tutorial for SetFit: https://www.philschmid.de/getting-started-setfit When the training is running, it is using my CPU instead of my GPU. Is there a way I can enable it? Here is the main part of the code: from setfit import SetFitModel, SetFitTrainer from sentence_transformers.losses import CosineSimilarityLoss # …

Total answers: 1

ModuleNotFoundError: No module named 'setuptools.command.build'

ModuleNotFoundError: No module named 'setuptools.command.build' Question: I am trying to pip install sentence transformers. I am working on a Macbook pro with an M1 chip. I am using the following command: pip3 install -U sentence-transformers When I run this, I get this error/output and I do not know how to fix it… Defaulting to user …

Total answers: 2