File size: 466 Bytes
a10fbed
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
from langchain.vectorstores import FAISS

# 中文Wikipedia数据导入示例:
embedding_model_name = '/root/pretrained_models/ernie-gram-zh'
embeddings = HuggingFaceEmbeddings(model_name=embedding_model_name)

vector_store = FAISS.load_local("/root/GoMall/Knowledge-ChatGLM/cache/zh_wikipedia", embeddings)
print(vector_store)
res = vector_store.similarity_search_with_score('闫强')
print(res)