Skip to content

Instantly share code, notes, and snippets.

@tomasonjo
Created December 27, 2022 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomasonjo/54dfc62f36a786321253cbf6cc82b7b3 to your computer and use it in GitHub Desktop.
Save tomasonjo/54dfc62f36a786321253cbf6cc82b7b3 to your computer and use it in GitHub Desktop.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
def generate_embeddings(text):
embeddings = model.encode(text)
return [float(x) for x in embeddings.tolist()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment