Future-House/paper-qa

Error while saving

saswat0 opened this issue · 2 comments

I'm trying to save the docs by the following snippet

llm = VertexAI(
    verbose=True,
    model_name="text-bison@001",
    max_output_tokens=1024,
    temperature=0.1,
    top_p=0.99,
    top_k=5,
)

embeddings = VertexAIEmbeddings()

docs = Docs(llm=llm, embeddings=embeddings)

for d in my_docs:
    docs.add(d)

import pickle

with open("save.pkl", "wb") as f:
    pickle.dump(docs, f)

But I keep getting this error:

Traceback (most recent call last):
  File "gen_app.py", line 55, in <module>
    pickle.dump(docs, f)
TypeError: cannot pickle '_thread.lock' object

Can you try embedding vertexAIEmbeddings alone? It's probably related to that not being serializable