Last active
February 6, 2021 11:57
-
-
Save john-adeojo/fed8247e62600a8ee257d37f4fbcff62 to your computer and use it in GitHub Desktop.
distilbert-base-nli-mean-tokens.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sentence_transformers | |
| import torch | |
| from sentence_transformers import SentenceTransformer | |
| # Transform each clean text to 512 dimensional vectors (embeddings) | |
| def embed(data): | |
| model = SentenceTransformer("distilbert-base-nli-mean-tokens") | |
| embeddings = model.encode(data, show_progress_bar=True) | |
| return embeddings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment