zcczhang / UVD

Universal Visual Decomposer: Long-Horizon Manipulation Made Easy
https://zcczhang.github.io/UVD/
MIT License
44 stars 6 forks source link

Problems when generating data #4

Closed happyflying-web closed 4 months ago

happyflying-web commented 9 months ago

When I use the following command to generate data, python datasets/data_gen.py raw_data_path="/home/dellpc/Downloads/robot/code/relay-policy-learning-master/kitchen_demos_multitask/friday_kettle_bottomknob_hinge_slide/" the following error occurs `Error executing job with overrides: ['raw_data_path=/home/dellpc/Downloads/robot/code/relay-policy-learning-master/kitchen_demos_multitask/friday_kettle_bottomknob_hinge_slide/'] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "/home/dellpc/Downloads/robot/code/UVD/datasets/data_gen.py", line 243, in generate_one_task_demo _generate_one_task_demo(**kwargs) File "/home/dellpc/Downloads/robot/code/UVD/datasets/data_gen.py", line 59, in _generate_one_task_demo parsed_task_name = parse_task_name(raw_task_dir) File "/home/dellpc/Downloads/robot/code/UVD/datasets/data_gen.py", line 20, in parse_task_name sub_tasks = task_name.split("-")[1].split(",") IndexError: list index out of range """

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

Traceback (most recent call last): File "/home/dellpc/Downloads/robot/code/UVD/datasets/data_gen.py", line 267, in main pool.map( File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 771, in get raise self._value IndexError: list index out of range

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.`

I find the name of file "friday_kettle_bottomknob_hingeslide" is jointed by "",but the code sub_tasks = task_name.split("-")[1].split(",") in data_gen.py is "-"

happyflying-web commented 9 months ago

By the way,I use this dataset https://github.com/google-research/relay-policy-learning/blob/master/kitchen_demos_multitask.zip

happyflying-web commented 9 months ago

The names of raw dataset's directory are as following. I wonder if they should be pre-processed manually. Thank you very much! image

zcczhang commented 9 months ago

I'll look into this issue later but yeah probably due to the inconsistency of the filenames I used a long time ago before the release. But maybe you can just use the data I uploaded to huggingface dataset space here. :)

happyflying-web commented 9 months ago

