File size: 605 Bytes
de81719
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# from transformers import AutoModel, AutoTokenizer
# from langchain.embeddings import HuggingFaceEmbeddings

# local_model_path = "models"

# # Download the model and tokenizer
# model_name = "sentence-transformers/all-mpnet-base-v2"
# AutoModel.from_pretrained(model_name, cache_dir=local_model_path)
# AutoTokenizer.from_pretrained(model_name, cache_dir=local_model_path)

from sentence_transformers import SentenceTransformer

local_model_path = "model"

# Download the model
model_name = "sentence-transformers/all-mpnet-base-v2"
model = SentenceTransformer(model_name, cache_folder=local_model_path)