Open LeoHink opened 1 month ago
Gym 0.15 is 5 years old, I suspect that no one will be able to help without the project being updated to a more recent version
Are you able to use a sync vector env?
Hey, thanks for the response. I realize the gym version I'm using is outdated and that I might just have to bite the bullet and update the project going forward. But yeah, everything else seems to work fine. I can use SyncVectorEnv
, which works as expected. Am trying to use AsyncVectorEnv
as I'm expecting this to significantly speed up training.
Async will speed things up but generally not by that much, maybe 10/20% would be my guess
Hi I'm also having same behavior when using AsyncVectorEnv. It's just hanging. Version 0.29.1
I'm creating envs this way:
cubic_envs = AsyncVectorEnv([lambda: PhysicsWrapper(
ExportingWrapper(gym.make('GraphCubicEnv-v0', env_idx=i, exporter_ctor=lambda: ZmqExporter(args['exporter_addr']), reward_fn = reward_h, done_fn = done_h, **args)),
lambda: ZmqPhysicsClient(args['phys_addr']),
reward_phs,
**args
) for i in range(0,5)]
)
UPD: I kinda figured it out. In my case it seems some of the objects, which I assume can't be easily serialized (like lambdas) can't be passed through constructor when you making async env. I just made a child class for my env and overridden all stuff like that and it start working. It's a little bit not convenient in my case, because I wanted to inject different reward functions to envs and test
In the OP case I guess the problem is in the invocation of env.setup_camera
method explicitly.
I'm having an issue initializing an AsyncVectorEnv for a custom environment which uses pybullet. I should specify that I am using
gym==0.15.3
as this is the only compatible one for the environment I'm using.I am using the following
make_env
function:And
envs = AsyncVectorEnv([make_env(env_id, i, False, seed) for i in range(num_envs)])
I've added some print statements to narrow down where the code is hanging. It seems to be in the
def _check_observation_spaces(self):
which is in line 307 inasync_vector_env.py
. Specifically after the loop:This does seem to send the message but I do not receive anything when
same_spaces, successes = zip(*[pipe.recv() for pipe in self.parent_pipes])
is called.The code works fine when testing with cartpole, so it might be something to do with my environment and pybullet. Nonetheless wanted to post this here incase anyone is able to help. Thank you!