huangwl18 / modular-rl

[ICML 2020] PyTorch Code for "One Policy to Control Them All: Shared Modular Policies for Agent-Agnostic Control"
https://huangwl18.github.io/modular-rl/
Other
217 stars 34 forks source link

The program can't use SubprocVecEnv #10

Closed TachikakaMin closed 3 years ago

TachikakaMin commented 3 years ago

SubprocVecEnv uses multiprocessing which means utils.makeEnvWrapper will fail in

def helper(): e = gym.make("%s-v0" % env_name) e.seed(seed) return wrappers.ModularEnvWrapper(e, obs_max_len)

gym.make can't find the registered env. Because registry in gym.envs.registration will initialize again in subprocess.

huangwl18 commented 3 years ago

Some versions of gym/baselines seem to have the issue you mentioned, but the versions used in this codebase should work fine. Please make sure you're following the versions specified in requirements.py as closely as possible.

TachikakaMin commented 3 years ago

Thanks!

Another question: https://github.com/huangwl18/modular-rl/blob/ee2487f2502d101fb96eacc8a16c5b000300db9a/src/utils.py#L64

Are these two lines bug?

Maybe it should be limb_obs_size = max(limb_obs_size , env.limb_obs_size) ?

huangwl18 commented 3 years ago

We assume that all the environments have the same limb_obs_size and max_action, so either should be correct.

huangwl18 commented 3 years ago

I'm closing this because it seems the issue is resolved, but feel free to email me or post in the repo if you have more questions.