HumanCompatibleAI/human_aware_rl

__new__() missing 1 required positional argument: 'ingredients' when creating vectorized env

leobxpan opened this issue · 3 comments

I'm running the pbt experiment under branch neurips2019 with the commands in experiments/pbt_experiments.sh. It throws the error of __new__() missing 1 required positional argument: 'ingredients' and it seems to happen at vectorized_gym_env = RewardShapingEnv(SubprocVecEnv([gym_env_fn] * kwargs["sim_threads"])). The full traceback is attached below:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
  File "/Users/boxiaopan/Documents/developer/python/baselines/baselines/common/vec_env/vec_env.py", line 204, in __setstate__
    self.x = pickle.loads(ob)
TypeError: __new__() missing 1 required positional argument: 'ingredients'
ERROR - Random - Failed after 0:02:22!
Traceback (most recent calls WITHOUT Sacred internals):
  File "gen_overcook_seq.py", line 483, in my_main
    random_one_run(curr_seed_params, seed)
  File "gen_overcook_seq.py", line 440, in random_one_run
    overcooked_env, 'Overcooked-v0', featurize_fn=lambda x: mdp.lossless_state_encoding(x), **params
  File "gen_overcook_seq.py", line 114, in get_vectorized_gym_env
    vectorized_gym_env = RewardShapingEnv(SubprocVecEnv([gym_env_fn] * kwargs["sim_threads"]))
  File "/Users/boxiaopan/Documents/developer/python/baselines/baselines/common/vec_env/subproc_vec_env.py", line 72, in __init__
    observation_space, action_space, self.spec = self.remotes[0].recv().x
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/connection.py", line 250, in recv
    buf = self._recv_bytes()
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes
    buf = self._recv(4)
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/connection.py", line 383, in _recv
    raise EOFError
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent calls WITHOUT Sacred internals):
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/subprocess.py", line 1019, in wait
    return self._wait(timeout=timeout)
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/subprocess.py", line 1645, in _wait
    raise TimeoutExpired(self.args, timeout)
subprocess.TimeoutExpired: Command '['tee', '-a', '/var/folders/xf/vpp3h46n68v69qp2t6n96hm00000gq/T/tmp8bt297g4']' timed out after 1 seconds

Exception ignored in: <function SubprocVecEnv.__del__ at 0x7fd268775950>
Traceback (most recent call last):
  File "/Users/boxiaopan/Documents/developer/python/baselines/baselines/common/vec_env/subproc_vec_env.py", line 122, in __del__
    self.close()
  File "/Users/boxiaopan/Documents/developer/python/baselines/baselines/common/vec_env/vec_env.py", line 98, in close
    self.close_extras()
  File "/Users/boxiaopan/Documents/developer/python/baselines/baselines/common/vec_env/subproc_vec_env.py", line 105, in close_extras
    remote.send(('close', None))
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/connection.py", line 404, in _send_bytes
    self._send(header + buf)
  File "/Users/boxiaopan/miniconda2/envs/py37/lib/python3.7/multiprocessing/connection.py", line 368, in _send
    n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe

The gen_overcook_seq.py file is just a port of the pbt/pbt.py file, running which gives the same error. Any insights would be appreciated.

Are you sure you are using the commit of overcooked_ai that is linked from the neurips2019 branch of human_aware_rl (this one)? One thing to note is that the new environment code (the master branch) isn't fully backwards compatible because it underwent a pretty significant overhaul.

In any case, unless you are strictly trying to replicate the paper results, I would recommend for you to work off of the master versions of both overcooked_ai and human_aware_rl, which have significant improvements w.r.t. the neurips2019 submission code. The game dynamics have changed slightly and the evaluations will be slightly different (we will release a script to get PPO_SP and PPO_BC to run on the old layouts in the new framework soon), but it should benefit you in the long term if you are planning on building off the code!

In particular we have changed from OpenAI baselines (which had no multi-agent support, which forced us to hack around that) to rllib, that is much nicer in this respect. We have increased the types of soups that can be made, and cleaned up the environment and demo code significantly.

Yeah there were some errors when running it but somewhat easy to fix (till this one). Right now I'm simply trying to test out the environment without actually training an agent (e.g., just using some random policies). I guess I'll experiment off the master branch then. Thanks!