paper-qa icon indicating copy to clipboard operation
paper-qa copied to clipboard

Error while saving

Open saswat0 opened this issue 2 years ago • 1 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

saswat0 avatar Sep 07 '23 14:09 saswat0

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

whitead avatar Sep 12 '23 19:09 whitead

Hello @saswat0, we have just released version 5, which completely outsources all LLM management to https://github.com/BerriAI/litellm.

So pickling of LLMs is now outsourced to LiteLLM. If your issue persists, please reopen a new issue using paper-qa>=5

jamesbraza avatar Sep 11 '24 18:09 jamesbraza

Hello @saswat0, we have just released version 5, which completely outsources all LLM management to https://github.com/BerriAI/litellm.

So pickling of LLMs is now outsourced to LiteLLM. If your issue persists, please reopen a new issue using paper-qa>=5

jamesbraza avatar Sep 11 '24 18:09 jamesbraza