Error in loading history file - TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'
Has anyone been able to load a history file?
Tried following the instructions to load history file.
""
Step 2. Loading a History File
Then, when prompted with "Enter option: ", you should load the agent history by responding with the following command:
call -- load history the_ville/<history_file_name>.csv
Note that you will need to replace <history_file_name> with the name of an existing history file. There are two history files included in the repo as examples: agent_history_init_n25.csv for base_the_ville_n25 and agent_history_init_n3.csv for base_the_ville_isabella_maria_klaus. These files include semicolon-separated lists of memory records for each of the agents—loading them will insert the memory records into the agents' memory stream.
" "
Issue
After I provided call -- load history the_ville/agent_history_init_n3_sxsw.csv to "Enter option" prompt in terminal,
I got this:
Enter option: call -- load history the_ville/agent_history_init_n3_sxsw.csv
=== persona/prompt_template/v2/whisper_inner_thought_v1.txt
~~~ persona ---------------------------------------------------
Maria Lopez
~~~ gpt_param ----------------------------------------------------
{'engine': 'text-davinci-003', 'max_tokens': 50, 'temperature': 0, 'top_p': 1, 'stream': False, 'frequency_penalty': 0, 'presence_penalty': 0, 'stop': None}
~~~ prompt_input ----------------------------------------------
['Maria Lopez', 'This is very important -- you have a secret crush on Klaus Mueller']
~~~ prompt ----------------------------------------------------
Translate the following thought into a statement about Maria Lopez.
Thought: "This is very important -- you have a secret crush on Klaus Mueller"
Statement: "
~~~ output ----------------------------------------------------
Maria Lopez has a secret crush on Klaus Mueller.
=== END ==========================================================
**Traceback (most recent call last):
File "/Users/Joey/github/cheonjae/reverie/backend_server/reverie.py", line 597, in open_server
load_history_via_whisper(self.personas, clean_whispers)
File "/Users/Joey/github/cheonjae/reverie/backend_server/persona/cognitive_modules/converse.py", line 250, in load_history_via_whisper
expiration = persona.scratch.curr_time + datetime.timedelta(days=30)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'
Error.**
Debug attempt
I tried debugging it. In my custom history file at "environment/frontend_server/storage/demo_sxsw_the_ville_isabella_maria_klaus/personas/Maria Lopez/bootstrap_memory/scratch.json"
{
"vision_r": 8,
"att_bandwidth": 8,
"retention": 8,
**"curr_time": null,**
"curr_tile": null,
"daily_plan_req": "Maria Lopez spends at least 3 hours a day Twitch streaming or gaming.",
"name": "Maria Lopez",
I notice that curr_time is null, and it could be erroring on trying to combine a null value and a datatime datatype.
So I tried replacing curr_time with
curr_time": "February 13, 2023, 00:00:00", referencing how it is done in "environment/frontend_server/storage/base_the_ville_isabella_maria_klaus/reverie/meta.json"
Still the same error.
Perhaps the issue lies elsewhere to fix.
Any thoughts or solutions?
I have experienced the very same error when starting the simulation and doing call -- load history directly.
I think the issue resides in the fact that "personas" object has absolute time not initialized.
A possible workaround that worked for me is to run the simulation for 1 single step run 1 and then call -- load history .
I assume you mean run simulation for 1 single step, and then try call -- load history. I'll try, cheers!
Okay I solved it by adding following lines in reverie.py file:
for persona_name, persona in self.personas.items():
persona.scratch.curr_time = self.curr_time
right before the line load_history_via_whisper(self.personas, clean_whispers)
on line 591 of the generative_agents/reverie/backend_server/reverie.py
So it looks like:
for persona_name, persona in self.personas.items():
persona.scratch.curr_time = self.curr_time
load_history_via_whisper(self.personas, clean_whispers)