Loading pre-built local Faiss Index causes ValueError (allow_dangerous_deserialization)
daviddwlee84 opened this issue · 0 comments
daviddwlee84 commented
Operating System
Windows
Version Information
Python Version: 3.11.5
promptflow 1.6.0
promptflow-tools 1.3.0
promptflow_vectordb 0.2.5
langchain 0.1.12
langchain-community 0.0.28
langchain-core 0.1.32
langchain-experimental 0.0.43
langchain-openai 0.0.8
langchain-text-splitters 0.0.1
faiss-cpu 1.7.4
Steps to reproduce
This can be easily reproduced by following the tutorial notebook and then reload the saved Faiss index by rerun the cell
azureml-examples/sdk/python/generative-ai/promptflow/create_faiss_index.ipynb
Lines 122 to 139 in df1e23c
Expected behavior
Should successfully load pre-built Faiss index without error
Actual behavior
Got ValueError
Addition information
Should somehow pass allow_dangerous_deserialization=True
to use local pickle vector db checkpoint.
I was able to bypass this error by changing promptflow_vectordb/core/engine/langchain_engine.py
# From
self.__langchain_faiss = FAISS.load_local(path, LangchainEmbedding(self.__embedding))
# To
self.__langchain_faiss = FAISS.load_local(path, LangchainEmbedding(self.__embedding), allow_dangerous_deserialization=True)