clvrai / spirl

Official implementation of "Accelerating Reinforcement Learning with Learned Skill Priors", Pertsch et al., CoRL 2020
196 stars 39 forks source link

How to get the 'kitchen-mixed-v0.py' ? #22

Closed JinGyunJeong closed 2 years ago

JinGyunJeong commented 2 years ago

Hello!

When i run this code,

python3 spirl/rl/train.py --path=spirl/configs/hrl/kitchen/spirl_cl --seed=0 --prefix=SPIRL_kitchen_seed0

Then i got this key error.

completed_subtasks = info.pop("completed_tasks") KeyError: 'completed_tasks'

So, i commented it out and ran the code. It went well up to 7%. (Train Epoch: 0 [It 100001/1500000 (7%)]) But this error occured.

ValueError: tile cannot extend outside image

That means i can't render from the environment. The reason is that there is no file named 'kitchen-mixed-v0' How to get the 'kitchen-mixed-v0'? I know the code that download the offline env file but i think it doesn't opperate.

Here is my directory of the project folder. ./spirlProject ├── d4rl │   ├── AdditionalMaps_0.9.8 │   │   ├── CarlaUE4 │   │   └── Engine │   ├── CARLA_0.9.8 │   │   ├── CarlaUE4 │   │   ├── Engine │   │   ├── HDMaps │   │   ├── Import │   │   ├── PythonAPI │   │   └── Tools │   ├── d4rl │   │   ├── carla │   │   ├── carla │   │   ├── flow │   │   ├── gym_bullet │   │   ├── gym_minigrid │   │   ├── gym_mujoco │   │   ├── hand_manipulation_suite │   │   ├── kitchen │   │   ├── locomotion │   │   ├── pointmaze │   │   ├── pointmaze_bullet │   │   ├── pycache │   │   └── utils │   ├── d4rl.egg-info │   ├── flow │   │   ├── benchmarks │   │   ├── controllers │   │   ├── core │   │   ├── envs │   │   ├── multiagent_envs │   │   ├── networks │   │   ├── pycache │   │   ├── renderer │   │   ├── scenarios │   │   ├── utils │   │   └── visualize │   ├── flow222 │   │   ├── docs │   │   ├── examples │   │   ├── scripts │   │   ├── tests │   │   └── tutorials │   └── scripts │   ├── generation │   └── reference_scores ├── data ├── docs │   └── resources │   ├── env_videos │   └── policy_videos ├── experiments │   ├── hrl │   │   └── kitchen │   └── skill_prior_learning │   └── kitchen ├── spirl │   ├── components │   │   └── pycache │   ├── configs │   │   ├── data_collect │   │   ├── default_data_configs │   │   ├── hrl │   │   ├── rl │   │   └── skill_prior_learning │   ├── data │   │   ├── block_stacking │   │   ├── kitchen │   │   ├── maze │   │   ├── office │   │   └── pycache │   ├── models │   │   └── pycache │   ├── modules │   │   └── pycache │   ├── pycache │   ├── rl │   │   ├── agents │   │   ├── components │   │   ├── envs │   │   ├── policies │   │   └── utils │   └── utils │   ├── pycache__ │   └── scripts └── venv ├── bin └── lib └── python3.8

Are the d4rl or flow path wrong?

kpertsch commented 2 years ago

Hi!

Please make sure that you are installing our fork of the D4RL repo (see link in the README). If you check the closed issues here, other people had trouble with the missing "completed_task" key too since they installed the original D4RL repo and it got resolved once they switched to our fork.

Hope this helps!

JinGyunJeong commented 2 years ago

I added this line to kitchen_envs.py

env_info['completed_tasks'] = set(self.TASK_ELEMENTS) - set(self.tasks_to_complete)

Then, it works but this error occured again.

ValueError: tile cannot extend outside image

I asked above,

It went well up to 7%. (Train Epoch: 0 [It 100001/1500000 (7%)]) But this error occured. That means i can't render from the environment. The reason is that there is no file named 'kitchen-mixed-v0' How to get the 'kitchen-mixed-v0'? I know the code that download the offline env file but i think it doesn't opperate. image

I installed the D4RL your fork, but it can't find the environment i think. Is the current d4rl installation directory correct?

kpertsch commented 2 years ago

I have not seen the rendering error before, but I would hope that it too would be fixed by switching to our fork of the D4RL repo.

For the installation of our fork, please make sure that the dm_control package is installed (via pip3 install dm_control). If this package is missing the __init__.py file in the D4RL repo skips registering the kitchen environments.

Once you installed our fork and the dm_control package, you can test whether the installation is working by opening a python3 terminal, and testing:

import gym
import d4rl
gym.make("kitchen-mixed-v0")

If this does not throw an error the installation is correct.

JinGyunJeong commented 2 years ago

Thank you for responding. When i run the code, this error occured.. image

Do you know about TimeLimit error?

env = gym.make('maze2d-umaze-v1') << this code could be run.

kpertsch commented 2 years ago

The TimeLimit is not an error, it's a gym wrapper that terminates an episode automatically after a certain number of steps -- so this is intended behavior and your code seems to be working without errors.

If this is now using our D4RL fork, can you rerun the SPiRL code and see whether you still get the rendering error.

JinGyunJeong commented 2 years ago

I tried this code.

python3 spirl/rl/train.py --path=spirl/configs/hrl/kitchen/spirl_cl --seed=0 --prefix=SPIRL_kitchen_seed0

but i met the same trouble. https://github.com/clvrai/spirl/issues/22#issuecomment-1063595614

So, i changed some code in rl/train.py In "val" and "generate_rollouts" function, i changed this "sample_episode(is_train=False, render=True)" to this. "sample_episode(is_train=False, render=False)" And then it trained without problem. Do you have an idea for this?

JinGyunJeong commented 2 years ago

Oh, it works when i reinstalled d4rl. The remaining problem is 'Failed to initialize OpenGL '