I am very excited that the new dataset you provided works and the problem of filename has already solved ! But Unfortunately another error happens

Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Initializing Franka sim Initializing Franka sim Initializing Franka sim Reading configurations for Franka Initializing Franka sim Initializing Franka sim Initializing Franka sim Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Initializing Franka sim Initializing Franka sim Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Reading configurations for Franka Initializing Franka sim Initializing Franka sim Initializing Franka sim Initializing Franka sim Initializing Franka sim Initializing Franka sim Initializing Franka sim Initializing Franka sim Initializing Franka sim Initializing Franka sim /home/dellpc/anaconda3/envs/uvd/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32 logger.warn( kettle: 0%| | 0/14 [00:00<?, ?it/s]Found 3 GPUs for rendering. Using device 0. kettle: 0%| | 0/14 [00:00<?, ?it/s] Reading configurations for Franka Initializing Franka sim Reading configurations for Franka Initializing Franka sim /home/dellpc/anaconda3/envs/uvd/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32 logger.warn( kettle: 0%| | 0/24 [00:00<?, ?it/s]Found 3 GPUs for rendering. Using device 0. kettle: 0%| | 0/24 [00:00<?, ?it/s] Reading configurations for Franka Initializing Franka sim Reading configurations for Franka Initializing Franka sim /home/dellpc/anaconda3/envs/uvd/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32 logger.warn( kettle: 0%| | 0/20 [00:00<?, ?it/s]Reading configurations for Franka Initializing Franka sim Reading configurations for Franka Initializing Franka sim /home/dellpc/anaconda3/envs/uvd/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32 logger.warn( Found 3 GPUs for rendering. Using device 0. kettle: 0%| | 0/22 [00:00<?, ?it/s]/home/dellpc/anaconda3/envs/uvd/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32 logger.warn( kettle: 0%| | 0/19 [00:00<?, ?it/s]Found 3 GPUs for rendering. Using device 0. kettle: 0%| | 0/20 [00:00<?, ?it/s] Found 3 GPUs for rendering. Using device 0. kettle: 0%| | 0/22 [00:00<?, ?it/s] kettle: 0%| | 0/19 [00:00<?, ?it/s] kettle: 0%| | 0/17 [00:00<?, ?it/s]Found 3 GPUs for rendering. Using device 0. kettle: 0%| | 0/17 [00:00<?, ?it/s] kettle: 0%| | 0/17 [00:00<?, ?it/s]Found 3 GPUs for rendering. Using device 0. kettle: 0%| | 0/17 [00:00<?, ?it/s] Error executing job with overrides: [] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, kwds)) File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar return list(map(*args)) File "/home/dellpc/Downloads/robot/code/UVD/datasets/data_gen.py", line 243, in generate_one_task_demo _generate_one_task_demo(*kwargs) File "/home/dellpc/Downloads/robot/code/UVD/datasets/data_gen.py", line 70, in _generate_one_task_demo env = KitchenBase( File "/home/dellpc/Downloads/robot/code/UVD/uvd/envs/franka_kitchen/franka_kitchen_base.py", line 53, in init super(KitchenBase, self).init( File "/home/dellpc/Downloads/robot/code/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/utils/configurable.py", line 133, in init base_init(self, args, kwargs) File "/home/dellpc/Downloads/robot/code/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/franka/kitchen_multitask_v0.py", line 47, in init super().init( File "/home/dellpc/Downloads/robot/code/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/robot_env.py", line 79, in init super(RobotEnv, self).init( File "/home/dellpc/Downloads/robot/code/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/mujoco_env.py", line 83, in init observation, _reward, done, _info = self.step(np.zeros(self.model.nu)) File "/home/dellpc/Downloads/robot/code/UVD/uvd/envs/franka_kitchen/franka_kitchen_base.py", line 314, in step self.goal = self._get_task_goal() # update goal if init File "/home/dellpc/Downloads/robot/code/UVD/uvd/envs/franka_kitchen/franka_kitchen_base.py", line 123, in _get_task_goal element_idx = OBS_ELEMENT_INDICES[element] KeyError: 'bottom_burner' """

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

Traceback (most recent call last): File "/home/dellpc/Downloads/robot/code/UVD/datasets/data_gen.py", line 267, in main pool.map( File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/dellpc/anaconda3/envs/uvd/lib/python3.9/multiprocessing/pool.py", line 771, in get raise self._value KeyError: 'bottom_burner'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

happyflying-web commented 9 months ago

Hi~ Zichen After my debugging, I found that the keys of the dictionary here should be "_" to connect, not spaces. https://github.com/zcczhang/UVD/blob/51f9e7e0f8d65fffb6f9cb17faecf104e050ca49/uvd/envs/franka_kitchen/franka_kitchen_constants.py#L6C20-L6C20

zcczhang commented 9 months ago

Hi @ happyflying-web, after a quick check, it seems to be working on my side. Could you please double-check if the data directories are correct, e.g parsed_task_name = parse_task_name(raw_task_dir) here such that the task_name here is supposed to include the space. An example of the folder in the directory is friday_t-microwave,kettle,bottomknob,slide. Let me know if this is not what it showed on your side! For the place you point out here, I intentionally make it with spaces, since all variables like FRANKA_KITCHEN_ALL_TASKS, OBS_ELEMENT_INDICES, OBS_ELEMENT_GOALS etc here all have spaces. (based on your tracebacks where the keyerror happened at element_idx = OBS_ELEMENT_INDICES[element], where those elements are originally from parsed_task_name = parse_task_name(raw_task_dir) I mentioned earlier)

happyflying-web commented 9 months ago

The catalog of datasets downloaded at the huggingface link you provided is shown below

image

The contents of each directory are shown below

image

I added element=element.replace(" "," ") at the following two places to make the program run

image image

But the generated results only can be seen in the 'kettle' directory ,the three other directories bottom_burner,light_switch,top_burner can only see reject_sampling directory without any other files.

image

happyflying-web commented 8 months ago

Oh,excuse me, it's my fault.

happyflying-web commented 7 months ago

It looked very strange, and when I re-cloned the repository to run, the original problem came up again, it didn't look very stable.

(UVD) xxx@Precision-7920-Tower:~/Videos/bin/boot/newUVD/UVD/datasets$ python data_gen.py 
WARNING: directory (datasets/franka_kitchen_demos) already exists! 
overwrite? ([Y]/n)
Y
Deleted "datasets/franka_kitchen_demos"
Reading configurations for Franka
Reading configurations for Franka
Reading configurations for Franka
Reading configurations for Franka
Initializing Franka sim
Reading configurations for Franka
Reading configurations for Franka
Reading configurations for Franka
Initializing Franka sim
Initializing Franka sim
Reading configurations for Franka
Reading configurations for Franka
Reading configurations for Franka
Initializing Franka sim
Reading configurations for Franka
Reading configurations for Franka
Reading configurations for Franka
Initializing Franka sim
Reading configurations for Franka
Reading configurations for Franka
Reading configurations for Franka
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Reading configurations for Franka
Reading configurations for Franka
Reading configurations for Franka
Initializing Franka sim
Reading configurations for Franka
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Reading configurations for Franka
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Initializing Franka sim
Reading configurations for Franka
Initializing Franka sim
Reading configurations for Franka
Initializing Franka sim
Initializing Franka sim
Reading configurations for Franka
Initializing Franka sim
/home/xxx/anaconda3/envs/UVD/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
/home/xxx/anaconda3/envs/UVD/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
/home/xxx/anaconda3/envs/UVD/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
kettle:   0%|                                                                                                                                                | 0/17 [00:00<?, ?it/s]/home/xxx/anaconda3/envs/UVD/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
/home/xxx/anaconda3/envs/UVD/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
/home/xxx/anaconda3/envs/UVD/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
/home/xxx/anaconda3/envs/UVD/lib/python3.9/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
kettle:   0%|                                                                                                                                                | 0/20 [00:00<?, ?it/s]Found 1 GPUs for rendering. Using device 0.
Found 1 GPUs for rendering. Using device 0.
Found 1 GPUs for rendering. Using device 0.
Found 1 GPUs for rendering. Using device 0.
Found 1 GPUs for rendering. Using device 0.
Found 1 GPUs for rendering. Using device 0.
Found 1 GPUs for rendering. Using device 0.
100%|??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 193/193 [00:20<00:00,  9.39it/s]
kettle:   0%|                                                                                                                                                | 0/19 [00:24<?, ?it/s]
100%|??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 204/204 [00:21<00:00,  9.46it/s]
100%|??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 207/207 [00:22<00:00,  9.35it/s]
kettle:   0%|                                                                                                                                                | 0/17 [00:25<?, ?it/s]
kettle:   0%|                                                                                                                                                | 0/22 [00:25<?, ?it/s]
100%|??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 225/225 [00:22<00:00,  9.83it/s]
kettle:   0%|                                                                                                                                                | 0/14 [00:26<?, ?it/s]
100%|??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 230/230 [00:23<00:00,  9.88it/s]
kettle:   0%|                                                                                                                                                | 0/24 [00:26<?, ?it/s]
100%|??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 241/241 [00:23<00:00, 10.22it/s]
kettle:   0%|                                                                                                                                                | 0/20 [00:27<?, ?it/s]
100%|??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 253/253 [00:23<00:00, 10.61it/s]
kettle:   0%|                                                                                                                                                | 0/17 [00:27<?, ?it/s]
Error executing job with overrides: []
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/xxx/anaconda3/envs/UVD/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/xxx/anaconda3/envs/UVD/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/xxx/Videos/bin/boot/newUVD/UVD/datasets/data_gen.py", line 243, in generate_one_task_demo
    _generate_one_task_demo(**kwargs)
  File "/home/xxx/Videos/bin/boot/newUVD/UVD/datasets/data_gen.py", line 70, in _generate_one_task_demo
    env = KitchenBase(
  File "/home/xxx/Videos/bin/boot/UVD/uvd/envs/franka_kitchen/franka_kitchen_base.py", line 53, in __init__
    super(KitchenBase, self).__init__(
  File "/home/xxx/Videos/bin/boot/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/utils/configurable.py", line 133, in __init__
    base_init(self, *args, **kwargs)
  File "/home/xxx/Videos/bin/boot/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/franka/kitchen_multitask_v0.py", line 47, in __init__
    super().__init__(
  File "/home/xxx/Videos/bin/boot/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/robot_env.py", line 79, in __init__
    super(RobotEnv, self).__init__(
  File "/home/xxx/Videos/bin/boot/UVD/uvd/envs/franka_kitchen/relay-policy-learning/adept_envs/adept_envs/mujoco_env.py", line 83, in __init__
    observation, _reward, done, _info = self.step(np.zeros(self.model.nu))
  File "/home/xxx/Videos/bin/boot/UVD/uvd/envs/franka_kitchen/franka_kitchen_base.py", line 314, in step
    self.goal = self._get_task_goal()  # update goal if init
  File "/home/xxx/Videos/bin/boot/UVD/uvd/envs/franka_kitchen/franka_kitchen_base.py", line 123, in _get_task_goal
    element_idx = OBS_ELEMENT_INDICES[element]
KeyError: 'light_switch'
"""

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

Traceback (most recent call last):
  File "/home/xxx/Videos/bin/boot/newUVD/UVD/datasets/data_gen.py", line 267, in main
    pool.map(
  File "/home/xxx/anaconda3/envs/UVD/lib/python3.9/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/xxx/anaconda3/envs/UVD/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
KeyError: 'light_switch'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
zcczhang commented 7 months ago

I just grabbed a new machine and set up everything from scratch, everything works well. Maybe also recreate the conda env?

zcczhang commented 7 months ago

The names of raw dataset's directory are as following. I wonder if they should be pre-processed manually. Thank you very much! image

btw after checking the thread above, the raw_data_path should be pointed to this folder, ie containing all long-horizon tasks, sth like datasets/franka_kitchen_raw_dataset/full