| from langchain.embeddings import HuggingFaceEmbeddings | |
| import torch | |
| def download_embeding(): | |
| embedding = HuggingFaceEmbeddings( | |
| model_name="sentence-transformers/all-MiniLM-L6-v2", | |
| model_kwargs={"device": "cuda" if torch.cuda.is_available() else "cpu"} | |
| ) | |
| return embedding |