benelot / pybullet-gym

Open-source implementations of OpenAI Gym MuJoCo environments for use with the OpenAI Gym Reinforcement Learning Research Platform.
https://pybullet.org/
Other
814 stars 124 forks source link

Support for saving/loading state #40

Open floringogianu opened 4 years ago

floringogianu commented 4 years ago

There are situations in which you would want to do a rollout from the current env state (say for estimating the return from that given state) and then continue from that point on. For mujoco envs you can do something along:

saved_state = env.sim.get_state()

# then on some other process or in a different routine
env.sim.set_state(saved_state)

I poked around the env object returned by gym.make() and there doesn't seem a way right now. Simply using deepcopy won't cut it. Any pointers towards how it could be implemented? I'd be willing to look into this.

floringogianu commented 4 years ago

I dug up a bit and found this pybullet save/load example. It seems to be working fine in a multiprocessing environment when saving and loading state from disk. Couldn't make it work to restore from memory id.