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
Possible problem related to pettingzoo_env_to_vec_env_v1
and reset()
function
#169
Comments
For some pretty subtle reasons, when using the |
Thanks for the answer @jjshoots! I tried like this: def env(**kwargs):
env_ = parallel_env(**kwargs)
env_ = ss.pettingzoo_env_to_vec_env_v1(env_)
env_ = ss.concat_vec_envs_v1(env_, 1)
return env_
petting_zoo = env
class parallel_env(ParallelEnv):
[...] But I get this error:
|
You may need to use the EzPickle trick, see the kaz init for an example. Essentially, your base environment class needs to inherit from the EzPickle class. |
Thanks! The problem related to pickle is solved, but there is still the initial error. def env(**kwargs):
env_ = parallel_env(**kwargs)
env_ = ss.pettingzoo_env_to_vec_env_v1(env_)
env_ = ss.concat_vec_envs_v1(env_, 1)
return env_
petting_zoo = env
class parallel_env(ParallelEnv, EzPickle):
[...] I still get:
|
You can probably remove the api check, it's only valid for unwrapped classes. :) |
Removing the line with
The |
Would if be ok for you to send me the files that you're working on? I'll have a poke around and see what I can find out. I think that is more productive than iterative bug squashing over this issues channel. |
I agree @jjshoots, thanks again for your time! |
Hi @PieroMacaluso, apologies for the delay, I finally got the time today to look at this. I believe the fix to your problem is this:
That said, the correct wrapper order for your environment should be: env_parallel = dummy.parallel_env()
parallel_api_test(env_parallel) # This works!
env_parallel = ss.pettingzoo_env_to_vec_env_v1(env_parallel)
env_parallel = ss.concat_vec_envs_v1(env_parallel, 1, base_class="stable_baselines3") Let me know if you encounter any other issues. :) |
Hi @jjshoots!
In the end, I think that the argument Thanks a lot for your help and support! |
I am having trouble in making things work with a Custom
ParallelEnv
I wrote by using PettingZoo. I am using SuperSuit'sss.pettingzoo_env_to_vec_env_v1(env)
as a wrapper to Vectorize the environment and make it work with Stable-Baseline3 as documented here.You can find attached a summary of the most relevant part of the code:
Unfortunately when I try to test with the following main procedure:
I get the following error:
It seems like that
ss.pettingzoo_env_to_vec_env_v1(env)
is capable of splitting the parallel environment in multiple vectorized ones, but not for thereset()
function.Does anyone know how to fix this problem?
The text was updated successfully, but these errors were encountered: