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

Problems with workers when using custom Gym/Reacher Environment #2330

Open
Suli1223 opened this issue Aug 1, 2022 · 0 comments
Open

Problems with workers when using custom Gym/Reacher Environment #2330

Suli1223 opened this issue Aug 1, 2022 · 0 comments

Comments

@Suli1223
Copy link

Suli1223 commented Aug 1, 2022

Hi

I implemented a customized version of the gym reacher environment - actually using an aditional parameter (cameras) for rendering in multiple camera perspectives. I also wrapped the environment with GymEnv
This works in general fine, but I run into problems when using multiple workers (with LocalSampler). As far as I understand for splitting the work on multiple workers, multiple environments are generated. Unfortunately then my environments are not built correctly anymore - it seems not able to handle the custom parameter - does anyone know any help?

File "/home/name/Desktop/launch_script_reacher.py", line 86, in <module>
    run_my_reacher(mode="rgb_array",iterations=10)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/site-packages/garage/experiment/experiment.py", line 369, in __call__
    result = self.function(ctxt, **kwargs)
  File "/home/name/Desktop/my_folder/launch_reacher.py", line 53, in run_my_reacher
    worker_class=worker_with_disc)
  File "/home/name/Desktop/my_folder/helper/own_local_sampler.py", line 154, in __init__
    worker_class=worker_class,worker_args=worker_args
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/site-packages/garage/sampler/local_sampler.py", line 79, in __init__
    envs, preprocess=copy.deepcopy)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/site-packages/garage/sampler/worker_factory.py", line 95, in prepare_worker_messages
    return [preprocess(objs) for _ in range(self.n_workers)]
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/site-packages/garage/sampler/worker_factory.py", line 95, in <listcomp>
    return [preprocess(objs) for _ in range(self.n_workers)]
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/copy.py", line 169, in deepcopy
    rv = reductor(4)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/site-packages/garage/envs/gym_env.py", line 353, in __getstate__
    state = copy.deepcopy(self.__dict__)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/copy.py", line 283, in _reconstruct
    y.__setstate__(state)
  File "/home/name/anaconda3/envs/my_env/lib/python3.7/site-packages/gym/utils/ezpickle.py", line 26, in __setstate__
    out = type(self)(*d["_ezpickle_args"], **d["_ezpickle_kwargs"])
TypeError: __init__() missing 1 required positional argument: 'cameras'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant