haosulab / ManiSkill2-Learn

Apache License 2.0
77 stars 15 forks source link

KeyError: 'env_id' while run pick_place_multi_object_envs.sh #4

Closed zzzbbs closed 1 year ago

zzzbbs commented 1 year ago

When I sh ./scripts/example_demo_conversion/pick_place_multi_object_envs.sh, the problem happened as the following error announcement in the command window.But when I change the ENV from "PickSignleYCB-v0" to "PickSingleEGAD-v0", it works.

The error announcement: multiprocessing.pool.RemoteTraceback: """
Traceback (most recent call last): File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/multiprocessing/pool.py", line 51, in starmapstar return list(itertools.starmap(args[0], args[1])) File "/home/zbs/Code/ImitationLearning/ManiSkill2/tools/replay_trajectory.py", line 318, in _main
env_id = env_info["env_id"] KeyError: 'env_id'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "tools/replay_trajectory.py", line 492, in main()
File "tools/replay_trajectory.py", line 473, in main res = pool.starmap(_main, proc_args) File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/multiprocessing/pool.py", line 372, in starmap return self._map_async(func, iterable, starmapstar, chunksize).get() File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/multiprocessing/pool.py", line 771, in get raise self._value KeyError: 'env_id' Obs mode: pointcloud; Control mode: pd_ee_delta_pose Obs frame: ee; n_points: 1200; n_goal_points: 50 Traceback (most recent call last): File "tools/convert_state.py", line 230, in main() File "tools/convert_state.py", line 187, in main with h5py.File(args.traj_name, "r") as h5_file: File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 533, in init fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr) File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 226, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 106, in h5py.h5f.open FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = '/home/zbs/Code/ImitationLearning/ManiSkill2/demos/rigid_body_envs/PickSingleYCB-v0/trajectory_merged.none.pd_ee_delta_pose.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0) Obs mode: rgbd; Control mode: pd_ee_delta_pose Traceback (most recent call last): File "tools/convert_state.py", line 230, in main() File "tools/convert_state.py", line 187, in main with h5py.File(args.traj_name, "r") as h5_file: File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 533, in init fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr) File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 226, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 106, in h5py.h5f.open FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = '/home/zbs/Code/ImitationLearning/ManiSkill2/demos/rigid_body_envs/PickSingleYCB-v0/trajectory_merged.none.pd_ee_delta_pose.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0) Traceback (most recent call last): File "tools/shuffle_demo.py", line 31, in source_file = h5py.File(args.source_file, "r") File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 533, in init fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr) File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 226, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 106, in h5py.h5f.open FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = '../ManiSkill2/demos/rigid_body_envs/PickSingleYCB-v0/trajectory_merged.none.pd_ee_delta_pose_pointcloud.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0) Traceback (most recent call last): File "tools/shuffle_demo.py", line 31, in source_file = h5py.File(args.source_file, "r") File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 533, in init fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr) File "/home/zbs/anaconda3/envs/mani_skill2/lib/python3.8/site-packages/h5py/_hl/files.py", line 226, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 106, in h5py.h5f.open FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = '../ManiSkill2/demos/rigid_body_envs/PickSingleYCB-v0/trajectory_merged.none.pd_ee_delta_pose_rgbd.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

xuanlinli17 commented 1 year ago

KeyError: 'env_id' is your actual error. However, I couldn't reproduce it on my end.

When was your demonstrations downloaded? Also is ManiSkill2-Learn the latest?

When you open ManiSkill2/demos/rigid_body_envs/PickSingleYCB-v0/trajectory_merged.json, does it look like the following? Since before the error occurs, ManiSkill2-Learn/tools/merge_trajectory.py is run successfully.

{
  "env_info": {
    "env_id": "PickSingleYCB-v0",
    "max_episode_steps": 200,
    "env_kwargs": {
      "obs_mode": "none",
      "control_mode": "pd_joint_pos"
    }
  },
  "episodes": [
    {
      "episode_id": 0,
      "episode_seed": 0,
      "reset_kwargs": {
        "seed": 0,
        "model_id": "002_master_chef_can"
      },
      "control_mode": "pd_joint_pos",
      "elapsed_steps": 137,
      "info": {
zzzbbs commented 1 year ago

Sorry for the late response. I downloaded the demonstrations on Nov 19, and what I download is the same as download link. 2022-11-27_11-19 Since I meet this problem, I have updated to the newest version of both ManiSkill2 and ManiSkill2-Learn. My trajectory_merged.json file is not look like what you show upper. { "env_info": {}, "episodes": [] }

xuanlinli17 commented 1 year ago

I see the problem. The demo was given as 220815.zip and requires unzipping, which wasn't handled in my scripts. I've updated the script, and please pull from the latest ManiSkill2-Learn.

zzzbbs commented 1 year ago

Thank you very much for your help! I pull from the newest version. I run the sh command still have the problem, but I run python tools/merge_trajectory.py \ -i ../ManiSkill2/demos/rigid_body_envs/$ENV/ \ -o ../ManiSkill2/demos/rigid_body_envs/$ENV/trajectory_merged.h5 \ -p 0*.h5 # this can be replaced with other patterns in my command window. It works ,may be it is my fault while installing. Finally, thank you very much~

xuanlinli17 commented 1 year ago

Oh, you need bash, not sh

zzzbbs commented 1 year ago

Oh, you need bash, not sh

I try to bash *.sh ,it works. Thank you~