Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving and restoring the state of the world #48

Open
anatoleg opened this issue Apr 11, 2024 · 5 comments
Open

Saving and restoring the state of the world #48

anatoleg opened this issue Apr 11, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@anatoleg
Copy link

What is the best way to save and restore the state of the world to avoid initializing all agents and the game master every time?

@jzleibo
Copy link
Collaborator

jzleibo commented Apr 11, 2024

The memories are all pure text so it should be relatively easy to save them however you like to save text files. Then you can just add them back into the memory. You would lose the embeddings this way, but that might not be too big of a deal. If your embedder is deterministic you would get the same embeddings of the same memories again anyway.

@vezhnick @jagapiou anything else to think about for this?

I'm realizing that we should probably provide a convenience function to save and load agents and game masters. We'll probably go ahead and do that soon.

@anatoleg
Copy link
Author

One potential problem is that although all components have standardized method names, the attributes are different (e.g., Conversation vs. Observation). We may need a save and a load methods for each component. Should everything be saved as JSON strings?

@jagapiou jagapiou added the enhancement New feature or request label Apr 24, 2024
@jagapiou
Copy link
Member

Not the best answer for long-term storage/sharing (and we've not tested it), but have you tried pickle?

@anatoleg
Copy link
Author

pickle would probably work but I prefer JSON as it is human-readable. An agent and all its components seem to share the same AssociativeMemory instance, so I need to save it only once. Is this correct?

@jzleibo
Copy link
Collaborator

jzleibo commented Apr 27, 2024

JSON would work.

Yes, all the components of a given agent share the same AssociativeMemory.

Also, all the components of the GameMaster share an associative memory. Sub "scene" game masters might or might not use a different associative memory (e.g. for a conversation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants