TypeError: cannot pickle 'SSLContext' object
Diuyilu opened this issue · 8 comments
Hi!I found this problem while running the program:“TypeError: cannot pickle 'SSLContext' object”.
According to my observation, this problem occurs when saving the Agent after each round.
In simulator.py
, line1312 :
recagent.save(os.path.join(config["simulator_dir"]))
and line 111:
dill.dump(self.__dict__, f)
I found that the agents
in the state
in self.__dict__
contain information about all agents in the system. Among these information is a variable named memory
, which contains:
llm = {ChatOpenAI} client=<openai.resources.chat.completions.Completions object at 0x000002638B3C7100 >
Such informations.
This includes the type of LLM you have chosen, your api_key, and other information.
This object is exactly the 'SLContext' object.
How can I solve this problem?
Hi @Diuyilu,
We have fixed the issue with saving the simulator. Please pull the latest code to apply the fix.
Hi @Paitesanshi,
Sorry for taking so long to reply to the message.
After trying, I found that this bug still exists.
Due to poor CPU performance on the server, I switched the word embedding model ’all-mpnet-base-v2"‘ back to the previous OpenAI embedding model. In this situation, how should I save it?
Hi @Diuyilu ,
Could you share more information about the error you're encountering? Also, is it the same issue as before or are there any new differences?
Hi @Diuyilu,
We've identified the root cause of the error. Could you please pull the latest code from the main branch and install the following versions?
langchain==0.0.186
openai==0.27.8
Let us know if you encounter any further issues.
Hi @Paitesanshi,
Sorry for taking so long to reply. I am on vacation and have only recently started my work. I will keep you updated on the latest developments. Thank you!
Hi @Paitesanshi,After using the old versions of Langchain and OpenAI, the issue of saving has been resolved! Thanks for your answer! This question is really a bit strange……
Thank you for your feedback! We will proceed with closing this issue if there are no further questions.
Sure.