-
Notifications
You must be signed in to change notification settings - Fork 167
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
ValueError: Output array has wrong dimensionality #119
Comments
Issue arises when the observation space contains a 0-dimensional parameter like def stack_obs(obs: Sequence, space: spaces.Space, buffer: Optional[np.ndarray] = None):
if isinstance(space, spaces.Dict):
ret = {}
for key in space:
_obs = [o[key] for o in obs]
_buffer = None if buffer is None else buffer[key]
ret[key] = stack_obs(_obs, space[key], buffer=_buffer)
return ret
elif isinstance(space, spaces.Box):
if len(np.array(obs[0]).shape) == 0: # check shape
obs = [np.array(o)[None] for o in obs] # add dimension
return np.stack(obs, out=buffer)
else:
raise NotImplementedError(type(space)) |
Yefanov
added a commit
to Yefanov/mani-skill2
that referenced
this issue
Jul 31, 2023
Yefanov
added a commit
to Yefanov/mani-skill2
that referenced
this issue
Jul 31, 2023
Yefanov
added a commit
to Yefanov/mani-skill2
that referenced
this issue
Jul 31, 2023
Merged
StoneT2000
pushed a commit
that referenced
this issue
Jul 31, 2023
* [BC] Add base_pose and tcp_pose in MS1 envs' observations * Fix softbody installation instructions in installation.md (#99) * Fix softbody installation instructions in installation.md * Fix build_lib import issue * Update the doc --------- Co-authored-by: Jiayuan-Gu <[email protected]> * Update gh-pages.yml The issue is caused by `gym` and `wheel`. Follow the solution in HumanCompatibleAI/imitation#707. * fix #119 issue --------- Co-authored-by: Jiayuan-Gu <[email protected]> Co-authored-by: Xuanlin (Simon) Li <[email protected]> Co-authored-by: Jiayuan Gu <[email protected]>
StoneT2000
added a commit
that referenced
this issue
Aug 16, 2023
* init * init * update reset funcs * render api * Update record.py * update vec env to gymnasium vec env implementation and updated sb3 wrapper for it * formatting * use single observation space per new API * tune rgbd baseline * fix some bugs with envs closing incorrectly * bug with terminated signal * Update record.py * Fix for gymnasium migration - workaround for `env.render` - remove `make_box_space_readable` - fix `VecRobotSegmentationObservationWrapper` * python local matrix test with docker * Update run.sh * Update run.sh * Modify PandaAvoidObstacles reward to clip the collision penalty * add normalized dense reward mode * fix original venv tests * fix robot_seg obs wrappers * fix docs using old reset API * more tests and init contributing doc and pytest-xdist * Update run.sh * coverage tests * wrappers tests * fix bug with recordepisode wrapper used on robot-seg obs modes * more tests * control modes tests * code formatting * ms2 venv tests * default reward is normalized, tuned sb3 state liftcube hyperparams * match vec make env closer to gym make and finish sb3 rgbd test * remove outdated gym code * update rl tutorial * update quickstart.md to factor in gymnasium change * Created using Colaboratory * update python min req to 3.8 (per gymnasium support) * update replay_Trajectory and fix bc code * Update bc_liftcube_state.py * modify evaluation/evaluator.py to account for gymnasium api * Update observation.py * modify docs/source/concepts/observation.md to account for gymnasium api * remove render_mode in mpm/base_env.py * fix evaluator renderer * Created using Colaboratory * Created using Colaboratory * remove a print statement * fix some bugs * fix order tracking bug with dictionary observations * better tuning, fix bug with record.py where obs group created twice * fixes * Update CONTRIBUTING.md * Update evaluator.py to remove print statement * Update test_venv.py * use options now * fix some bugs with options being None * Update test_wrappers.py * Update test_venv.py * fix #119 issue (#123) * [BC] Add base_pose and tcp_pose in MS1 envs' observations * Fix softbody installation instructions in installation.md (#99) * Fix softbody installation instructions in installation.md * Fix build_lib import issue * Update the doc --------- Co-authored-by: Jiayuan-Gu <[email protected]> * Update gh-pages.yml The issue is caused by `gym` and `wheel`. Follow the solution in HumanCompatibleAI/imitation#707. * fix #119 issue --------- Co-authored-by: Jiayuan-Gu <[email protected]> Co-authored-by: Xuanlin (Simon) Li <[email protected]> Co-authored-by: Jiayuan Gu <[email protected]> * Update vec_env.py * Update test_venv.py * update vec env demo to test both MS2 and Gymnasium vec envs * nicer demo code * Update README.md * hide ms2 challenge * Update quickstart.md * update venv tests to also compare gym observations and enable gym make_vec_env to work * Update test_venv.py * tests * add render_mode=human upon env creation in replay_trajectory.py * adapt replay_trajectory.py with the new env.reset(seed, options) api * fix PegInsertionSide reset function * fix environment reset: always pop out options specific to an environment * clean up errors when env fails on start and add some types * use fixed model scales and ensure obs use np array floats instead of python floats for gymnasium * Fix TurnFaucet-v0 mesh sampling to be deterministic with episode seed, so reward function is deterministic as well. * add demo and asset download tests, and example code tests * add render_cameras option, fix replay_trajectory to show viewer iff --vis is true, fix goal visual to now show up for rgb_array and human * basic replay trajectory tests and allow to replay up to a max of episodes * fix goal visuals for PandaAvoidObstacles-v0 * fix goal visuals for PickClutterYCB-v0 * explicitly specify the max_episode_steps keyword argument in make_vec_env * fix bug where max_episode_steps wasnt processed in make_vec_env * versioned demo download from HF * fix missing arg * Fix bug where main rng was not set on reset(seed=...) calls * remove old test and minor fix to sb3 vector wrapper where repeated calls to reset used same seed. * enable back env check * improve comment and fix test name to be different from file name. * black formatting. * isort * Update registration.py --------- Co-authored-by: Jiayuan-Gu <[email protected]> Co-authored-by: Xuanlin (Simon) Li <[email protected]> Co-authored-by: xuanlinli17 <[email protected]> Co-authored-by: Yefanov <[email protected]> Co-authored-by: Jiayuan Gu <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I have encountered a problem running vector environments for TurnFaucet-v0 and ms1 tasks, even with sparse reward.
The same error replicates in the RL Colab after running this cell (modified only
env_id
andreward_mode
):The text was updated successfully, but these errors were encountered: