Nagh-DE / GoogleGemini-PDF

chat with multiple pdf docs using Google's Gemini generative AI
19 stars 7 forks source link

ValueError: The de-serialization relies loading a pickle file. Unable to set `allow_dangerous_deserialization` to `True`. #1

Open shubham16g opened 6 months ago

shubham16g commented 6 months ago

I am getting this error when asking the question. I am using python 3.9.6. python3 -m streamlit run app.py

ValueError: The de-serialization relies loading a pickle file. Pickle files can be modified to deliver a malicious payload that results in execution of arbitrary code on your machine.You will need to set `allow_dangerous_deserialization` to `True` to enable deserialization. If you do this, make sure that you trust the source of the data. For example, if you are loading a file that you created, and no that no one else has modified the file, then this is safe to do. Do not set this to `True` if you are loading a file from an untrusted source (e.g., some random site on the internet.).
Traceback:
File "/Users/amin/Library/Python/3.9/lib/python/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script
    exec(code, module.__dict__)
File "/Users/amin/Documents/python/GoogleGemini-PDF-main/app.py", line 102, in <module>
    main()
File "/Users/amin/Documents/python/GoogleGemini-PDF-main/app.py", line 88, in main
    user_input(user_question)
File "/Users/amin/Documents/python/GoogleGemini-PDF-main/app.py", line 66, in user_input
    new_db = FAISS.load_local("faiss_index", embeddings)
File "/Users/amin/Library/Python/3.9/lib/python/site-packages/langchain_community/vectorstores/faiss.py", line 1115, in load_local
    raise ValueError(
Tomhawkstorm55557 commented 5 months ago

vector_store.save_local("faiss_index", allow_dangerous_deserialization=True) solve this use that

Nagh-DE commented 5 months ago

set the allow_dangerous_deserialization flag to True, will resolve the issue. let me know if it you're still facing the issue

choukne commented 5 months ago

Getting this issue after adding save_local("faiss_index", allow_dangerous_deserialization=True)

TypeError: save_local() got an unexpected keyword argument 'allow_dangerous_deserialization'

File "C:\Users\Administrator\anaconda3\envs\pythonProject3\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 542, in _run_script exec(code, module.dict) File "C:\Users\Administrator\PycharmProjects\pythonProject3\app.py", line 132, in main() File "C:\Users\Administrator\PycharmProjects\pythonProject3\app.py", line 108, in main get_vector_store(docs) File "C:\Users\Administrator\PycharmProjects\pythonProject3\app.py", line 47, in get_vector_store vectorstore_faiss.save_local("faiss_index", allow_dangerous_deserialization=True)

vector_store.save_local("faiss_index", allow_dangerous_deserialization=True) solve this use that

AbinayaSekar19 commented 4 months ago

vector_store.save_local("faiss_index", allow_dangerous_deserialization=True) solve this use that

in that code where can i insert this line