openai / baselines

OpenAI Baselines: high-quality implementations of reinforcement learning algorithms
MIT License
15.8k stars 4.88k forks source link

ValueError: could not broadcast input array from shape (21,10) into shape (50,10) #1061

Open SieRaX opened 4 years ago

SieRaX commented 4 years ago

Recently, I installed baselines to do some experiments about HER. I went to the HER subpackage and ran the code exactly what the README.md said python -m baselines.run --alg=her --env=FetchReach-v1 --num_timesteps=5000 However, after running this command I am getting inconsistent errors. Error1: `

Training... Traceback (most recent call last): File "/home/matthewcool/anaconda3/envs/my_env/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/matthewcool/anaconda3/envs/my_env/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/matthewcool/Main/baselines/baselines/run.py", line 250, in main(sys.argv) File "/home/matthewcool/Main/baselines/baselines/run.py", line 216, in main model, env = train(args, extra_args) File "/home/matthewcool/Main/baselines/baselines/run.py", line 80, in train **alg_kwargs File "/home/matthewcool/Main/baselines/baselines/her/her.py", line 177, in learn policy_save_interval=policy_save_interval, demo_file=demo_file) File "/home/matthewcool/Main/baselines/baselines/her/her.py", line 43, in train policy.store_episode(episode) File "/home/matthewcool/Main/baselines/baselines/her/ddpg.py", line 223, in store_episode self.buffer.store_episode(episode_batch) File "/home/matthewcool/Main/baselines/baselines/her/replay_buffer.py", line 69, in store_episode self.buffers[key][idxs] = episode_batch[key] ValueError: could not broadcast input array from shape (2,10) into shape (50,10)

` Error2:

Traceback (most recent call last): File "/home/matthewcool/anaconda3/envs/my_env/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/matthewcool/anaconda3/envs/my_env/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/matthewcool/Main/baselines/baselines/run.py", line 250, in main(sys.argv) File "/home/matthewcool/Main/baselines/baselines/run.py", line 216, in main model, env = train(args, extra_args) File "/home/matthewcool/Main/baselines/baselines/run.py", line 80, in train **alg_kwargs File "/home/matthewcool/Main/baselines/baselines/her/her.py", line 177, in learn policy_save_interval=policy_save_interval, demo_file=demo_file) File "/home/matthewcool/Main/baselines/baselines/her/her.py", line 42, in train episode = rollout_worker.generate_rollouts() File "/home/matthewcool/Main/baselines/baselines/her/rollout.py", line 128, in generate_rollouts successful = np.array(successes)[-1, :] IndexError: too many indices for array

For error1, shape number in the last line always changes like ValueError: could not broadcast input array from shape (34,10) into shape (50,10) ValueError: could not broadcast input array from shape (2,10) into shape (50,10) What is the problem and how can I fix this?

macsmitty commented 4 years ago

Hi SieRaX, I'm having the same problem. I guess this occurs when the episode is aborted and therefore shorter than 50 time steps. Did you solve the problem in the meantime?