RUC-GSAI / YuLan-Rec

MIT License
287 stars 19 forks source link

TypeError: cannot pickle 'SSLContext' object #19

Open Diuyilu opened 2 months ago

Diuyilu commented 2 months ago

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?

Paitesanshi commented 2 months ago

Hi @Diuyilu,

We have fixed the issue with saving the simulator. Please pull the latest code to apply the fix.

Diuyilu commented 2 months ago

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?

Paitesanshi commented 2 months ago

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?

Paitesanshi commented 2 months ago

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.

Diuyilu commented 1 month ago

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!

Diuyilu commented 1 month ago

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……

Paitesanshi commented 1 month ago

Thank you for your feedback! We will proceed with closing this issue if there are no further questions.

Diuyilu commented 1 month ago

Sure.