temporarily save faiss_cache
This commit is contained in:
parent
67b7c99d03
commit
1fac51fe35
|
|
@ -18,7 +18,7 @@ starlette~=0.27.0
|
||||||
unstructured[all-docs]==0.11.0
|
unstructured[all-docs]==0.11.0
|
||||||
python-magic-bin; sys_platform == 'win32'
|
python-magic-bin; sys_platform == 'win32'
|
||||||
SQLAlchemy==2.0.19
|
SQLAlchemy==2.0.19
|
||||||
faiss-cpu
|
faiss-cpu # `conda install faiss-gpu -c conda-forge` if you want to accelerate with gpus
|
||||||
accelerate>=0.24.1
|
accelerate>=0.24.1
|
||||||
spacy>=3.7.2
|
spacy>=3.7.2
|
||||||
PyMuPDF
|
PyMuPDF
|
||||||
|
|
@ -64,7 +64,7 @@ metaphor-python>=0.1.23
|
||||||
|
|
||||||
# WebUI requirements
|
# WebUI requirements
|
||||||
|
|
||||||
streamlit>=1.29.0
|
streamlit>=1.29.0 # do remember to add streamlit to environment variables if you use windows
|
||||||
streamlit-option-menu>=0.3.6
|
streamlit-option-menu>=0.3.6
|
||||||
streamlit-antd-components>=0.2.3
|
streamlit-antd-components>=0.2.3
|
||||||
streamlit-chatbox>=1.1.11
|
streamlit-chatbox>=1.1.11
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class _FaissPool(CachePool):
|
||||||
# create an empty vector store
|
# create an empty vector store
|
||||||
embeddings = EmbeddingsFunAdapter(embed_model)
|
embeddings = EmbeddingsFunAdapter(embed_model)
|
||||||
doc = Document(page_content="init", metadata={})
|
doc = Document(page_content="init", metadata={})
|
||||||
vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True)
|
vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True,distance_strategy="METRIC_INNER_PRODUCT")
|
||||||
ids = list(vector_store.docstore._dict.keys())
|
ids = list(vector_store.docstore._dict.keys())
|
||||||
vector_store.delete(ids)
|
vector_store.delete(ids)
|
||||||
return vector_store
|
return vector_store
|
||||||
|
|
@ -82,7 +82,7 @@ class KBFaissPool(_FaissPool):
|
||||||
|
|
||||||
if os.path.isfile(os.path.join(vs_path, "index.faiss")):
|
if os.path.isfile(os.path.join(vs_path, "index.faiss")):
|
||||||
embeddings = self.load_kb_embeddings(kb_name=kb_name, embed_device=embed_device, default_embed_model=embed_model)
|
embeddings = self.load_kb_embeddings(kb_name=kb_name, embed_device=embed_device, default_embed_model=embed_model)
|
||||||
vector_store = FAISS.load_local(vs_path, embeddings, normalize_L2=True)
|
vector_store = FAISS.load_local(vs_path, embeddings, normalize_L2=True,distance_strategy="METRIC_INNER_PRODUCT")
|
||||||
elif create:
|
elif create:
|
||||||
# create an empty vector store
|
# create an empty vector store
|
||||||
if not os.path.exists(vs_path):
|
if not os.path.exists(vs_path):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue